public void AddDocumentSourcesFromPathList([NotNull] IEnumerable <string> files) { if (files == null) { throw new ArgumentNullException("files"); } foreach (var path in files) { IDocumentSource documentSource; try { if (Directory.Exists(path)) { documentSource = new DirectoryDocumentSource(path, DefaultSearchPattern); } else { documentSource = new SingleFileDocumentSource(path); } } catch (Exception e) { Console.WriteLine(e); continue; } IndexerSet.Add(documentSource); } OnPropertyChanged("Indexers"); }
public IndexerViewModel() { DefaultSearchPattern = new SearchPattern("*.txt"); RemoveDocumentSourceCommand = new DelegateCommand <Indexer>(RemoveDocumentSource); SearchCommand = new DelegateCommand(ExecuteQuery); var baseDirectory = MoveUpThroughHierarhy(new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory), 5).FullName; IndexerSet = IndexerSet.Create(new IndexerCreationOptions() { IndexLocking = IndexLocking.ReadWrite }); IndexerSet.Add(new DirectoryDocumentSource(baseDirectory, "*.cs"), autoStartIndexing: false); IndexerSet.Add(new DirectoryDocumentSource(baseDirectory, "*.xml"), autoStartIndexing: false); }