Exemple #1
0
        public static void CheckSucc()
        {
            TaskCore taskCore = MonitorCore.GetTaskCore();
            string   taskName = taskCore.TaskName;

            if (taskCore.IsVoteTask())
            {
                var succ = 0;
                if (taskName.Equals(TaskCore.TASK_VOTE_JIUTIAN))
                {
                    succ = JiuTian.GetSucc();
                }
                else if (taskName.Equals(TaskCore.TASK_VOTE_MM))
                {
                    succ = MM.GetSucc();
                }
                else if (taskName.Equals(TaskCore.TASK_VOTE_YUANQIU))
                {
                    succ = YuanQiu.GetSucc();
                }

                if (succ == 0)
                {
                    succ = succCount;
                }

                double price = 0;
                try
                {
                    price = double.Parse(ConfigCore.GetAutoVote("Price"));
                }
                catch (Exception)
                {
                }

                var name       = ConfigCore.GetAutoVote("ProjectName");
                var validCount = price >= 1 ? 1 : 2;
                var diff       = succ - succCount;
                if (diff < validCount)
                {
                    timerChecked++;
                    if (timerChecked >= 2)
                    {
                        FailTooMuch = true;
                    }
                }
                else
                {
                    timerChecked = 0;
                }

                if (diff > 0)
                {
                    Statistics.Add(name, price, diff);
                }
                LogCore.Write("成功:" + succ + " 上次成功:" + succCount);
                succCount = succ;
            }
        }
Exemple #2
0
 public static TaskCore GetTaskCore()
 {
     if (_taskCore == null)
     {
         _taskCore = new TaskCore();
     }
     return(_taskCore);
 }
Exemple #3
0
 public static void MonitorThread()
 {
     Notification.Show("启动监控程序", ToolTipIcon.Info);
     try
     {
         ComCore.ReMake();
         TaskCore taskCore = GetTaskCore();
         taskCore.InitTask();
         while (true)
         {
             taskCore.TaskMonitor();
         }
     }
     catch (ThreadAbortException)
     {
     }
     catch (Exception e)
     {
         LogCore.Write(e.StackTrace);
         MessageBox.Show(e.StackTrace);
     }
 }
Exemple #4
0
        //缓存
        public static void Cache()
        {
            TaskCore taskCore = MonitorCore.GetTaskCore();

            if (taskCore.TaskName == null || taskCore.IsSysTask())
            {
                return;
            }

            string path = "";

            if (taskCore.CustomPath.Equals(taskCore.TaskPath))
            {
                path = taskCore.TaskPath;
            }
            else
            {
                path = "Writein";
            }

            string cacheMemory = "TaskName-" + taskCore.TaskName + "`TaskPath-" + path + "`Worker:" + Id;

            IniReadWriter.WriteIniKeys("Command", "CacheMemory" + Sort, cacheMemory, PathShareTaskPlus);
        }
Exemple #5
0
        //关闭进程
        public static void KillProcess(bool stopIndicator)
        {
            TaskCore taskCore = MonitorCore.GetTaskCore();
            string   taskName = taskCore.TaskName;

            //传票结束
            if (stopIndicator && taskCore.IsVoteTask() && !taskName.Equals(TaskCore.TASK_VOTE_PROJECT))
            {
                LogCore.Write($"{taskCore.ProjectName}传票结束!");
                if (taskName.Equals(TaskCore.TASK_VOTE_JIUTIAN))
                {
                    JiuTian.StopAndUpload();
                }
                else if (taskName.Equals(TaskCore.TASK_VOTE_YUANQIU))
                {
                    YuanQiu.StopAndUpload();
                }
                else if (taskName.Equals(TaskCore.TASK_VOTE_JZ))
                {
                    JZ.StopAndUpload();
                }
                else if (taskName.Equals(TaskCore.TASK_VOTE_JT))
                {
                    JT.StopAndUpload();
                }
                else if (taskName.Equals(TaskCore.TASK_VOTE_HY))
                {
                    HY.StopAndUpload();
                }
                else if (taskName.Equals(TaskCore.TASK_VOTE_MM))
                {
                    MM.StopAndUpload();
                }
            }
            Kill();
        }