Пример #1
0
        /// <summary>
        /// Here is the behaviour logic depending on internet connection status.
        /// </summary>
        private void InternetActions()
        {
            if (!args.CheckInet)
            {
                return;
            }
            var hasInet = utilMgr.IsOnline();

            if (!isStopped)
            {
                Output.Write(hasInet ? "Internet ok; " : "No internrt; ", ConsoleColor.Cyan);
            }
            if (hasInet)
            {
                checkInetIterations = MaxItertions;
            }
            else if (!isStopped)
            {
                Output.WriteLine($"NO INTERNET CONNECTION! STOPPING MINER IN {--checkInetIterations}", ConsoleColor.Red);
            }
            if (checkInetIterations <= 0)
            {
                if (!isStopped)
                {
                    utilMgr.StopProcess(supervisedProcess);
                    Output.WriteLine("Miner stopped", ConsoleColor.Yellow);
                }
                isStopped = true;
            }
            else if (isStopped)
            {
                utilMgr.StartProcess(supervisedProcess);
                Output.WriteLine("Miner started", ConsoleColor.Yellow);
                isStopped = false;
            }
        }