Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
 }
Beispiel #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);
        }
Beispiel #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));
 }
Beispiel #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);
        }