private long GetIndexedDirectoryFilesCount(string path) { using (var reader = new IndexFileReader(IndexPaths.GetIdxFilePath(path))) { return(reader.ReadAll().Count()); } }
private void LookForSequenceInIndexedDirectory(MainViewModel vm, string path, string sequence, ICollection <SearchCondition> conditions = null) { using (var reader = new IndexFileReader(IndexPaths.GetIdxFilePath(path))) { IEnumerable <IndexedItem> items = reader.ReadAll(); //Parallel.ForEach(items, (item) => //{ foreach (var item in items) { var size = (double)item.Length / 1024 / 1024; if (CheckSearchConditions(item, conditions) && CheckDateRange(item, vm.SearchDatesRange) && CheckSizeRange(item, vm.SizeRange)) { if (sequence.Equals("*") || item.Name.ToLower().Contains(sequence.ToLower())) { vm.SearchResults.Add(item); vm.TotalFilesMatch++; _cancellationToken.ThrowIfCancellationRequested(); } vm.TotalFilesSize += size; vm.TotalFilesCount++; vm.CurrentProgressBarValue++; } } //}); } }