コード例 #1
0
 public DirInfo(DirInfo info)
 {
     _directories         = new List <string>(info.Directories);
     _extensions          = new Dictionary <string, List <string> >(info.Extensions);
     _indexSubdirectories = new Dictionary <string, bool>(info.IndexSubdirectories);
     _includeDirectories  = new Dictionary <string, bool>(info.IncludeDirectories);
     _plugins             = new Dictionary <string, List <string> >(info.Plugins);
 }
コード例 #2
0
ファイル: SettingsManager.cs プロジェクト: erisonliang/Blaze
 public DirInfo GetDirectories()
 {
     if (_directories == null)
     {
         List <string> directories = new List <string>();
         Dictionary <string, List <string> > extensions          = new Dictionary <string, List <string> >();
         Dictionary <string, bool>           indexSubdirectories = new Dictionary <string, bool>();
         Dictionary <string, bool>           includeDirectories  = new Dictionary <string, bool>();
         Dictionary <string, List <string> > plugins             = new Dictionary <string, List <string> >();
         List <string> categories = INIManipulator.GetCategories(_config_file);
         if (categories.Count > 0)
         {
             string category = "indexer";
             if (categories.Contains(category))
             {
                 List <string> keys    = INIManipulator.GetKeys(_config_file, category);
                 int           key_len = keys.Count;
                 if (key_len > 0)
                 {
                     for (int i = 0; i < key_len; i += 5)
                     {
                         string   name;
                         string[] exts;
                         bool     incdir = false;
                         bool     subdir = false;
                         string[] plugs;
                         try
                         {
                             name = INIManipulator.GetValue(_config_file, category, keys[i], "");
                             exts = StrToArray(INIManipulator.GetValue(_config_file, category, keys[i + 1], ".lnk"));
                             Boolean.TryParse(INIManipulator.GetValue(_config_file, category, keys[i + 2], "false"), out incdir);
                             Boolean.TryParse(INIManipulator.GetValue(_config_file, category, keys[i + 3], "false"), out subdir);
                             plugs = StrToArray(INIManipulator.GetValue(_config_file, category, keys[i + 4], ""));
                         }
                         catch (Exception)
                         {
                             break;
                         }
                         directories.Add(name);
                         extensions.Add(name, new List <string>(exts));
                         includeDirectories.Add(name, incdir);
                         indexSubdirectories.Add(name, subdir);
                         plugins.Add(name, new List <string>(plugs));
                     }
                 }
             }
         }
         _directories = new DirInfo(directories, extensions, includeDirectories, indexSubdirectories, plugins);
     }
     return(_directories);
 }
コード例 #3
0
ファイル: SettingsManager.cs プロジェクト: erisonliang/Blaze
        public void SaveDirectories(DirInfo dirs)
        {
            _directories = null;
            _directories = dirs;
            List <string> directories = dirs.Directories;
            Dictionary <string, List <string> > extensions          = dirs.Extensions;
            Dictionary <string, bool>           includeDirectories  = dirs.IncludeDirectories;
            Dictionary <string, bool>           indexSubdirectories = dirs.IndexSubdirectories;
            Dictionary <string, List <string> > dirPlugins          = dirs.Plugins;
            string category = "indexer";
            int    len      = directories.Count;

            INIManipulator.DeleteCategory(_config_file, category);
            for (int i = 0; i < len; i++)
            {
                string dir = directories[i];
                int    pos = i + 1;
                INIManipulator.WriteValue(_config_file, category, pos.ToString() + "\\name", dir);
                INIManipulator.WriteValue(_config_file, category, pos.ToString() + "\\extensions", ArrayToStr(extensions[dir].ToArray()));
                INIManipulator.WriteValue(_config_file, category, pos.ToString() + "\\includeDirectories", includeDirectories[dir].ToString());
                INIManipulator.WriteValue(_config_file, category, pos.ToString() + "\\indexSubdirectories", indexSubdirectories[dir].ToString());
                INIManipulator.WriteValue(_config_file, category, pos.ToString() + "\\plugins", ArrayToStr(dirPlugins[dir].ToArray()));
            }
        }