//rename button to something else? private void playButton_Click(object sender, EventArgs e) { GameConfiguration gameConfig = gameConfigs.Single(g => g.Path == (String)gameComboBox.SelectedValue); if (File.Exists(gameConfig.Path)) { //save settings for last game played AMS.Profile.Xml profile = new AMS.Profile.Xml(Global.ConfigurationFilePath); using (profile.Buffer()) { profile.SetValue("Settings", "PathOfLastGamePlayed", gameConfig.Path); profile.SetValue("Settings", "PathOfLastJoyToKeyConfigUsed", (String)joyToKeyComboBox.SelectedValue); profile.SetValue("Settings", "ArcadeMode", arcadeModeCheckBox.Checked); profile.SetValue("Settings", "FullScreen", fullScreenCheckBox.Checked); profile.SetValue("Settings", "HideMouse", hideMouseCheckBox.Checked); } //run the selected game this.Hide(); //should lock the window instead? GameHandler gameHandler = new GameHandler(ref gameConfig, (String)joyToKeyComboBox.SelectedValue, arcadeModeCheckBox.Checked, fullScreenCheckBox.Checked, hideMouseCheckBox.Checked); this.Show(); return; } }
//rename button to something else? private void playButton_Click(object sender, EventArgs e) { GameConfiguration gameConfig = GameConfigs.Single(g => g.GameName == (String)gameComboBox.SelectedValue); if (File.Exists(gameConfig.GamePath)) { //set registry key for last game played Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Troll Kit", "LastGamePlayed", gameConfig.GameName); //for x64 adds to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Troll Kit //run the selected game this.Hide(); //should lock the window instead? GameHandler gameHandler = new GameHandler(ref gameConfig, arcadeModeCheckBox.Checked); this.Show(); return; } if (gameConfig.IsPortable) { if (downloadGame(ref gameConfig) && gameConfig.IsArchived) //TODO: or if archived file exists extractGame(ref gameConfig); gameComboBox_SelectedIndexChanged(null, null); //to set the button text to play return; } //TODO: if the game requires installation, download it, direct the user to install it, run in the installer, delete the installer //if the game requires installation, direct the user to install the game DialogResult dialogResult = MessageBox.Show("This game requires installation. Download the game, then install it in the default location. If it's an extractor, extract it to " + portableFolderPath + gameConfig.GameName + @"\." + "\n\nDo you want to download the game now?", "Whoa", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { Process.Start(gameConfig.DownloadUrl); } //TODO: provide a download all option, for a full setup }