//internal static HangWatchdog AntiZombieProcessChecker; internal static async Task <bool> ProcessCheck() { if (GameModule.InitWarcraft3Info() != WarcraftState.OK || !GameModule.WarcraftCheck()) { InitializedWarcraft = false; if (AutoRG.IsRunning) { AutoRG.CancelAsync(); } AutoMouse.CheckOff(); // 프로그램을 찾지 못할 경우 검색 간격 증가 await Task.Delay(800); return(true); } else if (!InitializedWarcraft) { InitializedWarcraft = true; await Task.Delay(2000); Warcraft3Info.Refresh(); GameModule.GetOffset(); GameDelay = 50; RefreshCooldown = 0.01f; //ColorfulChat = true; name = string.Empty; StartDelay = Settings.StartSpeed > 0 ? Settings.StartSpeed : 0.01f; CameraDistance = Settings.CameraDistance; CameraAngleX = Settings.CameraAngleX; CameraAngleY = Settings.CameraAngleY; } if (Settings.IsAutoHp && !HPView) { HPView = true; } //AntiZombieProcessChecker.Check(); MemoryOptimizeChecker.Check(); StatusCheck(); return(false); }
internal static bool ProcessCheck() { if (GameModule.WarcraftDetect() != WarcraftState.OK || !GameModule.WarcraftCheck()) { InitializedWarcraft = ignoreDetect = false; // 프로그램을 찾지 못할 경우 검색 간격 증가 Thread.Sleep(800); return(true); } if (!InitializedWarcraft) { InitializedWarcraft = true; Delay(2000); GameDll.GetOffset(); GameDelay = 50; RefreshCooldown = 0.01f; name = string.Empty; StartDelay = Settings.StartSpeed > 0 ? Settings.StartSpeed : 0.01f; CameraDistance = Settings.CameraDistance; CameraAngleX = Settings.CameraAngleX; CameraAngleY = Settings.CameraAngleY; } if (Settings.IsAutoHp && !HPView) { HPView = true; } if (Settings.IsAntiZombieProcess) { if (ignoreDetect && ++ZombieCount > 9000) { ignoreDetect = false; ZombieCount = 0; } else if (CurrentMusicState == MusicState.None) { if (++ZombieCount > 22) { try { PerformanceCounter CPUCounter = new PerformanceCounter("Process", "% Processor Time", TargetProcess); CPUCounter.NextValue(); for (int i = 0; i < 5; i++) { Delay(1100); if (CPUCounter.NextValue() >= 0.01f) { ZombieCount = 0; break; } if (i != 4) { continue; } if (MetroDialog.YesNo("워크래프트가 정상적으로 종료되지 않은 것 같습니다.\n강제로 종료하시겠습니까?", "강제 종료 알림")) { try { Warcraft3Info.Process.Kill(); } catch { MetroDialog.OK("워크래프트를 강제로 종료할 수 없었습니다.\n이미 종료되었거나, 백신에 의해 차단된 것 같습니다.", "강제 종료 실패"); } } else { ignoreDetect = true; } } } catch { ZombieCount = 0; } } return(true); } else { ZombieCount = 0; } } if (Settings.IsMemoryOptimize) { if (MemoryOptimizeTimer.IsRunning) { if (MemoryOptimizeTimer.Elapsed >= new TimeSpan(0, Settings.MemoryOptimizeCoolDown, 0)) { CProcess.TrimProcessMemory(TargetProcess, true); MemoryOptimizeTimer.Restart(); } else { MemoryOptimizeTimer.Start(); } } } else if (MemoryOptimizeTimer.IsRunning) { MemoryOptimizeTimer.Stop(); } StatusCheck(); return(false); }