< Summary

Class:DCL.Asset_AB
Assembly:AssetPromiseKeeper
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/AssetBundles/AB/Asset_AB.cs
Covered lines:21
Uncovered lines:1
Coverable lines:22
Total lines:64
Line coverage:95.4% (21 of 22)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Asset_AB()0%110100%
GetAssetsByExtensions[T](...)0%550100%
Clone()0%2100%
CancelShow()0%110100%
Cleanup()0%220100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/AssetBundles/AB/Asset_AB.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using UnityEngine;
 3
 4namespace DCL
 5{
 6    public class Asset_AB : Asset
 7    {
 8        public int referenceCount = 0;
 9        public AssetBundle ownerAssetBundle;
 10        public string assetBundleAssetName;
 11
 2412        public Dictionary<string, List<Object>> assetsByExtension = new Dictionary<string, List<Object>>();
 13
 14        public List<T> GetAssetsByExtensions<T>(params string[] extensions)
 15            where T : Object
 16        {
 1217            var goList = new List<T>();
 18
 7219            for (int i1 = 0; i1 < extensions.Length; i1++)
 20            {
 2421                string ext = extensions[i1];
 22                List<Object> assets;
 23
 2424                if (assetsByExtension.ContainsKey(ext))
 25                {
 1126                    assets = assetsByExtension[ext];
 1127                    int glbCount = assets.Count;
 28
 4429                    for (int i = 0; i < glbCount; i++)
 30                    {
 1131                        Object go = assets[i];
 32
 1133                        if (go is T)
 1134                            goList.Add((T) go);
 35                    }
 36                }
 37            }
 38
 1239            return goList;
 40        }
 41
 2442        public Asset_AB()
 43        {
 2444        }
 45
 046        public override object Clone() => (Asset_AB) MemberwiseClone();
 47
 48        public void CancelShow()
 49        {
 750            Cleanup();
 751        }
 52
 53        public override void Cleanup()
 54        {
 3155            assetsByExtension = null;
 56
 3157            if (ownerAssetBundle)
 58            {
 1759                ownerAssetBundle.Unload(true);
 1760                ownerAssetBundle = null;
 61            }
 3162        }
 63    }
 64}