internal static void ExecuteRG(string[] args) { //if (CurrentGameState == GameState.StartedGame) //{ // SendMsg(true, "이미 게임을 플레이 하는 중입니다."); // return; //} if (AutoRG.IsRunning) { SendMsg(true, "자동 RG 기능이 종료되었습니다."); AutoRG.CancelAsync(); return; } if (!(args?.Length > 1) || !int.TryParse(args[1], out int value) || value <= 0) { goto Error; } SendMsg(true, $"자동 RG 기능이 시작되었습니다. ▷반복: {args[1]}회"); AutoRG.RunWorkerAsync(value); return; Error: SendMsg(true, "자동 RG 기능이 시작되었습니다. ▷반복: 무제한"); AutoRG.RunWorkerAsync(-1); }
public static void RunWorkers() { if (isInitialaized) { return; } isInitialaized = true; WorkerReset = new ManualResetEvent(false); commands = new Commands(); autoRG = new AutoRG(); autoMouse = new AutoMouse(); if (!Directory.Exists(Globals.DocumentPath + @"\CustomMapData")) { Directory.CreateDirectory(Globals.DocumentPath + @"\CustomMapData"); } SaveFileWatcher = new FileSystemWatcher(Globals.DocumentPath + @"\CustomMapData", "*.txt"); SaveFileWatcher.Created += Actions.SaveFileWatcher_Created; SaveFileWatcher.IncludeSubdirectories = true; SaveFileWatcher.EnableRaisingEvents = false; SaveFileWatcher.NotifyFilter = NotifyFilters.FileName; SaveWatcherTimer = new System.Windows.Forms.Timer(); SaveWatcherTimer.Interval = 10000; SaveWatcherTimer.Tick += Actions.WatcherTimer_Tick; if (!Directory.Exists(Globals.DocumentPath + @"\Replay")) { Directory.CreateDirectory(Globals.DocumentPath + @"\Replay"); } ReplayWatcher = new FileSystemWatcher(Globals.DocumentPath + @"\Replay", "*.w3g"); ReplayWatcher.Created += Actions.ReplayWatcher_Function; ReplayWatcher.Changed += Actions.ReplayWatcher_Function; ReplayWatcher.IncludeSubdirectories = false; ReplayWatcher.EnableRaisingEvents = Settings.IsAutoReplay; if (!Directory.Exists(Globals.DocumentPath + @"\ScreenShots")) { Directory.CreateDirectory(Globals.DocumentPath + @"\ScreenShots"); } ScreenShotWatcher = new FileSystemWatcher(Globals.DocumentPath + @"\ScreenShots", "*.tga"); ScreenShotWatcher.Created += Actions.ScreenShotWatcher_Created; ScreenShotWatcher.IncludeSubdirectories = false; ScreenShotWatcher.EnableRaisingEvents = Settings.IsConvertScreenShot; if (!Directory.Exists(Globals.DocumentPath + @"\Maps")) { Directory.CreateDirectory(Globals.DocumentPath + @"\Maps"); } MapFileWatcher = new FileSystemWatcher(Globals.DocumentPath + @"\Maps", "*.w3x"); MapFileWatcher.Created += Actions.MapFileWatcher_Created; MapFileWatcher.IncludeSubdirectories = true; MapFileWatcher.EnableRaisingEvents = Settings.IsCheatMapCheck; chatHotkeyList = new ChatHotkeyList(); for (int i = 0; i < 10; i++) { if (chatHotkeyList[i].IsRegisted) { chatHotkeyList.Register(i); } } }
internal static async void StatusCheck() { if (WaitGameStart) { if (!GetSelectedReceiveStatus()) { return; } WaitGameStart = false; AutoRG.CancelAsync(); MainWorker.MapFileWatcher.EnableRaisingEvents = false; await Task.Delay(500); CameraInit(); GameDelay = Settings.GameDelay; if (Settings.IsAutoLoad) { await Task.Delay(3000); LoadCodeSelect(); } } else { if (!WaitLobby && CurrentMusicState == MusicState.BattleNet) { GameDelay = 50; WaitLobby = true; Warcraft3Info.Refresh(); } if (!WaitLobby || GameDelay != 100) { return; } GameDelay = 550; if (Settings.IsCheatMapCheck && !LoadedFiles.IsLoadedMap(out _)) { MainWorker.MapFileWatcher.EnableRaisingEvents = true; } if (File.Exists($"{DocumentPath}\\Replay\\LastReplay.w3g")) { try { File.Delete($"{DocumentPath}\\Replay\\CirnixReplay.w3g"); File.Move($"{DocumentPath}\\Replay\\LastReplay.w3g", $"{DocumentPath}\\Replay\\CirnixReplay.w3g"); } catch { // Delete : CirnixReplay.w3g 경로에 대한 액세스가 거부되었습니다. // 백신때문으로 유추 } } WaitLobby = false; WaitGameStart = true; } }
//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); }