private static void LoadDatabase(ExtensionFolder _instance)
        {
            List <string> list = new List <string>();

            if (!File.Exists(SettingPath))
            {
                FileHelper.CheckCreateFilePathDirectory(SettingPath);
                File.Create(SettingPath);
            }

            using (StreamReader file = new StreamReader(SettingPath.Replace("//", "/")))
            {
                string str;
                char[] separator = new char[] { ':' };

                while ((str = file.ReadLine()) != null)
                {
                    // Debug.Log(str);
                    string[] strArray = str.Split(separator);
                    string   str2     = strArray[0].Trim();
                    string   s        = strArray[1].Trim();
                    if (str2 == "version")
                    {
                        _instance.version = int.Parse(s);
                    }
                    else
                    {
                        if (str2 == "extensionPath")
                        {
                            _instance.ExtensionPath = readStringList(file);
                            continue;
                        }
                        if (str2 == "onlyInclusionFiles")
                        {
                            _instance.OnlyInclusionFiles = readStringList(file);
                            continue;
                        }
                        if (str2 == "firstLoadFiles")
                        {
                            _instance.FirstLoadFiles = readStringList(file);
                            continue;
                        }
                        if (str2 == "extensionFiles")
                        {
                            _instance.ExtensionFiles = readStringList(file);
                            continue;
                        }
                        if (str2 == "zipFiles")
                        {
                            _instance.ZipFiles = readStringListList(file);
                            continue;
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 保存数据
 /// </summary>
 private static void SaveSettingData(ExtensionFolder _instance)
 {
     if (SettingPath != null)
     {
         Debug.Log("Saving database " + SettingPath);
         StreamWriter file = new StreamWriter(SettingPath.Replace("//", "/"));
         file.WriteLine(string.Format("version: {0}", _instance.version));
         file.WriteLine("assetLabels:");
         writeStringList(file, _instance.AssetLabels);
         file.WriteLine("extensionFiles:");
         writeStringList(file, _instance.ExtensionFiles);
         file.Close();
     }
 }
 /// <summary>
 /// 保存数据
 /// </summary>
 public static void SaveSettingData(ExtensionFolder _instance = null)
 {
     if (SettingPath != null)
     {
         if (_instance == null)
         {
             _instance = instance;
         }
         Debug.Log("Saving database " + SettingPath);
         StreamWriter file = new StreamWriter(SettingPath.Replace("//", "/"));
         file.WriteLine(string.Format("version: {0}", _instance.version));
         file.WriteLine("extensionPath:");
         writeStringList(file, _instance.ExtensionPath);
         file.WriteLine("firstLoadFiles:");
         writeStringList(file, _instance.FirstLoadFiles);
         file.WriteLine("extensionFiles:");
         writeStringList(file, _instance.ExtensionFiles);
         file.WriteLine("zipFiles:");
         writeStringListList(file, _instance.ZipFiles);
         file.Close();
     }
 }
 public static void Open()
 {
     _instance = null;
     Selection.activeObject = AssetDatabase.LoadAssetAtPath(SettingPath, typeof(TextAsset));
 }