Пример #1
0
        private SearchEngine()
        {
            string filePath = Config.ConfigFolderLocation + "\\files.txt";

            if (!File.Exists(filePath))
            {
                File.Create(filePath);
            }
            else
            {
                _searchEngineWrapper =
                    new Engine.Entity.SearchEngine(filePath, Config.Instance.MaxSearchResults, false);
                string[] lines = File.ReadAllLines(filePath);
                Task.Run(() =>
                {
                    lines.ForEach(line =>
                    {
                        var splits = line.Split(';');
                        _searchEngineWrapper.Insert(splits[0].AndCacheFileIcon(), int.Parse(splits[1]));
                    });
                });
            }

            RegisterAutoBackup();
        }
Пример #2
0
        /// <summary>
        /// Starts to rebuild the index
        /// </summary>
        public void BuildIndex()
        {
            //Config.Instance.Paths.Where(path => path.IsEnabled).ForEach(path => DeletePath(path.Location));
            _searchEngineWrapper = new Engine.Entity.SearchEngine(Config.ConfigFolderLocation + "\\files.txt", false);
            var data = GetFilesToBeIndexed();

            WriteFilesToIndex(data);
        }
Пример #3
0
        private SearchEngine()
        {
            string filePath = Config.ConfigFolderLocation + "\\files.txt";

            if (!File.Exists(filePath))
            {
                File.Create(filePath);
            }
            _searchEngineWrapper =
                new Engine.Entity.SearchEngine(filePath);

            //Triggers index backup every 5 minutes
            _timer = new Timer(1000 * 60 * 5)
            {
                AutoReset = true,
                Enabled   = true
            };
            _timer.Elapsed += Timer_Elapsed;
        }