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();
            }
        }
Exemple #2
0
        private void getKeyValuePair(string item, string header)
        {
            int indexL = item.IndexOf("{");
            int indexR = item.IndexOf("}");

            if (indexL == -1 || indexR == -1)
            {
                return;
            }
            string context = item.Substring(indexL + 1, indexR - indexL - 1);

            if (string.IsNullOrEmpty(context))
            {
                return;
            }

            string[] propertys = context.Split(',');
            string[] keyValues;

            string key;
            string value;
            Dictionary <string, string> keyValuePair = new Dictionary <string, string>();

            foreach (string property in propertys)
            {
                if (string.IsNullOrEmpty(property))
                {
                    continue;
                }

                keyValues = property.Split(':');

                if (keyValues.Length != 2)
                {
                    continue;
                }

                key   = keyValues[0].Trim();
                value = keyValues[1].Trim();
                keyValuePair.Add(key, value);
            }

            if (keyValuePair.ContainsKey("guid") && keyValuePair.ContainsKey("fileID"))
            {
                FileRefVO vo = new FileRefVO();
                vo.guid      = keyValuePair["guid"];
                vo.fileID    = keyValuePair["fileID"];
                vo.type      = int.Parse(keyValuePair["type"]);
                vo.lineValue = item;

                item            = item.Replace(vo.guid, "$1");
                vo.templeteLine = item.Replace(vo.fileID, "$0");

                vo.guidPath = AssetDatabase.GUIDToAssetPath(vo.guid);
                if (item.StartsWith("m_Script:"))
                {
                    if (vo.guidPath.EndsWith(".dll"))
                    {
                        FileIDUtil.getAllFileIDByDll(vo.guidPath);
                        vo.fileIDName = FileIDUtil.getFileNameByFileID(int.Parse(vo.fileID));
                    }
                    vo.isMonoScript = true;
                }
                fileRefs.Add(vo);
            }
        }