Esempio n. 1
0
 public override bool Equals(object obj)
 {
     if (obj is AssetDigest)
     {
         AssetDigest that = obj as AssetDigest;
         return(this.path == that.path &&
                this.assetHash == that.assetHash &&
                this.metaHash == that.metaHash);
     }
     return(false);
 }
Esempio n. 2
0
        private AssetDigest GetDigest(Dictionary <string, AssetDigest> snapshot, string path)
        {
            AssetDigest d = snapshot.Get(path);

            if (d == null)
            {
                d              = new AssetDigest();
                d.path         = path;
                snapshot[path] = d;
            }
            return(d);
        }
Esempio n. 3
0
 private void LoadSnapshot(Dictionary <string, AssetDigest> snapshot, string path)
 {
     if (!File.Exists(path))
     {
         return;
     }
     foreach (string line in File.ReadAllLines(path, Encoding.UTF8))
     {
         AssetDigest a = new AssetDigest(line);
         if (a.IsValid())
         {
             snapshot[a.path] = a;
         }
     }
 }
Esempio n. 4
0
        private List <string> GetRawAssetMods(AssetSnapshot snapshot, string srcDir)
        {
            List <string> mod = new List <string>();

            foreach (string assetPath in EditorAssetUtil.ListAssetPaths(srcDir, FileType.All, true))
            {
                if (assetPath.EndsWithIgnoreCase(".meta") || Path.GetFileName(assetPath).StartsWith(".", StringComparison.Ordinal))
                {
                    continue;
                }

                AssetDigest digest = snapshot.GetAssetDigest(assetPath);
                if (digest.IsModified())
                {
                    mod.Add(assetPath);
                }
            }
            return(mod);
        }
Esempio n. 5
0
        static bool IsDepModified(AssetSnapshot snapshot, AssetDigest digest)
        {
            string[] dependPaths = AssetDatabase.GetDependencies(new string[] { "Assets/" + digest.path });
            bool     modified    = digest.IsModified();

            // check dependencies midified
            for (int i = 0; i < dependPaths.Length; ++i)
            {
                dependPaths[i] = EditorAssetUtil.GetAssetRelativePath(dependPaths[i]);
                if (digest.path == dependPaths[i])
                {
                    continue;
                }
                AssetDigest depDigest = snapshot.GetDependDigest(dependPaths[i]);
                modified |= depDigest.IsModified();
                if (depDigest.path.Is(FileType.Asset, FileType.Prefab))
                {
                    modified |= IsDepModified(snapshot, depDigest);
                }
            }
            return(modified);
        }
Esempio n. 6
0
        private List <string> GetAssetMods(AssetSnapshot snapshot, string srcDir)
        {
            List <string> mods = new List <string>();

            string[] assetPaths = EditorAssetUtil.ListAssetPaths(srcDir, FileType.All, true);
            foreach (string assetPath in assetPaths)
            {
                if (assetPath.EndsWithIgnoreCase(".meta") ||
                    Path.GetFileName(assetPath).StartsWith(".", StringComparison.Ordinal) ||
                    assetPath.EndsWithIgnoreCase(".unity"))
                {
                    continue;
                }

                AssetDigest digest   = snapshot.GetAssetDigest(assetPath);
                bool        modified = IsDepModified(snapshot, digest);

                if (modified)
                {
                    mods.Add(assetPath);
                }
            }
            return(mods);
        }