示例#1
0
 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();
     }
 }
示例#2
0
 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;
         }
     }
 }