コード例 #1
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            if (IsWaitingForInput)
            {
                MessageBox.Show("Aim/Trigger Key undefined.", "Error");
                return;
            }

            Globals.TriggerKey       = currentKey;
            Globals.BunnyHopAccuracy = bunnySlider.Value;
            Globals.IdleWait         = idlePowerSlider.Value;
            Globals.UsageDelay       = usagePowerSlider.Value;

            SaveManager.SettingsScheme settings = new SaveManager.SettingsScheme();
            settings.BunnyAccuracy         = Globals.BunnyHopAccuracy;
            settings.IdlePowerConsumption  = Globals.IdleWait;
            settings.UsagePowerConsumption = Globals.UsageDelay;
            settings.TriggerKey            = Globals.TriggerKey;
            SaveManager.SaveSettings(settings);
        }
コード例 #2
0
        public MainForm()
        {
            InitializeComponent();
            AllocConsole();

            #region VERSION CHECK
            Assembly        assembly      = Assembly.GetExecutingAssembly();
            FileVersionInfo fvi           = FileVersionInfo.GetVersionInfo(assembly.Location);
            int[]           versionParts  = { fvi.FileMajorPart, fvi.FileMinorPart, fvi.FileBuildPart };
            int[]           latestVersion = GetVersion();

            if (latestVersion[0] != 0)
            {
                if (latestVersion[0] > versionParts[0])
                {
                    DialogResult dr = MessageBox.Show("New version of AqHax-CSGO is available. Would you like to update ?", "New Version !", MessageBoxButtons.YesNo);
                    if (dr == DialogResult.Yes)
                    {
                        Process.Start("https://github.com/krxdev-kaan/AqHax-CSGO/releases");
                    }
                }
                else if (latestVersion[0] == versionParts[0])
                {
                    if (latestVersion[1] > versionParts[1])
                    {
                        DialogResult dr = MessageBox.Show("New version of AqHax-CSGO is available. Would you like to update ?", "New Version !", MessageBoxButtons.YesNo);
                        if (dr == DialogResult.Yes)
                        {
                            Process.Start("https://github.com/krxdev-kaan/AqHax-CSGO/releases");
                        }
                    }
                    else if (latestVersion[1] == versionParts[1])
                    {
                        if (latestVersion[2] > versionParts[2])
                        {
                            DialogResult dr = MessageBox.Show("New version of AqHax-CSGO is available. Would you like to update ?", "New Version !", MessageBoxButtons.YesNo);
                            if (dr == DialogResult.Yes)
                            {
                                Process.Start("https://github.com/krxdev-kaan/AqHax-CSGO/releases");
                            }
                        }
                    }
                }
            }
            #endregion

            #region CUSTOM RENDER
            GraphicsPath path = new GraphicsPath();
            path.AddEllipse(0, 0, ctColor.Width, ctColor.Height);
            ctColor.Region = new Region(path);

            GraphicsPath path2 = new GraphicsPath();
            path2.AddEllipse(0, 0, tColor.Width, tColor.Height);
            tColor.Region = new Region(path2);

            GraphicsPath path3 = new GraphicsPath();
            path3.AddEllipse(0, 0, rColor.Width, rColor.Height);
            rColor.Region = new Region(path3);
            #endregion

            #region HANDLE SAVES
            #region Visuals Data
            string appDataPath     = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            string programDataPath = Path.Combine(appDataPath, "AqHaxCSGO");
            string fullSavePath    = Path.Combine(programDataPath, "CSG.dat");
            try {
                string[] lines = File.ReadAllLines(fullSavePath);
                if (lines.Length == 0)
                {
                    File.WriteAllLines(fullSavePath, new string[] { "00", "255000000", "000255000", "255000000" });
                    lines = File.ReadAllLines(fullSavePath);
                }
                Color colorCT = new Color();
                Color colorT  = new Color();
                Color colorR  = new Color();
                int   p       = 0;
                foreach (string line in lines)
                {
                    if (p == 1)
                    {
                        colorCT = Color.FromArgb(Convert.ToInt32(line.Substring(0, 3)), Convert.ToInt32(line.Substring(3, 3)), Convert.ToInt32(line.Substring(6, 3)));
                    }
                    if (p == 2)
                    {
                        colorT = Color.FromArgb(Convert.ToInt32(line.Substring(0, 3)), Convert.ToInt32(line.Substring(3, 3)), Convert.ToInt32(line.Substring(6, 3)));
                    }
                    if (p == 3)
                    {
                        colorR = Color.FromArgb(Convert.ToInt32(line.Substring(0, 3)), Convert.ToInt32(line.Substring(3, 3)), Convert.ToInt32(line.Substring(6, 3)));
                    }
                    p++;
                }

                ctColor.BackColor        = colorCT;
                tColor.BackColor         = colorT;
                rColor.BackColor         = colorR;
                Globals.WallHackEnemy    = colorCT;
                Globals.WallHackTeammate = colorT;
                Globals.RenderColor      = colorR;
            } catch {
                try {
                    try {
                        File.Create(fullSavePath);
                        File.WriteAllLines(fullSavePath, new string[] { "00", "255000000", "000255000", "255000000" });
                    } catch {
                        Directory.CreateDirectory(programDataPath);
                        File.Create(fullSavePath);
                        File.WriteAllLines(fullSavePath, new string[] { "00", "255000000", "000255000", "255000000" });
                    }
                } catch {
                    MessageBox.Show("IO Error. \nApp save file cannot be initialized. \nRunning the program again should shortly fix th issue.",
                                    "FATAL ERROR");
                    Environment.Exit(1);
                }
            }
            #endregion

            #region Settings
            SaveManager.SettingsScheme settings = SaveManager.LoadSettings();
            Globals.BunnyHopAccuracy = Math.Abs(settings.BunnyAccuracy - 5);
            Globals.IdleWait         = Math.Abs(settings.IdlePowerConsumption - 50) / 10;
            Globals.UsageDelay       = Math.Abs(settings.UsagePowerConsumption - 5);
            Globals.TriggerKey       = settings.TriggerKey;
            currentKey = settings.TriggerKey;
            #endregion

            #region SkinChangerPresets
            LoadSkins();
            #endregion
            #endregion

            #region HANDLE FORM ELEMENTS
            List <string> res = Globals.CsgoSkinList.Keys.ToList();
            res.Sort();
            foreach (string s in res)
            {
                skinSelector.Items.Add(s);
            }

            List <string> ids = Enum.GetNames(typeof(ItemDefinitionIndex)).ToList();
            foreach (string s in ids)
            {
                if (s.Contains("WEAPON"))
                {
                    weaponSelector.Items.Add(s);
                }
            }

            List <string> knives = Constants.KnifeList.Keys.ToList();
            foreach (string s in knives)
            {
                knifeSelectionBox.Items.Add(s);
            }
            #endregion

            #region SETUP
            if (!Memory.Init())
            {
                timer.Stop();
                timer.Dispose();
                timer = null;
                if (Program.entryForm.InvokeRequired)
                {
                    Program.entryForm.BeginInvoke((MethodInvoker) delegate() {
                        Program.entryForm.Visible = true;
                    });
                }
                this.Close();
            }
            else
            {
                var materialSkinManager = MaterialSkinManager.Instance;
                materialSkinManager.AddFormToManage(this);
                materialSkinManager.Theme       = MaterialSkinManager.Themes.DARK;
                materialSkinManager.ColorScheme = new ColorScheme(Primary.Green600, Primary.Green900, Primary.Green600, Accent.Green200, TextShade.WHITE);
            }
            #endregion

            #region EVENT REGISTER
            this.FormClosing += new FormClosingEventHandler(AppEx);

            timer.Elapsed += new ElapsedEventHandler(UpdateHandle);
            timer.Interval = 90000;
            timer.Start();
            #endregion
        }