public static void sort() { System.Console.Write("Source Path > "); String sourceName = System.Console.ReadLine(); DirectoryInfo source = new DirectoryInfo(sourceName); System.Console.WriteLine("Searching for source..."); if (!source.Exists) { System.Console.WriteLine("Source directory doesn't exist!"); } else { System.Console.WriteLine("Source directory found!"); System.Console.Write("Destination Path > "); String destinationName = System.Console.ReadLine(); DirectoryInfo destination = new DirectoryInfo(destinationName); Sorter sorter = new Sorter(source, destination); sorter.moveSort(); } }
private static void fileEventHandler(object source, FileSystemEventArgs e) { if (e.ChangeType.Equals(WatcherChangeTypes.Created)) { if (!sorting && options.autoSort) { sorting = true; DirectoryInfo autoSource = new DirectoryInfo(options.autoSource); Sorter autoSort = new Sorter(autoSource, new DirectoryInfo(options.autoDest)); while (autoSource.GetFiles().Length > 0) { autoSort.moveSort(); } sorting = false; } } }