private void StartWorker() { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Shutdown.ShutdownEvent += OnShutdown; this.crawler = new MozillaCrawler(this, this.Driver.Fingerprint); foreach (Profile profile in Profile.ReadProfiles()) { foreach (Account account in profile.Accounts) { if (!accountTypes.Contains(account.Type)) { continue; } this.crawler.ScheduleCrawl(new DirectoryInfo(account.Path), -1); FileSystemWatcher fsw = new FileSystemWatcher(); fsw.Path = account.Path; fsw.IncludeSubdirectories = true; fsw.Changed += new FileSystemEventHandler(OnChanged); fsw.Created += new FileSystemEventHandler(OnChanged); fsw.Deleted += new FileSystemEventHandler(OnChanged); fsw.EnableRaisingEvents = true; } } Shutdown.ShutdownEvent += OnShutdown; this.crawler.StopWhenEmpty(); stopwatch.Stop(); Logger.Log.Info("MozillaQueryable worker thread done in {0}", stopwatch); }
private void StartWorker () { Stopwatch stopwatch = new Stopwatch (); stopwatch.Start (); Shutdown.ShutdownEvent += OnShutdown; this.crawler = new MozillaCrawler (this, this.Driver.Fingerprint); foreach (Profile profile in Profile.ReadProfiles ()) { foreach (Account account in profile.Accounts) { if (!accountTypes.Contains (account.Type)) continue; this.crawler.ScheduleCrawl (new DirectoryInfo (account.Path), -1); FileSystemWatcher fsw = new FileSystemWatcher (); fsw.Path = account.Path; fsw.IncludeSubdirectories = true; fsw.Changed += new FileSystemEventHandler (OnChanged); fsw.Created += new FileSystemEventHandler (OnChanged); fsw.Deleted += new FileSystemEventHandler (OnChanged); fsw.EnableRaisingEvents = true; } } Shutdown.ShutdownEvent += OnShutdown; this.crawler.StopWhenEmpty (); stopwatch.Stop (); Logger.Log.Info ("MozillaQueryable worker thread done in {0}", stopwatch); }