示例#1
0
        public static string Index(string dir, bool html, IndexerConfig config = null)
        {
            var settings = new IndexerAdapter();

            if (config == null)
                config = new IndexerConfig();

            config.CollapseFolders = false;
            config.FolderExpandLevel = 2;
            settings.LoadConfig(config);

            config.FolderList.Clear();

            settings.GetConfig().SetSingleIndexPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                html ? "temp.html" : "temp.txt"));

            settings.GetConfig().FolderList.Add(dir);

            Indexer indexer = null;
            if (html)
            {
                indexer = new TreeNetIndexer(settings);
            }
            else
            {
                indexer = new TreeWalkIndexer(settings);
            }

            return indexer.IndexNow(IndexingMode.IN_ONE_FOLDER_MERGED, false);
        }
示例#2
0
 public void LoadConfig(IndexerConfig config)
 {
     mConfig = config;
 }
示例#3
0
        private bool LoadConfigFileBF(string filePath)
        {
            if (File.Exists(filePath))
            {
                Debug.WriteLine("Accessed BF TGC Reader...");

                FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);

                try
                {
                    System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                    mConfig = (IndexerConfig)bf.Deserialize(fs);
                    return true;
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.ToString());
                    fs.Close();
                    return false;
                }
                finally
                {
                    fs.Close();
                }
            }
            return false;
        }
示例#4
0
 public void LoadNewConfig()
 {
     mConfig = new IndexerConfig();
 }