Esempio n. 1
0
        private void InjectButton_Click(object sender, EventArgs e)
        {
            if (!Inject.GetDll())
            {
                StatusLabel.Text      = "NotFound";
                StatusLabel.ForeColor = Color.Red;
                StatusLabel.Left      = 0;

                LegitBotButton.Enabled   = false;
                legitControl1.Enabled    = false;
                RageBotButton.Enabled    = false;
                rageControl1.Enabled     = false;
                SettingsButton.Enabled   = false;
                settingsControl1.Enabled = false;
                DebugButton.Enabled      = true;
            }
            else
            {
                StatusLabel.Text      = "Found";
                StatusLabel.ForeColor = Color.Green;
                StatusLabel.Left      = 22;

                LegitBotButton.Enabled   = true;
                legitControl1.Enabled    = true;
                RageBotButton.Enabled    = true;
                rageControl1.Enabled     = true;
                SettingsButton.Enabled   = true;
                settingsControl1.Enabled = true;
                DebugButton.Enabled      = true;

                Thread.Sleep(500);

                //checkcsgo
                Thread checkcs = new Thread(Inject.Check);
                Variable.check = true;
                checkcs.Start();

                //уведомление в начале
                string notif_text = "Press 'Insert' to enable Cheat";
                Notifier.Notif(notif_text);

                //распаковка hazedumper и config.json
                string temp_hazedumper = Application.StartupPath + "/hazedumper.exe";
                if (File.Exists(temp_hazedumper))
                {
                    File.Delete(temp_hazedumper);
                }
                File.WriteAllBytes(temp_hazedumper, Properties.Resources.hazedumper);
                string temp_config = Application.StartupPath + "/config.json";
                if (File.Exists(temp_config))
                {
                    File.Delete(temp_config);
                }
                File.WriteAllText(temp_config, Properties.Resources.config);

                _overlayStatus = false;

                OffsetsUpdater.DeleteFile();
                OffsetsUpdater.GetOffsets();

                //проверка оффсетов на их роботоспособность
                bool   isOkay  = true;
                string keyWord = "WARN";
                var    lines   = File.ReadLines(Application.StartupPath + $"/hazedumper.log");
                string result  = string.Join("\n", lines.Where(s => s.IndexOf(keyWord, StringComparison.InvariantCultureIgnoreCase) >= 0));
                if (result.Length != 0)
                {
                    MessageBox.Show(result, "Offsets are not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    isOkay = false;
                }

                OffsetsUpdater.Update();
                OffsetsUpdater.DeleteFile();
                if (File.Exists(temp_hazedumper))
                {
                    File.Delete(temp_hazedumper);
                }
                if (File.Exists(temp_config))
                {
                    File.Delete(temp_config);
                }

                if (isOkay == false)
                {
                    Process[] listprosecc = Process.GetProcesses();
                    try
                    {
                        foreach (Process proc in Process.GetProcessesByName(Variable.CheatName))
                        {
                            proc.Kill();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }

                //отслеживание клавиши Insert
                gHook          = new GlobalKeyboardHook();
                gHook.KeyDown += new KeyEventHandler(gHook_KeyDown);
                foreach (Keys key in Enum.GetValues(typeof(Keys)))
                {
                    gHook.HookedKeys.Add(key);
                }
                gHook.hook();
            }
        }