Esempio n. 1
0
        public static void initPluginDlls()
        {
            List <string> dlls = FileHelper.FindFile("Assets/Plugins/", new string[] { "*.dll" });

            SaveGUIDMap saveGuidMap = Get();

            bool hasNew = false;

            foreach (string dllItem in dlls)
            {
                string dllPath = dllItem.Replace(Application.dataPath, "Assets");
                Dictionary <int, string> dic = FileIDUtil.getAllFileIDByDll(dllPath);
                if (dic == null)
                {
                    continue;
                }
                foreach (int key in dic.Keys)
                {
                    if (saveGuidMap.addFileID(key.ToString(), dic[key], false))
                    {
                        hasNew = true;
                    }
                }
            }

            if (hasNew)
            {
                saveGuidMap.save();
            }
        }
Esempio n. 2
0
        private static string[] OnWillSaveAssets(string[] paths)
        {
            if (ToolsExtends.enabledAutoAMF == false)
            {
                return(paths);
            }
            SaveGUIDMap map = SaveGUIDMap.Get();
            bool        has = false;

            foreach (string path in paths)
            {
                if (path.EndsWith(".prefab"))
                {
                    try
                    {
                        PrefabFileRefGet prefabFileRefGet = PrefabFileRefGet.get(path);
                        map.add(prefabFileRefGet);
                        has = true;
                    }
                    catch (Exception)
                    {
                        Debug.LogError("保存Prefab guid出错 :" + path);
                    }
                }
            }


            if (has)
            {
                map.save();
            }
            return(paths);
        }
Esempio n. 3
0
        public static SaveGUIDMap Get(string path = null)
        {
            if (path == null)
            {
                path = "Assets/GuidMapping/" + SystemInfo.deviceUniqueIdentifier + "_c.amf";
            }
            SaveGUIDMap s = FileHelper.GetAMF(path) as SaveGUIDMap;

            if (s == null)
            {
                s            = new SaveGUIDMap();
                s.deviceName = SystemInfo.deviceName;
            }
            s.path = path;
            return(s);
        }
Esempio n. 4
0
        public static void GetProjectAllGUID()
        {
            string[] allAssetPaths = AssetDatabase.GetAllAssetPaths();

            string      path    = "Assets/GuidMapping/" + SystemInfo.deviceUniqueIdentifier + "_a.amf";
            SaveGUIDMap guidMap = SaveGUIDMap.Get(path);

            foreach (string assetPath in allAssetPaths)
            {
                string guid = AssetDatabase.AssetPathToGUID(assetPath);
                if (string.IsNullOrEmpty(guid))
                {
                    continue;
                }

                guidMap.addGuid(guid, assetPath, false);
            }
            guidMap.save();
        }
Esempio n. 5
0
        public static SaveGUIDMap GetALL()
        {
            SaveGUIDMap s = new SaveGUIDMap();

            List <string> amfs = FileHelper.FindFile("Assets/GuidMapping/", new string[] { "*.amf" });

            foreach (string amf in amfs)
            {
                string      amfPath = amf.Replace(Application.dataPath, "Assets");
                SaveGUIDMap item    = FileHelper.GetAMF(amfPath) as SaveGUIDMap;

                foreach (string guid in item.guidMapping.Keys)
                {
                    if (s.guidMapping.ContainsKey(guid) == false)
                    {
                        s.guidMapping.Add(guid, item.guidMapping[guid]);
                    }
                }
                foreach (string fileID in item.fileIDMapping.Keys)
                {
                    if (s.fileIDMapping.ContainsKey(fileID) == false)
                    {
                        s.fileIDMapping.Add(fileID, item.fileIDMapping[fileID]);
                    }
                }
            }

            string path = "Assets/GuidMapping/replace.txt";

            if (File.Exists(path))
            {
                using (StreamReader reader = File.OpenText(path))
                {
                    string content = reader.ReadToEnd();
                    getMapping(content);
                }
            }

            return(s);
        }
Esempio n. 6
0
 public FindMissHelper()
 {
     map = SaveGUIDMap.GetALL();
     SaveGUIDMap.initPluginDlls();
 }