private void btnFindSteam_Click(object sender, EventArgs e)
        {
            try
            {
                btnMain.Text = "Working...";
                string path = SteamGamePath.FindGameByAppID("1091500");
                if (path == null)
                {
                    MetroFramework.MetroMessageBox.Show(this, "Error: Couldn't Find Cyberpunk for Steam!", "File not found Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    //Trace.WriteLine("Error: Couldn't Find CyberPunk for steam!");
                    btnMain.Text = "Select Path to Cyberpunk 2077 Main Directory";
                    return;
                }

                DialogResult result = MetroFramework.MetroMessageBox.Show(this, path, "Is this Correct?", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    if (generalPath == string.Empty)
                    {
                        generalPath = $@"{path}\bin\x64";
                    }
                    PatchGame($@"{path}\bin\x64");
                }
                else if (result == DialogResult.No)
                {
                    MetroFramework.MetroMessageBox.Show(this, null, "Install Canceled.", MessageBoxButtons.OK);
                    btnMain.Text = "Select Path to Cyberpunk 2077 Main Directory";
                }
                else
                {
                    MetroFramework.MetroMessageBox.Show(this, "Error during installation\nError code: 2", "Critical Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    btnMain.Text = "Critical Error!";
                }
            }
            catch (Exception ex)
            {
                MetroFramework.MetroMessageBox.Show(this, $"Error: {ex}", "Unknown Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //Trace.WriteLine("Error" + ex);
            }
        }
Пример #2
0
        /// <summary>
        /// Begin game install based on auto detect button clicked.
        /// </summary>
        /// <param name="sender"></param>
        private void GamePathInstaller(object sender)
        {
            try
            {
                btnMain.Text = "Working...";
                Button clickedButton = (Button)sender;
                string path          = null;

                switch (clickedButton.Tag.ToString())
                {
                case "GOG":
                    path = GOGGamePath.FindGameByAppID("1423049311");
                    break;

                case "Steam":
                    path = SteamGamePath.FindGameByAppID("1091500");
                    break;

                default:
                    break;
                }

                if (path == null)
                {
                    MetroFramework.MetroMessageBox.Show(this, $"Error: Couldn't Find Cyberpunk for {clickedButton.Tag}!", "Error: File not found!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    TraceDebugWrite($"Error: Couldn't Find Cyberpunk for {clickedButton.Tag}!");
                    btnMain.Text = "Select Path to Cyberpunk 2077 Main Directory";
                    return;
                }

                var result = MetroFramework.MetroMessageBox.Show(this, path, "Is this Correct?", MessageBoxButtons.YesNo);
                switch (result)
                {
                case DialogResult.Yes:
                    if (string.IsNullOrWhiteSpace(_generalPath))
                    {
                        _generalPath = Path.Combine(path, "bin", "x64");
                    }
                    PatchGame(Path.Combine(path));
                    EnableGbx();     // Enable the settings after the installation.
                    break;

                case DialogResult.No:
                    MetroFramework.MetroMessageBox.Show(this, null, "Installation Cancelled!", MessageBoxButtons.OK);
                    btnMain.Text = "Select Path to Cyberpunk 2077 Main Directory";
                    DisableGbx();     // Disable the Settings page.
                    break;

                default:
                    MetroFramework.MetroMessageBox.Show(this, "The tool wasn't able to open the dialog box!", "Critical Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    DisableGbx();     // Disable the Settings page.
                    break;
                }
            }
            catch (Exception ex)
            {
                MetroFramework.MetroMessageBox.Show(this, $"Error: {ExceptionAsString(ex)}", "Unknown Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TraceDebugWrite("Error" + ex);
                DisableGbx(); // Disable the Settings page.
            }
        }