< Summary

Class:DCL.UnityEditorWrappers
Assembly:ABConverter
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/ABConverter/Wrappers/Implementations/Default/AssetDatabase.cs
/tmp/workspace/unity-renderer/unity-renderer/Assets/ABConverter/Wrappers/Implementations/Default/BuildPipeline.cs
/tmp/workspace/unity-renderer/unity-renderer/Assets/ABConverter/Wrappers/Implementations/Default/WebRequest.cs
Covered lines:0
Uncovered lines:49
Coverable lines:49
Total lines:157
Line coverage:0% (0 of 49)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Refresh(...)0%2100%
SaveAssets()0%2100%
ImportAsset(...)0%2100%
DeleteAsset(...)0%2100%
MoveAsset(...)0%2100%
ReleaseCachedFileHandles()0%2100%
LoadAssetAtPath[T](...)0%2100%
GetAssetPath(...)0%2100%
AssetPathToGUID(...)0%2100%
GetTextMetaFilePathFromAssetPath(...)0%2100%
GetImporterAtPath(...)0%2100%
BuildAssetBundles(...)0%2100%
WebRequest()0%2100%
GetAsync(...)0%2100%
GetAsyncCoroutine()0%56700%
Get(...)0%20400%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/ABConverter/Wrappers/Implementations/Default/AssetDatabase.cs

#LineLine coverage
 1using UnityEditor;
 2using UnityEngine;
 3
 4namespace DCL
 5{
 6    public static partial class UnityEditorWrappers
 7    {
 8        public class AssetDatabase : IAssetDatabase
 9        {
 010            public void Refresh(ImportAssetOptions options = ImportAssetOptions.Default) { UnityEditor.AssetDatabase.Ref
 11
 012            public void SaveAssets() { UnityEditor.AssetDatabase.SaveAssets(); }
 13
 14            public void ImportAsset(string fullPath, ImportAssetOptions options = ImportAssetOptions.Default)
 15            {
 016                string assetPath = ABConverter.PathUtils.FullPathToAssetPath(fullPath);
 017                UnityEditor.AssetDatabase.ImportAsset(assetPath, options);
 018            }
 19
 20            public bool DeleteAsset(string fullPath)
 21            {
 022                string assetPath = ABConverter.PathUtils.FullPathToAssetPath(fullPath);
 023                return UnityEditor.AssetDatabase.DeleteAsset(assetPath);
 24            }
 25
 26            public string MoveAsset(string fullPathSrc, string fullPathDst)
 27            {
 028                string assetPathSrc = ABConverter.PathUtils.FullPathToAssetPath(fullPathSrc);
 029                string assetPathDst = ABConverter.PathUtils.FullPathToAssetPath(fullPathDst);
 030                return UnityEditor.AssetDatabase.MoveAsset(assetPathSrc, assetPathDst);
 31            }
 32
 033            public void ReleaseCachedFileHandles() { UnityEditor.AssetDatabase.ReleaseCachedFileHandles(); }
 34
 35            public T LoadAssetAtPath<T>(string fullPath)
 36                where T : Object
 37            {
 038                string assetPath = ABConverter.PathUtils.FullPathToAssetPath(fullPath);
 039                return UnityEditor.AssetDatabase.LoadAssetAtPath<T>(assetPath);
 40            }
 41
 042            public string GetAssetPath(Object asset) { return ABConverter.PathUtils.AssetPathToFullPath(UnityEditor.Asse
 43
 44            public string AssetPathToGUID(string fullPath)
 45            {
 046                string assetPath = ABConverter.PathUtils.FullPathToAssetPath(fullPath);
 047                return UnityEditor.AssetDatabase.AssetPathToGUID(assetPath);
 48            }
 49
 50            public string GetTextMetaFilePathFromAssetPath(string fullPath)
 51            {
 052                string assetPath = ABConverter.PathUtils.FullPathToAssetPath(fullPath);
 053                return ABConverter.PathUtils.AssetPathToFullPath(UnityEditor.AssetDatabase.GetTextMetaFilePathFromAssetP
 54            }
 55
 56            public AssetImporter GetImporterAtPath(string fullPath)
 57            {
 058                string assetPath = ABConverter.PathUtils.FullPathToAssetPath(fullPath);
 059                var importer = AssetImporter.GetAtPath(assetPath);
 060                return importer;
 61            }
 62        }
 63    }
 64}

/tmp/workspace/unity-renderer/unity-renderer/Assets/ABConverter/Wrappers/Implementations/Default/BuildPipeline.cs

#LineLine coverage
 1using UnityEditor;
 2using UnityEngine;
 3
 4namespace DCL
 5{
 6    public static partial class UnityEditorWrappers
 7    {
 8        public class BuildPipeline : IBuildPipeline
 9        {
 010            public AssetBundleManifest BuildAssetBundles(string outputPath, BuildAssetBundleOptions assetBundleOptions, 
 11        }
 12    }
 13}

/tmp/workspace/unity-renderer/unity-renderer/Assets/ABConverter/Wrappers/Implementations/Default/WebRequest.cs

#LineLine coverage
 1using System;
 2using System.Collections;
 3using System.Net.Http;
 4using DCL.Helpers;
 5using Unity.EditorCoroutines.Editor;
 6using UnityEngine.Networking;
 7using UnityGLTF;
 8
 9namespace DCL
 10{
 11    public static partial class UnityEditorWrappers
 12    {
 13        public class WebRequest : IWebRequest
 14        {
 015            private static int ASSET_REQUEST_RETRY_COUNT = 5;
 16
 017            public void GetAsync(string url, System.Action<DownloadHandler> OnCompleted, System.Action<string> OnFail) {
 18
 19            IEnumerator GetAsyncCoroutine(string url, System.Action<DownloadHandler> OnCompleted, System.Action<string> 
 20            {
 21                UnityWebRequest req;
 22
 023                int retryCount = ASSET_REQUEST_RETRY_COUNT;
 24
 25                do
 26                {
 027                    req = UnityWebRequest.Get(url);
 028                    yield return req.SendWebRequest();
 29
 030                    retryCount--;
 31
 032                    if (retryCount == 0)
 33                    {
 034                        OnFail?.Invoke(req.error);
 035                        yield break;
 36                    }
 037                } while (!req.WebRequestSucceded());
 38
 039                OnCompleted?.Invoke(req.downloadHandler);
 040            }
 41
 42            public DownloadHandler Get(string url)
 43            {
 44                UnityWebRequest req;
 45
 046                int retryCount = ASSET_REQUEST_RETRY_COUNT;
 47
 48                do
 49                {
 50                    try
 51                    {
 052                        req = UnityWebRequest.Get(url);
 053                        var op = req.SendWebRequest();
 054                        while (op.isDone == false) { }
 055                    }
 056                    catch (HttpRequestException e)
 57                    {
 058                        throw new HttpRequestException($"{e.Message} -- ({url})", e);
 59                        break;
 60                    }
 61
 062                    retryCount--;
 63
 064                    if (retryCount == 0)
 65                    {
 066                        throw new HttpRequestException($"{req.error} -- ({url})");
 67                        break;
 68                    }
 069                } while (!req.WebRequestSucceded());
 70
 071                DownloadHandler result = req.downloadHandler;
 72
 073                req.disposeDownloadHandlerOnDispose = false;
 074                req.Dispose();
 75
 076                return result;
 77            }
 78        }
 79    }
 80}