예제 #1
0
        private void ExitZombification()
        {
            App.AddLog("ExitZombification starting");

            Zombification.Cancel();

            App.AddLog("ExitZombification done");
        }
예제 #2
0
        private void OnUpdate()
        {
            try
            {
                AddLog("%% Running timer callback");

                UpdateTimer?.NotifyCallbackCalled();

                Settings.RenewKey();

                AddLog("Key renewed");

                OnUpdateLock();
                OnUpdateDefender();

                Zombification.SetAlive();

                AddLog("%% Timer callback completed");
            }
            catch (Exception e)
            {
                AddLog($"(from OnUpdate) {e.Message}");
            }
        }
예제 #3
0
        private static void Main(string[] args)
        {
            bool IsMonitor                = args.Length > 0 && args[0] == "monitor";
            bool IsCoverageCancel         = args.Length > 0 && args[0] == "coverageCancel";
            bool IsCoverageNoForward      = args.Length > 0 && args[0] == "coverageNoForward";
            bool IsCoverageBadFolder      = args.Length > 0 && args[0] == "coverageBadFolder";
            bool IsCoverageNotSymmetric   = args.Length > 0 && args[0] == "coverageNotSymmetric";
            bool IsCoverageFailSymmetric  = args.Length > 0 && args[0] == "coverageFailSymmetric";
            bool IsCoverageFailLaunch     = args.Length > 0 && args[0] == "coverageFailLaunch";
            bool IsCoverageNoKeepAlive    = args.Length > 0 && args[0] == "coverageNoKeepAlive";
            bool IsCoverageNoAliveTimeout = args.Length > 0 && args[0] == "coverageNoAliveTimeout";
            bool IsManual = args.Length > 0 && args[0] == "manual";

            string Message = $"IsRestart: {IsRestart}, Arguments: {args.Length}";

            foreach (string Arg in args)
            {
                Message += ", " + Arg;
            }

            ShowDialog(IsManual, IsCoverageCancel, Message, MessageBoxButtons.OK);

            if (IsMonitor)
            {
                Monitor(args);
                return;
            }

            Zombification Zombification = new Zombification("test")
            {
                Delay         = IsCoverageFailLaunch ? TimeSpan.MinValue : TimeSpan.FromSeconds(5),
                Flags         = IsCoverageNoForward ? Flags.NoWindow : (IsCoverageFailSymmetric ? (Flags)(-1) : Flags.ForwardArguments | Flags.NoWindow),
                IsSymmetric   = !IsCoverageNotSymmetric,
                AliveTimeout  = IsCoverageNoAliveTimeout ? TimeSpan.Zero : TimeSpan.FromSeconds(10),
                MonitorFolder = IsCoverageBadFolder ? "*" : string.Empty,
            };

            Zombification.Cancel();
            Zombification.ZombifyMe();

            DialogResult ShowResult = ShowDialog(IsManual, IsCoverageCancel, "ZombifyMe() done", MessageBoxButtons.OKCancel);

            if (IsCoverageNoKeepAlive)
            {
                Thread.Sleep(20000);
            }
            else
            {
                Thread.Sleep(5000);
                Zombification.SetAlive();
                Thread.Sleep(5000);
                Zombification.SetAlive();
                Thread.Sleep(5000);
                Zombification.SetAlive();
                Thread.Sleep(5000);
                Zombification.SetAlive();
            }

            if (IsRestart || ShowResult == DialogResult.Cancel)
            {
                Zombification.Cancel();

                ShowDialog(IsManual, IsCoverageCancel, "Cancel() done", MessageBoxButtons.OK);
            }
        }