public void OnSelected(IGame[] selectedGames) { foreach (var steamGame in selectedGames) { string input = steamGame.ApplicationPath; string steamPattern = @"steam://rungameid/"; game = steamGame; if (Regex.IsMatch(input, steamPattern)) { Regex rx = new Regex(@"(\d+)", RegexOptions.Compiled | RegexOptions.IgnoreCase); MatchCollection matches = rx.Matches(input); SteamApi.SteamSearch(matches[0].Value.ToString()); } } }
private void button1_Click(object sender, EventArgs e) { //Steam URL string url = textBox1.Text; //Regex to get the appId string pattern = @"^.*?\/[^\d]*(\d+)[^\d]*\/.*$"; string input = @url; RegexOptions options = RegexOptions.Singleline | RegexOptions.Multiline; Match m = Regex.Match(input, pattern, options); if (!m.Success) { MessageBox.Show("Please paste the entire Steam URL, couldn't find the appId!"); } else { SteamAppId = m.Groups[1].Value; if (SteamScraper.game.GetVideoPath() != null || SteamScraper.game.Publisher != "" || SteamScraper.game.Developer != "" || SteamScraper.game.Notes != "" || SteamScraper.game.GenresString != "") { DialogResult dialogResult = MessageBox.Show("This game has some Metadata already, Do you want to replace it?", "Steam Downloader", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { SteamApi.SteamSearch(SteamAppId); } else if (dialogResult == DialogResult.No) { this.Close(); } } else { SteamApi.SteamSearch(SteamAppId); } this.Close(); } }