示例#1
0
文件: Data.cs 项目: Heavy-Dev/WFinfo
        public static void AutoTriggered()
        {
            try
            {
                var  watch = Stopwatch.StartNew();
                long stop  = watch.ElapsedMilliseconds + 5000;
                long wait  = watch.ElapsedMilliseconds;

                OCR.UpdateWindow();
                int diff;

                while (watch.ElapsedMilliseconds < stop)
                {
                    if (watch.ElapsedMilliseconds > wait)
                    {
                        wait += Settings.autoDelay;
                        diff  = OCR.GetThemeThreshold();
                        if (diff < 5)
                        {
                            while (watch.ElapsedMilliseconds < wait)
                            {
                                ;
                            }
                            OCR.ProcessRewardScreen();
                            break;
                        }
                    }
                }
                watch.Stop();
            }
            catch (Exception ex)
            {
                Main.AddLog("AUTO FAILED");
                Main.AddLog(ex.ToString());
                Main.StatusUpdate("Auto Detection Failed", 0);
                new ErrorDialogue(DateTime.Now, 0);
            }
        }