private void RemoveDirectory()
 {
     Entries.Remove(SelectedDirectory);
     if (Entries.Any())
     {
         SelectedDirectory = Entries.Keys.First();
     }
 }
示例#2
0
        private IEnumerable <CrawlerDirectory> GetDirectories()
        {
            var serien = new CrawlerDirectory()
            {
                Path = @"\\Datenknecht\Serien", Name = "Serien", FileExtension = "*.mkv"
            };
            var comics = new CrawlerDirectory()
            {
                Path = @"\\Datenknecht\Misc\comics\current", Name = "Comics", FileExtension = "*.cb*"
            };

            return(new List <CrawlerDirectory>()
            {
                serien, comics
            });
        }
        public DirectoryDialogViewModel(DirectoryDialog dialog, CrawlerDirectory directory)
        {
            this.directoryDialog = dialog;

            this.Directory = directory;
            this.OkCommand = new RelayCommand(p => true,
                                              p => {
                this.IsCancelled = false;
                this.directoryDialog.Close();
            }
                                              );
            this.CancelCommand = new RelayCommand(p => true,
                                                  p => {
                this.IsCancelled = true;
                this.directoryDialog.Close();
            }
                                                  );
            this.directoryDialog.DataContext = this;
        }
        private void ParseDirectoryFile()
        {
            Entries = new Dictionary <CrawlerDirectory, ObservableCollection <CrawlerResult> >(new CrawlerDirectoryEqualityComparer());

            var directories = FileHandler.LoadDirectories();

            if (directories.Any())
            {
                foreach (var directory in directories)
                {
                    if (!Entries.ContainsKey(directory))
                    {
                        Entries.Add(directory, new ObservableCollection <CrawlerResult>());
                    }
                }

                SelectedDirectory = Entries.Keys.First();
            }
        }
示例#5
0
        public static async Task <CrawlerResults> CrawlAsync(CrawlerDirectory directory, bool includeEmpty = false)
        {
            var result = await Task.Run(() => Crawl(directory, includeEmpty));

            return(result);
        }
示例#6
0
 public static CrawlerResults Crawl(CrawlerDirectory directory, bool includeEmpty = false)
 {
     return(Crawl(directory.Path, directory.FileExtension, includeEmpty));
 }