Exemple #1
0
        public SyncDaemon(Settings settings)
        {
            _settings = settings;

            _notifier = new ExeRunner(OnNotificationMessageReceived, OnError);
            _synchronizer = new ExeRunner(OnSynchronizationMessageReceived, OnError);

            StartSynchronizationJob();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            var settings = LoadAndValidateSettings();
            if (settings == null)
            {
                return;
            }

            var arguments = ParseAndValidateArguments(args);
            if (arguments == Arguments.None)
            {
                return;
            }

            SetConsoleCtrlHandler(ConsoleCtrlCheck, true);

            //This is synchronous command
            if (arguments == Arguments.Status)
            {
                new SyncDaemon(settings).Status();
                return;
            }

            //This is synchronous command
            if (arguments == Arguments.Run)
            {
                new SyncDaemon(settings).Run();
                return;
            }

            var runner = new ExeRunner(Log, Log);
            runner.Do(string.Format("SyncD.Daemon.exe {0}", args[0]));

            switch (arguments)
            {
                case Arguments.Start: { runner.WaitForExit(150); break; }
                case Arguments.Restart: { runner.WaitForExit(1000); break; }
                default: { runner.WaitForExit(); break; }
            }
        }