public void Run() { while (!Abort) { string path = InputQueue.DequeueLast(); IsActive = true; if (Directory.Exists(path)) { Console.WriteLine("{0}: Starting refresh and cleanup", GetType().Name); DateTime start = DateTime.Now; ProcessDirectoryForAdd(path, FilenamesIgnoreCase()); Console.WriteLine("{0}: Refresh took {1} ms", GetType().Name, (DateTime.Now - start).TotalMilliseconds); start = DateTime.Now; ProcessFilesForRemove(FilenamesIgnoreCase()); Console.WriteLine("{0}: Cleanup took {1} ms", GetType().Name, (DateTime.Now - start).TotalMilliseconds); start = DateTime.Now; RemoveCaseInsensitiveDuplicateTracks(); Console.WriteLine("{0}: Remove duplicate names took {1} ms", GetType().Name, (DateTime.Now - start).TotalMilliseconds); } databaseChanger.Flush(); if (InputQueue.Count == 0) { WorkerThreadPool.Instance.InvokingThread.BeginInvokeLowPrio(FinishCallback); } IsActive = false; } }
public void Run() { while (!Abort) { string toSearchFor = InputQueue.DequeueLast(); if (!Object.ReferenceEquals(toSearchFor, null)) { IsActive = true; RunQuery(toSearchFor); IsActive = false; if (InputQueue.Count == 0) { WorkerThreadPool.Instance.InvokingThread.BeginInvokeLowPrio(FinishCallback); } } } }