Пример #1
0
        static void Main(string[] args)
        {
#if DEBUG
            if (args.Length != 1)
            {
                args = new string[] { "D:\\" };
            }
#endif

            // If a directory is not specified, exit program.
            if (args.Length != 1)
            {
                // Display the proper way to call the program.
                Console.WriteLine("Usage: Watcher.exe (directory)");
                return;
            }

            var watcher = new FileWatcher();
            watcher.Start(args[0], OnChanged, OnRenamed);

            // Wait for the user to quit the program.
            Console.WriteLine("Press \'q\' to quit the sample.");
            while (Console.Read() != 'q')
            {
            }

            watcher.Close();
        }
Пример #2
0
        static void Main(string[] args)
        {
            #if DEBUG
              if (args.Length != 1) { args = new string[] { "D:\\" }; }
            #endif

              // If a directory is not specified, exit program.
              if (args.Length != 1) {
            // Display the proper way to call the program.
            Console.WriteLine("Usage: Watcher.exe (directory)");
            return;
              }

              var watcher = new FileWatcher();
              watcher.Start(args[0], OnChanged, OnRenamed);

              // Wait for the user to quit the program.
              Console.WriteLine("Press \'q\' to quit the sample.");
              while (Console.Read() != 'q') { }

              watcher.Close();
        }
Пример #3
0
 protected override void OnStop()
 {
     watcher.Close();
 }