< Summary

Class:MainScripts.DCL.AssetsEmbedment.Editor.TextureEmbedder
Assembly:AssetsEmbedmentEditor
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/AssetsEmbedment/Editor/TextureEmbedder.cs
Covered lines:0
Uncovered lines:7
Coverable lines:7
Total lines:26
Line coverage:0% (0 of 7)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
EmbedAsync()0%56700%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/AssetsEmbedment/Editor/TextureEmbedder.cs

#LineLine coverage
 1using Cysharp.Threading.Tasks;
 2using MainScripts.DCL.AssetsEmbedment.Runtime;
 3using System.Collections.Generic;
 4using System.IO;
 5using System.Linq;
 6using System.Threading.Tasks;
 7using UnityEngine;
 8
 9namespace MainScripts.DCL.AssetsEmbedment.Editor
 10{
 11    public class TextureEmbedder : AssetEmbedder
 12    {
 013        internal static string texturesPath => Path.Combine(Application.dataPath, "Resources", EmbeddedTextureResourcesP
 14
 15        public static async UniTask EmbedAsync(Dictionary<string, Texture2D> loadedData, string subPath)
 16        {
 017            var targetPath = string.IsNullOrEmpty(subPath) ? texturesPath : Path.Combine(texturesPath, subPath);
 018            ResetTargetPath(targetPath);
 19
 020            var encodedToPng = loadedData.Select(kvp => (kvp.Key, kvp.Value.EncodeToPNG())).ToList();
 21
 022            await Task.WhenAll(encodedToPng.Select(d => File.WriteAllBytesAsync(Path.Combine(targetPath, d.Key + ".png")
 023            await UniTask.SwitchToMainThread();
 024        }
 25    }
 26}

Methods/Properties

texturesPath()
EmbedAsync()