Ejemplo n.º 1
0
        private void patchWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                if (backupCheckBox.Checked)
                {
                    Patch.CreateBackup(dotaFolder.Text + sClientDllPath[Settings.Default.selectedGame]);
                }

                patchWorker.ReportProgress(30);
                Patch.ChangeCameraDistance(ref sClientDll, cameraDistance, camDist.Text);
                patchWorker.ReportProgress(60);

                if (unlockAddonsCheckBox.Checked | svCheatsCheckBox.Checked)
                {
                    if (backupCheckBox.Checked)
                    {
                        Patch.CreateBackup(dotaFolder.Text + sEngine2DllPath[Settings.Default.selectedGame]);
                        // Patch.CreateBackup(dotaFolder.Text + PanoramaDllPath[Settings.Default.selectedGame]);
                    }

                    sEngine2Dll = File.ReadAllText(dotaFolder.Text + sEngine2DllPath[Settings.Default.selectedGame], Encoding.Default);
                    // sPanoramaDll = File.ReadAllText(dotaFolder.Text + PanoramaDllPath[Settings.Default.selectedGame], Encoding.Default);

                    if (unlockAddonsCheckBox.Checked)
                    {
                        Patch.UnlockAddons(ref sEngine2Dll, ref sClientDll, /*ref sPanoramaDll,*/ Settings.Default.selectedGame);
                    }

                    if (svCheatsCheckBox.Checked)
                    {
                        Patch.UnlockSvCheats(ref sEngine2Dll, Settings.Default.selectedGame);
                    }

                    File.WriteAllText(dotaFolder.Text + sEngine2DllPath[Settings.Default.selectedGame], sEngine2Dll,
                                      Encoding.Default);

                    // File.WriteAllText(dotaFolder.Text + PanoramaDllPath[Settings.Default.selectedGame], sPanoramaDll, Encoding.Default);
                }
                patchWorker.ReportProgress(80);
                File.WriteAllText(dotaFolder.Text + sClientDllPath[Settings.Default.selectedGame], sClientDll,
                                  Encoding.Default);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
    public static void PatchApply()
    {
        string[] sClientDllPath =
        {
            @"\game\dota\bin\win32\client.dll",
            @"\game\dota\bin\win64\client.dll"
        };

        string[] sEngine2DllPath =
        {
            @"\game\bin\win32\engine2.dll", @"\game\bin\win64\engine2.dll"
        };

        string[] sPanoramaDllPath =
        {
            @"\game\bin\win32\panorama.dll", @"\game\bin\win64\panorama.dll"
        };

        try
        {
            if (Environment.GetCommandLineArgs()[7] == "1")
            {
                Patch.CreateBackup(Environment.GetCommandLineArgs()[1] + sClientDllPath[int.Parse(Environment.GetCommandLineArgs()[2])]);
            }

            var sClientDllFile = File.ReadAllText(Environment.GetCommandLineArgs()[1] + sClientDllPath[int.Parse(Environment.GetCommandLineArgs()[2])], Encoding.Default);

            if (Environment.GetCommandLineArgs()[3] == "1")
            {
                Patch.ChangeCameraDistance(ref sClientDllFile, Patch.FindCameraDistance(ref sClientDllFile), Environment.GetCommandLineArgs()[4]);
            }

            if (Environment.GetCommandLineArgs()[5] == "1" | Environment.GetCommandLineArgs()[6] == "1")
            {
                if (Environment.GetCommandLineArgs()[7] == "1")
                {
                    Patch.CreateBackup(Environment.GetCommandLineArgs()[1] + sEngine2DllPath[int.Parse(Environment.GetCommandLineArgs()[2])]);
                    // Patch.CreateBackup(Environment.GetCommandLineArgs()[1] + sPanoramaDllPath[int.Parse(Environment.GetCommandLineArgs()[2])]);
                }

                var sEngine2DllFile = File.ReadAllText(Environment.GetCommandLineArgs()[1] + sEngine2DllPath[int.Parse(Environment.GetCommandLineArgs()[2])], Encoding.Default);
                // var sPanoramaDllFile = File.ReadAllText(Environment.GetCommandLineArgs()[1] + sPanoramaDllPath[int.Parse(Environment.GetCommandLineArgs()[2])], Encoding.Default);

                if (Environment.GetCommandLineArgs()[5] == "1")
                {
                    Patch.UnlockAddons(ref sEngine2DllFile, ref sClientDllFile, /*ref sPanoramaDllFile,*/ 1 ^ int.Parse(Environment.GetCommandLineArgs()[2]));
                }

                if (Environment.GetCommandLineArgs()[6] == "1")
                {
                    Patch.UnlockSvCheats(ref sEngine2DllFile, 1 ^ int.Parse(Environment.GetCommandLineArgs()[2]));
                }

                File.WriteAllText(Environment.GetCommandLineArgs()[1] + sEngine2DllPath[int.Parse(Environment.GetCommandLineArgs()[2])], sEngine2DllFile, Encoding.Default);
                // File.WriteAllText(Environment.GetCommandLineArgs()[1] + sPanoramaDllPath[int.Parse(Environment.GetCommandLineArgs()[2])], sPanoramaDllFile, Encoding.Default);
            }

            File.WriteAllText(Environment.GetCommandLineArgs()[1] + sClientDllPath[int.Parse(Environment.GetCommandLineArgs()[2])], sClientDllFile, Encoding.Default);
        }
        catch (Exception e)
        {
            MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }