private static void GenSmogonSets(PKM rough) { SmogonSetList info; try { info = new SmogonSetList(rough); } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception ex) { WinFormsUtil.Error($"An error occured while trying to obtain the contents of the URL. This is most likely an issue with your Internet Connection. The exact error is as follows: {ex}"); return; } #pragma warning restore CA1031 // Do not catch general exception types if (!info.Valid || info.Sets.Count == 0) { WinFormsUtil.Error("No movesets available. Perhaps you could help out? Check the Contributions & Corrections forum.\n\nForum: https://www.smogon.com/forums/forums/contributions-corrections.388/"); return; } ShowdownSetLoader.Import(info.Sets); WinFormsUtil.Alert(info.Summary); }
private static void URLGen(object sender, EventArgs e) { var url = Clipboard.GetText().Trim(); TeamPasteInfo info; try { info = new TeamPasteInfo(url); } catch (Exception ex) { WinFormsUtil.Error("An error occured while trying to obtain the contents of the URL.", $"The exact error is as follows: {ex}"); return; } if (!info.Valid) { WinFormsUtil.Error("The data inside the URL are not valid Showdown Sets"); return; } if (info.Source == TeamPasteInfo.PasteSource.None) { WinFormsUtil.Error("The URL provided is not from a supported website."); return; } ShowdownSetLoader.Import(info.Sets); var response = $"All sets genned from the following URL: {info.URL}"; WinFormsUtil.Alert(response, info.Summary); }
private static void ImportPaste(object sender, EventArgs e) { // Check for showdown data in clipboard var text = GetTextShowdownData(); if (string.IsNullOrWhiteSpace(text)) { return; } ShowdownSetLoader.Import(text); }
private static void PGLShowdownSet(object sender, EventArgs e) { if (!Clipboard.ContainsImage()) { return; } var img = Clipboard.GetImage(); var rentalTeam = QRParser.DecryptQRCode(img); var sets = rentalTeam.ConvertedTeam.ToList(); ShowdownSetLoader.Import(sets); }
private static void GenSmogonSets(PKM rough) { SmogonSetList info; try { info = new SmogonSetList(rough); } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception ex) { WinFormsUtil.Error($"An error occured while trying to obtain the contents of the URL. This is most likely an issue with your Internet Connection. The exact error is as follows: {ex}"); return; } #pragma warning restore CA1031 // Do not catch general exception types if (!info.Valid || info.Sets.Count == 0) { WinFormsUtil.Error("No movesets available. Perhaps you could help out? Check the Contributions & Corrections forum.\n\nForum: https://www.smogon.com/forums/forums/contributions-corrections.388/"); return; } if (PromptForImport) { for (int i = 0; i < info.Sets.Count;) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Import this set?", $"[{info.SetFormat[i]}] {info.SetName[i]}", info.Sets[i].Text)) { info.Sets.RemoveAt(i); info.SetFormat.RemoveAt(i); info.SetName.RemoveAt(i); info.SetConfig.RemoveAt(i); info.SetText.RemoveAt(i); continue; } i++; } } ShowdownSetLoader.Import(info.Sets, PromptForImport); WinFormsUtil.Alert(info.Summary); }