예제 #1
0
        static void Main(string[] args)
        {
            var settings = new Settings(args);

            if (!args.Any())
            {
                PrintHelp();
                return;
            }
            if (settings.Errors.Any())
            {
                settings.Errors.ForEach(Console.WriteLine);
                return;
            }


            var handler = new QueuedSqlChangeHandlerDecorator(new SqlChangeHandler(settings));

            handler.Prepare();

            CreateWatcher(settings,
                          (sender, e) =>
            {
                if (e.ChangeType.HasFlag(WatcherChangeTypes.Changed))
                {
                    handler.Handle(oldPath: null, newPath: NormalizePath(e.FullPath));
                }
            },
                          (sender, e) =>
            {
                handler.Handle(oldPath: NormalizePath(e.OldFullPath), newPath: NormalizePath(e.FullPath));
            });

            Console.ReadKey();
        }
예제 #2
0
        static void Main(string[] args)
        {
            var settings = new Settings(args);
            if (!args.Any())
            {
                PrintHelp();
                return;
            }
            if (settings.Errors.Any())
            {
                settings.Errors.ForEach(Console.WriteLine);
                return;
            }

            var handler = new QueuedSqlChangeHandlerDecorator(new SqlChangeHandler(settings));
            handler.Prepare();

            CreateWatcher(settings,
                (sender, e) =>
                {
                    if (e.ChangeType.HasFlag(WatcherChangeTypes.Changed))
                    {
                        handler.Handle(oldPath: null, newPath: NormalizePath(e.FullPath));
                    }
                },
                (sender, e) =>
                {
                    handler.Handle(oldPath: NormalizePath(e.OldFullPath), newPath: NormalizePath(e.FullPath));
                });

            Console.ReadKey();
        }