예제 #1
0
        private void PersistResults(DateTime startDate, DateTime endDate, IEnumerable <string> phrases)
        {
            var matchingFile  = new PersistanceManager.MatchingFile(_searchFile, _searchPhrase, 0, _matches);
            var matchingFiles = new List <PersistanceManager.MatchingFile>()
            {
                matchingFile
            };
            var processedFilesCount = 1u;

            var storedSearch = new PersistanceManager.Search(startDate, endDate, processedFilesCount, phrases, matchingFiles);

            // TODO: Remove magic db name string
            var persistanceManager = new PersistanceManager.SqLitePersistanceManager("db.s3db");

            persistanceManager.SaveSearch(storedSearch);
        }
예제 #2
0
        internal void PersistResults(ISearchResult results, string dbPath)
        {
            var matchingFiles = new List <PersistanceManager.MatchingFile>(results.Searchees.Count());

            foreach (var hit in results.Searchees)
            {
                var info         = new FileInfo(hit.Searchee.Path);
                var matchingFile =
                    new PersistanceManager.MatchingFile(info.Name, hit.Searchee.Path, info.Length, hit.Matches);

                matchingFiles.Add(matchingFile);
            }

            var storedSearch = new PersistanceManager.Search(results.StartDate, results.EndDate,
                                                             (uint)results.ProcessedSearcheesCount, results.Phrases, matchingFiles);

            new PersistanceManager.SqLitePersistanceManager(dbPath).SaveSearch(storedSearch);
        }
예제 #3
0
 protected bool Equals(MatchingFile other)
 {
     return string.Equals(FileName, other.FileName) && string.Equals(FullPath, other.FullPath) && SizeInBytes == other.SizeInBytes && Matches.SequenceEqual(other.Matches);
 }
예제 #4
0
        internal void PersistResults(ISearchResult results, string dbPath)
        {
            var matchingFiles = new List<PersistanceManager.MatchingFile>(results.Searchees.Count());

            foreach (var hit in results.Searchees)
            {
                var info = new FileInfo(hit.Searchee.Path);
                var matchingFile =
                    new PersistanceManager.MatchingFile(info.Name, hit.Searchee.Path, info.Length, hit.Matches);

                matchingFiles.Add(matchingFile);
            }

            var storedSearch = new PersistanceManager.Search(results.StartDate, results.EndDate,
                (uint)results.ProcessedSearcheesCount, results.Phrases, matchingFiles);

            new PersistanceManager.SqLitePersistanceManager(dbPath).SaveSearch(storedSearch);
        }
예제 #5
0
 protected bool Equals(MatchingFile other)
 {
     return(string.Equals(FileName, other.FileName) && string.Equals(FullPath, other.FullPath) && SizeInBytes == other.SizeInBytes && Matches.SequenceEqual(other.Matches));
 }
예제 #6
0
        private void PersistResults(DateTime startDate, DateTime endDate, IEnumerable<string> phrases)
        {
            var matchingFile = new PersistanceManager.MatchingFile(_searchFile, _searchPhrase, 0, _matches);
            var matchingFiles = new List<PersistanceManager.MatchingFile>() { matchingFile };
            var processedFilesCount = 1u;

            var storedSearch = new PersistanceManager.Search(startDate, endDate, processedFilesCount, phrases, matchingFiles);

            // TODO: Remove magic db name string
            var persistanceManager = new PersistanceManager.SqLitePersistanceManager("db.s3db");

            persistanceManager.SaveSearch(storedSearch);
        }