예제 #1
0
        private void patchBtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (!File.Exists(this.exePath + ".bak"))
                {
                    File.Copy(this.exePath, this.exePath + ".bak");
                    this.backupBtn.Visible = true;
                }

                var resultSb = new StringBuilder("Patcher v2 :: Created by Zaczero\r\n\r\nPatch results:\r\n");
                var buffer   = File.ReadAllBytes(this.exePath);

                if (this.zoomOutCbox.Checked)
                {
                    if (ZoomOut.Process(ref buffer))
                    {
                        resultSb.AppendLine("ZoomHack (max) --> Success");
                    }
                    else
                    {
                        resultSb.AppendLine("ZoomHack (max) --> Fail");
                    }
                }

                if (this.zoomInCbox.Checked)
                {
                    if (ZoomIn.Process(ref buffer))
                    {
                        resultSb.AppendLine("ZoomHack (min) --> Success");
                    }
                    else
                    {
                        resultSb.AppendLine("ZoomHack (min) --> Fail");
                    }
                }

                if (this.oomCbox.Checked)
                {
                    if (OOM.Process(ref buffer))
                    {
                        resultSb.AppendLine("OOM --> Success");
                    }
                    else
                    {
                        resultSb.AppendLine("OOM --> Fail");
                    }
                }

                if (this.fovCbox.Checked)
                {
                    if (FOV.Process(ref buffer))
                    {
                        resultSb.AppendLine("FOV Changer --> Success");
                    }
                    else
                    {
                        resultSb.AppendLine("FOV Changer --> Fail");
                    }
                }

                if (this.topViewCbox.Checked)
                {
                    if (TopView.Process(ref buffer))
                    {
                        resultSb.AppendLine("TOP View --> Success");
                    }
                    else
                    {
                        resultSb.AppendLine("TOP View --> Fail");
                    }
                }

                resultSb.Append("\r\nIf any of these failed, here are the possible reasons:\r\n* Already patched\r\n* Patcher is outdated");

                File.WriteAllBytes(this.exePath, buffer);
                MessageBox.Show(resultSb.ToString(), "Patcher", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                // MsgBox
                MessageBox.Show("Patch failed!\r\n" + ex.Message + "\r\n\r\nPossible solutions:\r\n* Run as administrator\r\n* Pause anti-virus\r\n* Exit all LoL processes", "Patcher", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }