sync
This commit is contained in:
parent
ff3a72b4f7
commit
e6105d57f4
@ -46,7 +46,16 @@ namespace AssetDependencyGraph
|
||||
|
||||
public AssetDependencyGraphDB(string user, string passwd, string ip)
|
||||
{
|
||||
MongoClientSettings settings = MongoClientSettings.FromUrl(new MongoUrl($"mongodb://{user}:{passwd}@{ip}:27017/"));
|
||||
MongoClientSettings settings;
|
||||
if(string.IsNullOrEmpty(user) && !string.IsNullOrEmpty(ip))
|
||||
{
|
||||
settings = MongoClientSettings.FromUrl(new MongoUrl($"mongodb://{ip}:27017/"));
|
||||
}
|
||||
else
|
||||
{
|
||||
settings = MongoClientSettings.FromUrl(new MongoUrl($"mongodb://{user}:{passwd}@{ip}:27017/"));
|
||||
}
|
||||
|
||||
settings.ConnectTimeout = TimeSpan.FromSeconds(5);
|
||||
settings.MinConnectionPoolSize = 1;
|
||||
settings.MaxConnectionPoolSize = 25;
|
||||
|
||||
@ -48,14 +48,15 @@ namespace AssetDependencyGraph
|
||||
{
|
||||
private const float NodeWidth = 300.0f;
|
||||
DependencyAnalyzer da = new DependencyAnalyzer();
|
||||
AssetDependencyGraphDB db = new AssetDependencyGraphDB("admin", "CCS20190109", "10.225.0.170");
|
||||
AssetDependencyGraphDB db = new AssetDependencyGraphDB("", "CCS20190109", "localhost");
|
||||
|
||||
Dictionary<string, Toggle> type2Toogle = new();
|
||||
(string assetType, bool show)[] assetTypeHidenTogleItems = new[] {
|
||||
("MonoScript", true), ("Material", false), ("Shader", true),
|
||||
("ComputeShader" ,true), ("AudioClip", false), ("VideoClip", false),
|
||||
("AnimationClip", false), ("Executable" , true), ("UnityAssembly", true),
|
||||
("SourceFile", true), ("VolumeProfile", true),
|
||||
("Executable" , true), ("UnityAssembly", true), ("SourceFile", true),
|
||||
("MakeFile", true), ("DatFile", true), ("AudioClip", true),
|
||||
("VideoClip", true), ("Texture", false), ("Shader", false),
|
||||
("ComputeShader", false), ("ShaderHeader", false), ("Binary", true),
|
||||
("TextFile", true), ("Excel", true), ("UnknowFileType", false),
|
||||
};
|
||||
|
||||
Toggle AlignmentToggle;
|
||||
@ -229,7 +230,7 @@ namespace AssetDependencyGraph
|
||||
selectedObjects.Add(obj);
|
||||
|
||||
AssetGroup AssetGroup = new AssetGroup();
|
||||
AssetGroup.AssetNode = db.Find(AssetDatabase.GetAssetPath(obj).ToUnityFullPath());
|
||||
AssetGroup.AssetNode = db.Find(AssetDatabase.GetAssetPath(obj).ToUniversalPath());
|
||||
assetGroups.Add(AssetGroup);
|
||||
|
||||
// assetPath will be empty if obj is null or isn't an asset (a scene object)
|
||||
@ -247,7 +248,7 @@ namespace AssetDependencyGraph
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
obj = AssetDatabase.LoadMainAssetAtPath(AssetGroup.AssetNode.Self.Path.ToUnityRelatePath());
|
||||
obj = AssetDatabase.LoadMainAssetAtPath(AssetGroup.AssetNode.Self.Path);
|
||||
|
||||
if (obj == null)
|
||||
{
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
@ -8,11 +9,146 @@ using Object = UnityEngine.Object;
|
||||
|
||||
namespace AssetDependencyGraph
|
||||
{
|
||||
public static class FileExtensionHelper
|
||||
{
|
||||
public static string GetTypeByExtension(string ext)
|
||||
{
|
||||
switch (ext.ToLowerInvariant())
|
||||
{
|
||||
case ".a":
|
||||
case ".dll":
|
||||
case ".so":
|
||||
case ".exe":
|
||||
case ".dynlib":
|
||||
return "Executable";
|
||||
case ".asmdef":
|
||||
case ".asmref":
|
||||
return "UnityAssembly";
|
||||
case ".cs":
|
||||
case ".lua":
|
||||
case ".js":
|
||||
case ".ts":
|
||||
case ".java":
|
||||
case ".h":
|
||||
case ".cpp":
|
||||
case ".cxx":
|
||||
case ".mm":
|
||||
case ".py":
|
||||
case ".bat":
|
||||
case ".jar":
|
||||
case ".arr":
|
||||
case ".jslib":
|
||||
return "SourceFile";
|
||||
case ".gradle":
|
||||
return "MakeFile";
|
||||
case ".dat":
|
||||
case ".data":
|
||||
return "DatFile";
|
||||
case ".mp3":
|
||||
case ".ogg":
|
||||
case ".wav":
|
||||
return "AudioClip";
|
||||
case ".mp4":
|
||||
case ".webm":
|
||||
return "VideoClip";
|
||||
case ".mat":
|
||||
return "Material";
|
||||
case ".rendertexture":
|
||||
case ".dds":
|
||||
case ".exr":
|
||||
case ".hdr":
|
||||
case ".png":
|
||||
case ".jpg":
|
||||
case ".gif":
|
||||
case ".psd":
|
||||
case ".bmp":
|
||||
case ".tiff":
|
||||
case ".tga":
|
||||
case ".gradient":
|
||||
case ".spriteatlas":
|
||||
return "Texture";
|
||||
case ".obj":
|
||||
case ".fbx":
|
||||
case ".mesh":
|
||||
return "Mesh";
|
||||
case ".shader":
|
||||
case ".surfshader":
|
||||
case ".shadergraph":
|
||||
return "Shader";
|
||||
case ".compute":
|
||||
return "ComputeShader";
|
||||
case ".hlsl":
|
||||
case ".cginc":
|
||||
case ".shadersubgraph":
|
||||
return "ShaderHeader";
|
||||
case ".otf":
|
||||
case ".ttf":
|
||||
return "Font";
|
||||
case ".byte":
|
||||
case ".bytes":
|
||||
case ".bin":
|
||||
return "Binary";
|
||||
case ".txt":
|
||||
case ".md":
|
||||
case ".chm":
|
||||
case ".yml":
|
||||
case ".url":
|
||||
case ".json":
|
||||
case ".json5":
|
||||
case ".xml":
|
||||
case ".uxml":
|
||||
case ".nson":
|
||||
case ".config":
|
||||
case ".pdf":
|
||||
return "TextFile";
|
||||
case ".xlsx":
|
||||
case ".xls":
|
||||
return "Excel";
|
||||
default:
|
||||
return "UnknowFileType";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static bool IsPackage(string ext)
|
||||
{
|
||||
switch (ext.ToLowerInvariant())
|
||||
{
|
||||
case ".prefab":
|
||||
case ".unity":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool NeedAnalyzeDepend(string ext)
|
||||
{
|
||||
switch (ext.ToLowerInvariant())
|
||||
{
|
||||
case ".prefab":
|
||||
case ".unity":
|
||||
case ".asset":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static bool Exclude(string path) => path.EndsWith(".meta")
|
||||
|| path.EndsWith(".unitypackage")
|
||||
|| path.EndsWith(".preset")
|
||||
|| path.EndsWith(".backup")
|
||||
|| path.EndsWith(".tmp")
|
||||
|| path.EndsWith(".editor")
|
||||
|| path.EndsWith(".zip")
|
||||
|| path.EndsWith(".scenetemplate");
|
||||
}
|
||||
|
||||
public interface IDependencyAnalysis
|
||||
{
|
||||
void Analyze(string path, Dictionary<AssetIdentify, AssetNode> result);
|
||||
void Analyze(string path, ConcurrentDictionary<AssetIdentify, AssetNode> result);
|
||||
|
||||
public (AssetIdentify id, AssetNode node) GetOrCreateFolderNode(string path, Dictionary<AssetIdentify, AssetNode> result)
|
||||
public (AssetIdentify id, AssetNode node) GetOrCreateFolderNode(string path, ConcurrentDictionary<AssetIdentify, AssetNode> result)
|
||||
{
|
||||
AssetIdentify k = null;
|
||||
|
||||
@ -43,7 +179,7 @@ namespace AssetDependencyGraph
|
||||
return (k, result[k]);
|
||||
}
|
||||
|
||||
public (AssetIdentify id, AssetNode node) GetOrCreateAssetNode(string path, Dictionary<AssetIdentify, AssetNode> result)
|
||||
public (AssetIdentify id, AssetNode node) GetOrCreateAssetNode(string path, ConcurrentDictionary<AssetIdentify, AssetNode> result)
|
||||
{
|
||||
AssetIdentify k = null;
|
||||
|
||||
@ -61,9 +197,9 @@ namespace AssetDependencyGraph
|
||||
{
|
||||
Path = path,
|
||||
Guid = null,
|
||||
Md5 = Utils.Md5(path)
|
||||
//Md5 = Utils.Md5(path)
|
||||
};
|
||||
if (path.EndsWith(".prefab") || path.EndsWith(".unity"))
|
||||
if (FileExtensionHelper.IsPackage(Path.GetExtension(path)))
|
||||
{
|
||||
result[k] = new PackageNode()
|
||||
{
|
||||
@ -81,50 +217,13 @@ namespace AssetDependencyGraph
|
||||
|
||||
return (k, result[k]);
|
||||
}
|
||||
|
||||
public bool Exclude(string path) => path.EndsWith(".meta");
|
||||
|
||||
public string GetTypeByExtension(string ext)
|
||||
{
|
||||
switch (ext.ToLowerInvariant())
|
||||
{
|
||||
case ".a":
|
||||
case ".dll":
|
||||
case ".so":
|
||||
case ".exe":
|
||||
case ".dynlib":
|
||||
return "Executable";
|
||||
case ".asmdef":
|
||||
case ".asmref":
|
||||
return "UnityAssembly";
|
||||
case ".cs":
|
||||
case ".lua":
|
||||
case ".js":
|
||||
case ".ts":
|
||||
case ".java":
|
||||
case ".h":
|
||||
case ".cpp":
|
||||
case ".cxx":
|
||||
case ".mm":
|
||||
return "SourceFile";
|
||||
case ".json":
|
||||
case ".json5":
|
||||
return "JsonFile";
|
||||
case ".xml":
|
||||
return "XmlFile";
|
||||
case ".dat":
|
||||
return "DatFile";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class UnityDependencyAnalysis : IDependencyAnalysis
|
||||
public class UnityDependencyAnalysis1 : IDependencyAnalysis
|
||||
{
|
||||
HashSet<string> processed = new();
|
||||
|
||||
public void Analyze(string path, Dictionary<AssetIdentify, AssetNode> result)
|
||||
public void Analyze(string path, ConcurrentDictionary<AssetIdentify, AssetNode> result)
|
||||
{
|
||||
if (!processed.Add(path))
|
||||
{
|
||||
@ -136,7 +235,7 @@ namespace AssetDependencyGraph
|
||||
var relatePath = path.ToUnityRelatePath();
|
||||
kv.id.Guid = AssetDatabase.AssetPathToGUID(relatePath);
|
||||
var selfNode = kv.node;
|
||||
if (dependencyAnalysis.GetTypeByExtension(Path.GetExtension(path)) is string assetType && assetType != null)
|
||||
if (FileExtensionHelper.GetTypeByExtension(Path.GetExtension(path)) is string assetType && assetType != null)
|
||||
{
|
||||
kv.id.AssetType = assetType;
|
||||
selfNode.AssetType = assetType;
|
||||
@ -164,7 +263,7 @@ namespace AssetDependencyGraph
|
||||
string[] dependencies = AssetDatabase.GetDependencies(relatePath, false);
|
||||
for (int i = 0; i < dependencies.Length; i++)
|
||||
{
|
||||
var dep = dependencies[i].ToUnityFullPath();
|
||||
var dep = dependencies[i].ToUnityRelatePath();
|
||||
var depkv = dependencyAnalysis.GetOrCreateAssetNode(dep, result);
|
||||
depkv.node.Dependent.Add(selfNode.Self);
|
||||
selfNode.Dependencies.Add(depkv.id);
|
||||
@ -177,70 +276,106 @@ namespace AssetDependencyGraph
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class FolderDependencyAnalysis : IDependencyAnalysis
|
||||
{
|
||||
public void Analyze(string path, Dictionary<AssetIdentify, AssetNode> result)
|
||||
public void Analyze(string path, ConcurrentDictionary<AssetIdentify, AssetNode> result)
|
||||
{
|
||||
var dependencyAnalysis = (this as IDependencyAnalysis);
|
||||
var k = dependencyAnalysis.GetOrCreateFolderNode(path, result);
|
||||
|
||||
Utils.TraverseDirectory(path, (p) =>
|
||||
foreach (string file in Directory.EnumerateFiles(path))
|
||||
{
|
||||
p = p.ToUniversalPath();
|
||||
|
||||
if (dependencyAnalysis.Exclude(p))
|
||||
if (FileExtensionHelper.Exclude(file))
|
||||
{
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
var p = file.ToUnityRelatePath().ToUniversalPath();
|
||||
var selfNode = result[k.id];
|
||||
if (Directory.Exists(p))
|
||||
{
|
||||
var kv = dependencyAnalysis.GetOrCreateFolderNode(p, result);
|
||||
kv.node.Dependent.Add(selfNode.Self);
|
||||
selfNode.Dependencies.Add(kv.id);
|
||||
}
|
||||
else if (File.Exists(p))
|
||||
{
|
||||
var kv = dependencyAnalysis.GetOrCreateAssetNode(p, result);
|
||||
var kv = dependencyAnalysis.GetOrCreateAssetNode(p, result);
|
||||
|
||||
kv.node.Dependent.Add(selfNode.Self);
|
||||
selfNode.Dependencies.Add(kv.id);
|
||||
kv.node.Dependent.Add(selfNode.Self);
|
||||
selfNode.Dependencies.Add(kv.id);
|
||||
}
|
||||
|
||||
foreach (string directory in Directory.EnumerateDirectories(path))
|
||||
{
|
||||
var p = directory.ToUnityRelatePath().ToUniversalPath();
|
||||
var selfNode = result[k.id];
|
||||
var kv = dependencyAnalysis.GetOrCreateFolderNode(p, result);
|
||||
kv.node.Dependent.Add(selfNode.Self);
|
||||
selfNode.Dependencies.Add(kv.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class UnityDependencyAnalysis2 : IDependencyAnalysis
|
||||
{
|
||||
UnityLmdb unityLmdb;
|
||||
HashSet<string> processed = new();
|
||||
public UnityDependencyAnalysis2()
|
||||
{
|
||||
unityLmdb = new UnityLmdb();
|
||||
unityLmdb.ResolveGuidPath();
|
||||
}
|
||||
|
||||
public void Analyze(string path, ConcurrentDictionary<AssetIdentify, AssetNode> result)
|
||||
{
|
||||
if (!processed.Add(path))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var dependencyAnalysis = (this as IDependencyAnalysis);
|
||||
|
||||
var kv = dependencyAnalysis.GetOrCreateAssetNode(path, result);
|
||||
var relatePath = path.ToUnityRelatePath();
|
||||
kv.id.Guid = unityLmdb.GetGuidByPath(relatePath);
|
||||
var selfNode = kv.node;
|
||||
var ext = Path.GetExtension(path);
|
||||
var assetType = FileExtensionHelper.GetTypeByExtension(ext);
|
||||
|
||||
selfNode.AssetType = assetType;
|
||||
kv.id.AssetType = assetType;
|
||||
if (FileExtensionHelper.NeedAnalyzeDepend(ext))
|
||||
{
|
||||
var dependencies = UnityFileApi.DependencyTool.GetDependencies(path);
|
||||
for (int i = 0; i < dependencies.Count; i++)
|
||||
{
|
||||
var dep = dependencies[i].ToUnityRelatePath();
|
||||
var depkv = dependencyAnalysis.GetOrCreateAssetNode(dep, result);
|
||||
depkv.node.Dependent.Add(selfNode.Self);
|
||||
selfNode.Dependencies.Add(depkv.id);
|
||||
Analyze(dep, result);
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class DependencyAnalyzer
|
||||
{
|
||||
private Dictionary<Predicate<string>, IDependencyAnalysis> dependencyAnalysisDic = new();
|
||||
private Dictionary<AssetIdentify, AssetNode> assetIdentify2AssetNodeDic = new();
|
||||
private ConcurrentDictionary<AssetIdentify, AssetNode> assetIdentify2AssetNodeDic = new();
|
||||
private List<string> allPath = new();
|
||||
|
||||
|
||||
private bool Exclude(string path) => path.EndsWith(".meta");
|
||||
|
||||
public DependencyAnalyzer()
|
||||
{
|
||||
dependencyAnalysisDic.Add(new Predicate<string>(path => !Directory.Exists(path)), new UnityDependencyAnalysis());
|
||||
//dependencyAnalysisDic.Add(new Predicate<string>(path => !Directory.Exists(path)), new UnityDependencyAnalysis1());
|
||||
//dependencyAnalysisDic.Add(new Predicate<string>(path => !Directory.Exists(path)), new UnityDependencyAnalysis2());
|
||||
dependencyAnalysisDic.Add(new Predicate<string>(path => Directory.Exists(path)), new FolderDependencyAnalysis());
|
||||
}
|
||||
|
||||
|
||||
private void Visivt(string path)
|
||||
{
|
||||
path = path.ToUniversalPath();
|
||||
if (Exclude(path))
|
||||
if (FileExtensionHelper.Exclude(path))
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (var item in dependencyAnalysisDic)
|
||||
{
|
||||
if (item.Key(path))
|
||||
{
|
||||
item.Value.Analyze(path, assetIdentify2AssetNodeDic);
|
||||
}
|
||||
}
|
||||
allPath.Add(path);
|
||||
|
||||
}
|
||||
|
||||
public void Analyze(string rootFolder)
|
||||
@ -248,9 +383,21 @@ namespace AssetDependencyGraph
|
||||
Stopwatch sw = Stopwatch.StartNew();
|
||||
sw.Start();
|
||||
Utils.TraverseDirectory(rootFolder, Visivt, -1);
|
||||
Parallel.ForEach(allPath, (path) =>
|
||||
{
|
||||
path = path.ToUnityRelatePath();
|
||||
foreach (var item in dependencyAnalysisDic)
|
||||
{
|
||||
if (item.Key(path))
|
||||
{
|
||||
item.Value.Analyze(path, assetIdentify2AssetNodeDic);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
sw.Stop();
|
||||
UnityEngine.Debug.Log($"分析引用耗时:{sw.ElapsedMilliseconds / 1000f}s");
|
||||
AssetDependencyGraphDB db = new AssetDependencyGraphDB("admin", "CCS20190109", "10.225.0.170");
|
||||
AssetDependencyGraphDB db = new AssetDependencyGraphDB("", "", "localhost");
|
||||
sw.Restart();
|
||||
db.Clean();
|
||||
Parallel.ForEach(assetIdentify2AssetNodeDic, item =>
|
||||
|
||||
125
Assets/AssetDependencyGraph/Editor/UnityLmdb.cs
Normal file
125
Assets/AssetDependencyGraph/Editor/UnityLmdb.cs
Normal file
@ -0,0 +1,125 @@
|
||||
using LightningDB;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace AssetDependencyGraph
|
||||
{
|
||||
public sealed class UnityLmdb
|
||||
{
|
||||
private Dictionary<string, string> guid2Path = new();
|
||||
private Dictionary<string, string> path2Guid = new();
|
||||
private static readonly string unityPath;
|
||||
private static readonly string projPath;
|
||||
|
||||
static UnityLmdb()
|
||||
{
|
||||
var args = Environment.GetCommandLineArgs();
|
||||
unityPath = Path.GetDirectoryName(args[0]);
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
if (args[i].ToLowerInvariant() == "-projectpath")
|
||||
{
|
||||
projPath = args[i + 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] Guid2LmdbKey(string guid)
|
||||
{
|
||||
var inputByteArray = new byte[guid.Length / 2];
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < guid.Length; i += 2)
|
||||
{
|
||||
sb.Append(guid[i + 1]);
|
||||
sb.Append(guid[i]);
|
||||
}
|
||||
guid = sb.ToString();
|
||||
for (var x = 0; x < inputByteArray.Length; x++)
|
||||
{
|
||||
inputByteArray[x] = (byte)Convert.ToInt32(guid.Substring(x * 2, 2), 16);
|
||||
}
|
||||
|
||||
return inputByteArray;
|
||||
}
|
||||
|
||||
public static string LmdbKey2Guid(byte[] bytes)
|
||||
{
|
||||
StringBuilder ret = new StringBuilder();
|
||||
for (var i = 0; i < bytes.Length; i++)
|
||||
{
|
||||
ret.AppendFormat("{0:x2}", bytes[i]);
|
||||
if (ret.Length == 32)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < ret.Length; i += 2)
|
||||
{
|
||||
var c = ret[i];
|
||||
ret[i] = ret[i + 1];
|
||||
ret[i + 1] = c;
|
||||
}
|
||||
var hex = ret.ToString();
|
||||
return hex;
|
||||
}
|
||||
|
||||
public void ResolveGuidPath()
|
||||
{
|
||||
var sourceDbPath = Path.Combine(projPath, "Library", "SourceAssetDB");
|
||||
var dbPath = Path.Combine(projPath, "Library", "SourceAssetDB1");
|
||||
File.Copy(sourceDbPath, dbPath, true);
|
||||
using var env = new LightningEnvironment(dbPath, configuration: new()
|
||||
{
|
||||
MaxDatabases = 64,
|
||||
MaxReaders = 64,
|
||||
});
|
||||
env.Open(EnvironmentOpenFlags.NoSubDir | EnvironmentOpenFlags.ReadOnly);
|
||||
using var tx = env.BeginTransaction(TransactionBeginFlags.ReadOnly);
|
||||
using (var db = tx.OpenDatabase("GuidToPath", closeOnDispose: true))
|
||||
using (var cursor = tx.CreateCursor(db))
|
||||
{
|
||||
foreach (var item in cursor.AsEnumerable())
|
||||
{
|
||||
guid2Path[LmdbKey2Guid(item.Item1.AsSpan().ToArray())] = Encoding.UTF8.GetString(item.Item2.AsSpan()).ToLowerInvariant().Trim();
|
||||
}
|
||||
}
|
||||
|
||||
using (var db = tx.OpenDatabase("PathToGuid", closeOnDispose: true))
|
||||
using (var cursor = tx.CreateCursor(db))
|
||||
{
|
||||
foreach (var item in cursor.AsEnumerable())
|
||||
{
|
||||
path2Guid[Encoding.UTF8.GetString(item.Item1.AsSpan()).ToLowerInvariant().Trim()] = LmdbKey2Guid(item.Item2.AsSpan().ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public string GetGuidByPath(string path)
|
||||
{
|
||||
if (path2Guid.ContainsKey(path))
|
||||
{
|
||||
return path2Guid[path];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetPathByGuid(string guid)
|
||||
{
|
||||
if (guid2Path.ContainsKey(guid))
|
||||
{
|
||||
return guid2Path[guid];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/AssetDependencyGraph/Editor/UnityLmdb.cs.meta
Normal file
11
Assets/AssetDependencyGraph/Editor/UnityLmdb.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ffc50b27ba42c94c8b2cafa818c13eb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,11 +1,17 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AssetDependencyGraph
|
||||
{
|
||||
public static class Utils
|
||||
{
|
||||
static readonly string dataPath;
|
||||
static Utils()
|
||||
{
|
||||
dataPath = Application.dataPath;
|
||||
}
|
||||
public static string Md5(string filename)
|
||||
{
|
||||
try
|
||||
@ -48,19 +54,19 @@ namespace AssetDependencyGraph
|
||||
|
||||
public static string ToUnityRelatePath(this string path)
|
||||
{
|
||||
if(path.StartsWith(Application.dataPath.ToUniversalPath().Replace("Assets", "")) && !path.StartsWith(Application.dataPath.ToUniversalPath() + "/Assets"))
|
||||
if(path.StartsWith(dataPath.ToUniversalPath().Replace("Assets", "")) && !path.StartsWith(dataPath.ToUniversalPath() + "/Assets"))
|
||||
{
|
||||
return path.Replace(Application.dataPath.ToUniversalPath().Replace("Assets", ""), "");
|
||||
return path.Replace(dataPath.ToUniversalPath().Replace("Assets", ""), "");
|
||||
}
|
||||
return path.Replace(Application.dataPath.ToUniversalPath(), "Assets");
|
||||
return path.Replace(dataPath.ToUniversalPath(), "Assets");
|
||||
}
|
||||
|
||||
public static string ToUnityFullPath(this string path)
|
||||
{
|
||||
if(path.StartsWith("Packages"))
|
||||
{
|
||||
var fullPath = (Application.dataPath.ToUniversalPath().Replace("Assets", "") + path);
|
||||
fullPath ??= (Application.dataPath.ToUniversalPath().Replace("Assets", "Library/PackageCache") + path);
|
||||
var fullPath = (dataPath.ToUniversalPath().Replace("Assets", "") + path);
|
||||
fullPath ??= (dataPath.ToUniversalPath().Replace("Assets", "Library/PackageCache") + path);
|
||||
if (!File.Exists(fullPath) && Directory.Exists(fullPath))
|
||||
{
|
||||
Debug.LogWarning($"ToUnityFullPath failure:{path}");
|
||||
@ -69,7 +75,17 @@ namespace AssetDependencyGraph
|
||||
return fullPath;
|
||||
}
|
||||
|
||||
return Application.dataPath.ToUniversalPath().Replace("Assets", "") + path;
|
||||
return dataPath.ToUniversalPath().Replace("Assets", "") + path;
|
||||
}
|
||||
|
||||
public static string ByteString(this byte[] bytes)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (int i = 0; i < bytes.Length; i++)
|
||||
{
|
||||
stringBuilder.Append(Convert.ToString(bytes[i], 2) );
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
Assets/AssetDependencyGraph/Plugins/Crc32.NET.dll
Normal file
BIN
Assets/AssetDependencyGraph/Plugins/Crc32.NET.dll
Normal file
Binary file not shown.
87
Assets/AssetDependencyGraph/Plugins/Crc32.NET.dll.meta
Normal file
87
Assets/AssetDependencyGraph/Plugins/Crc32.NET.dll.meta
Normal file
@ -0,0 +1,87 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe95ecf4b38fba648b13da516d4d36b5
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 1
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
AndroidSharedLibraryType: Executable
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: Windows
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
CPU: AnyCPU
|
||||
CompileFlags:
|
||||
FrameworkDependencies:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/AssetDependencyGraph/Plugins/LightningDB.dll
Normal file
BIN
Assets/AssetDependencyGraph/Plugins/LightningDB.dll
Normal file
Binary file not shown.
87
Assets/AssetDependencyGraph/Plugins/LightningDB.dll.meta
Normal file
87
Assets/AssetDependencyGraph/Plugins/LightningDB.dll.meta
Normal file
@ -0,0 +1,87 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e4c5c5a6e7fdcf4a9bf7c06b691779d
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 1
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
AndroidSharedLibraryType: Executable
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86_64
|
||||
DefaultValueInitialized: true
|
||||
OS: Windows
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
CPU: AnyCPU
|
||||
CompileFlags:
|
||||
FrameworkDependencies:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/AssetDependencyGraph/Plugins/UnityFileDumper.dll
Normal file
BIN
Assets/AssetDependencyGraph/Plugins/UnityFileDumper.dll
Normal file
Binary file not shown.
87
Assets/AssetDependencyGraph/Plugins/UnityFileDumper.dll.meta
Normal file
87
Assets/AssetDependencyGraph/Plugins/UnityFileDumper.dll.meta
Normal file
@ -0,0 +1,87 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c6f3ef996ab94842b02f3e832349bc1
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 1
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
AndroidSharedLibraryType: Executable
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86_64
|
||||
DefaultValueInitialized: true
|
||||
OS: Windows
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
CPU: AnyCPU
|
||||
CompileFlags:
|
||||
FrameworkDependencies:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/AssetDependencyGraph/Plugins/UnityFileSystemApi.dll
Normal file
BIN
Assets/AssetDependencyGraph/Plugins/UnityFileSystemApi.dll
Normal file
Binary file not shown.
@ -0,0 +1,81 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f19ef81d4f8ae746801dadcb62225a5
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 1
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
AndroidSharedLibraryType: Executable
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86_64
|
||||
DefaultValueInitialized: true
|
||||
OS: Windows
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
CPU: AnyCPU
|
||||
CompileFlags:
|
||||
FrameworkDependencies:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/AssetDependencyGraph/Plugins/lmdb.dll
Normal file
BIN
Assets/AssetDependencyGraph/Plugins/lmdb.dll
Normal file
Binary file not shown.
81
Assets/AssetDependencyGraph/Plugins/lmdb.dll.meta
Normal file
81
Assets/AssetDependencyGraph/Plugins/lmdb.dll.meta
Normal file
@ -0,0 +1,81 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9883f43a7e5cf0a47828e7f96db4726e
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 1
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
AndroidSharedLibraryType: Executable
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86_64
|
||||
DefaultValueInitialized: true
|
||||
OS: Windows
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
CPU: AnyCPU
|
||||
CompileFlags:
|
||||
FrameworkDependencies:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
x
Reference in New Issue
Block a user