Exemple #1
0
        public static void Main(string[] args)
        {
            var configuration = new Configuration();
            var showHelp = false;

            var optionSet = new OptionSet()
            {
                { "h|help",  "show this message and exit", option => showHelp = option != null },
                { "p=|path=", "the path to watch for changes (required)", option => configuration.Path = option },
                { "t=|task=", "the task to run after a change is detected (required)", option => configuration.Task = option },
                { "f=|filter=", "the file type filter", option => configuration.Filter = option },
                { "w=|wait=", "time to wait after change.", option => configuration.Wait = Convert.ToInt32 (option) },
            };

            try
            {
                optionSet.Parse(args);
            }
            catch
            {
                Console.WriteLine("Invalid usage.");
                ShowHelp(optionSet);
                return;
            }

            if (showHelp || args.Length == 0 || !configuration.IsValid())
            {
                ShowHelp(optionSet);
                return;
            }

            var treeWatcher = new TreeWatcher(configuration);
            treeWatcher.Watch();

            Console.ReadKey();
        }
Exemple #2
0
 public TreeWatcher(Configuration configuration)
 {
     _configuration = configuration;
 }