Example #1
1
        protected override void OnStart(string[] args)
        {
            try
            {
                Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);

                var configuration = Settings.LoadSettings();

                watcher = new Watcher(configuration);
                watcher.Start();
                log.Info("FileSystemWatcher started");

                poster = new AutoPoster(configuration);
                poster.Start();
                log.Info("Autoposter started");

                notifier = new IndexerNotifier(configuration);
                notifier.Start();
                log.Info("Notifier started");

                verifier = new IndexerVerifier(configuration);
                verifier.Start();
                log.Info("Verifier started");

            }
            catch (Exception ex)
            {
                log.Fatal("Fatal exception when starting the autoposter.", ex);
                throw;
            }
        }
Example #2
0
        protected override void OnStart(string[] args)
        {
            try
            {
                var configuration = new AutoPosterConfig();

                watcher = new Watcher(configuration);
                watcher.Start();
                log.Info("FileSystemWatcher started");

                poster = new AutoPoster(configuration);
                poster.Start();
                log.Info("Autoposter started");

                notifier = new IndexerNotifier(configuration);
                notifier.Start();
                log.Info("Notifier started");

                verifier = new IndexerVerifier(configuration);
                verifier.Start();
                log.Info("Verifier started");

            }
            catch (Exception ex)
            {
                log.Fatal("Fatal exception when starting the autoposter.", ex);
                throw;
            }
        }
Example #3
0
        static void Main(string[] args)
        {
            try
            {
                var configuration = Settings.LoadSettings();

                Watcher watcher = new Watcher(configuration);
                watcher.Start();
                log.Info("FileSystemWatcher started");
                Console.WriteLine("FileSystemWatcher started");

                AutoPoster poster = new AutoPoster(configuration);
                poster.Start();
                log.Info("Autoposter started");
                Console.WriteLine("Autoposter started");

                IndexerNotifier notifier = new IndexerNotifier(configuration);
                notifier.Start();
                log.Info("Notifier started");
                Console.WriteLine("Notifier started");

                IndexerVerifier verifier = new IndexerVerifier(configuration);
                verifier.Start();
                log.Info("Verifier started");
                Console.WriteLine("Verifier started");

                Console.WriteLine("Press the \"s\" key to stop after the current operations have finished.");

                Boolean stop = false;
                while (!stop)
                {
                    var keyInfo = Console.ReadKey();
                    stop = keyInfo.KeyChar == 's' || keyInfo.KeyChar == 'S';
                }

                watcher.Stop();
                log.Info("FileSystemWatcher stopped");
                Console.WriteLine("FileSystemWatcher stopped");

                verifier.Stop();
                log.Info("Verifier stopped");
                Console.WriteLine("Verifier stopped");

                notifier.Stop();
                log.Info("Notifier stopped");
                Console.WriteLine("Notifier stopped");

                poster.Stop();
                log.Info("Autoposter stopped");
                Console.WriteLine("Autoposter stopped");
            }
            catch (Exception ex)
            {
                log.Fatal("Fatal exception when starting the autoposter.", ex);
                throw;
            }
        }
Example #4
0
        static void Main(string[] args)
        {
            try
            {
                var configuration = Settings.LoadSettings();

                Watcher watcher = new Watcher(configuration);
                watcher.Start();
                log.Info("FileSystemWatcher started");
                Console.WriteLine("FileSystemWatcher started");

                AutoPoster poster = new AutoPoster(configuration);
                poster.Start();
                log.Info("Autoposter started");
                Console.WriteLine("Autoposter started");

                IndexerNotifier notifier = new IndexerNotifier(configuration);
                notifier.Start();
                log.Info("Notifier started");
                Console.WriteLine("Notifier started");

                IndexerVerifier verifier = new IndexerVerifier(configuration);
                verifier.Start();
                log.Info("Verifier started");
                Console.WriteLine("Verifier started");

                Console.WriteLine("Press the \"s\" key to stop after the current operations have finished.");

                Boolean stop = false;
                while (!stop)
                {
                    var keyInfo = Console.ReadKey();
                    stop = keyInfo.KeyChar == 's' || keyInfo.KeyChar == 'S';
                }

                watcher.Stop();
                log.Info("FileSystemWatcher stopped");
                Console.WriteLine("FileSystemWatcher stopped");

                verifier.Stop();
                log.Info("Verifier stopped");
                Console.WriteLine("Verifier stopped");

                notifier.Stop();
                log.Info("Notifier stopped");
                Console.WriteLine("Notifier stopped");

                poster.Stop();
                log.Info("Autoposter stopped");
                Console.WriteLine("Autoposter stopped");
            }
            catch(Exception ex)
            {
                log.Fatal("Fatal exception when starting the autoposter.", ex);
                throw;
            }
        }
Example #5
0
        static void Main(string[] args)
        {
            try
            {
                var configuration = Settings.LoadSettings();

                Watcher watcher = new Watcher(configuration);
                watcher.Start();
                log.Info("FileSystemWatcher started");
                Console.WriteLine("FileSystemWatcher started");

                AutoPoster poster = new AutoPoster(configuration);
                poster.Start();
                log.Info("Autoposter started");
                Console.WriteLine("Autoposter started");

                IndexerNotifierBase notifier = IndexerNotifierBase.GetActiveNotifier(configuration);
                if (notifier != null)
                {
                    notifier.Start();
                    log.Info("Notifier started");
                    Console.WriteLine("Notifier started");
                }
                else
                {
                    log.Info("No notifier");
                    Console.WriteLine("No notifier");
                }

                IndexerVerifierBase verifier = IndexerVerifierBase.GetActiveVerifier(configuration);
                if (verifier != null)
                {
                    verifier.Start();
                    log.Info("Verifier started");
                    Console.WriteLine("Verifier started");
                }
                else
                {
                    log.Info("No verifier");
                    Console.WriteLine("No verifier");
                }

                DatabaseCleaner cleaner = new DatabaseCleaner(configuration);
                cleaner.Start();
                log.Info("DB Cleaner started");
                Console.WriteLine("DB Cleaner started");

                Console.WriteLine("Press the \"s\" key to stop after the current operations have finished.");

                Boolean stop = false;
                while (!stop)
                {
                    var keyInfo = Console.ReadKey();
                    stop = keyInfo.KeyChar == 's' || keyInfo.KeyChar == 'S';
                }

                cleaner.Stop();
                log.Info("DB Cleaner stopped");
                Console.WriteLine("DB Cleaner stopped");

                watcher.Stop();
                log.Info("FileSystemWatcher stopped");
                Console.WriteLine("FileSystemWatcher stopped");

                if (verifier != null)
                {
                    verifier.Stop();
                    log.Info("Verifier stopped");
                    Console.WriteLine("Verifier stopped");
                }

                if (notifier != null)
                {
                    notifier.Stop();
                    log.Info("Notifier stopped");
                    Console.WriteLine("Notifier stopped");
                }

                poster.Stop();
                log.Info("Autoposter stopped");
                Console.WriteLine("Autoposter stopped");
            }
            catch (Exception ex)
            {
                log.Fatal("Fatal exception when starting the autoposter.", ex);
                throw;
            }
        }