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); }
public static void HasSmogonSets(Type t, GameVersion game, int species, int form = 0) { var blank = PKMConverter.GetBlank(t); blank.Version = (int)game; blank.Species = species; blank.Form = form; var smogon = new SmogonSetList(blank); smogon.Valid.Should().BeTrue("Sets should exist for this setup"); var count = smogon.Sets.Count; count.Should().BeGreaterThan(0, "At least one set should exist"); smogon.SetConfig.Count.Should().Be(count, "Unparsed text should be captured and match result count"); smogon.SetText.Count.Should().Be(count, "Reformatted text should be captured and match result count"); }
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); }