private void URLGen(object sender, EventArgs e) { string url = Clipboard.GetText().Trim(); string initURL = url; bool isUri = Uri.IsWellFormedUriString(url, UriKind.RelativeOrAbsolute); if (!isUri) { MessageBox.Show("The text in the clipboard is not a valid URL"); return; } if (!CheckPokePaste(url) && !CheckPasteBin(url)) { MessageBox.Show("The URL provided is not a pokepast.es or a pastebin.com URL"); return; } url = FixURL(url); string sets = GetText(url).TrimStart().TrimEnd(); if (sets.StartsWith("Error :")) { return; } Clipboard.SetText(sets); try { AutomaticLegality.ImportModded(); } catch { MessageBox.Show("The data inside the URL are not valid Showdown Sets"); } Dictionary <string, string> metadata = GetMetadata(MetaDataURL(url)); string typeOfBin = (CheckPasteBin(url)) ? "Pastebin" : "PokePaste"; MessageBox.Show("All sets genned from the following URL: " + initURL + "\n\n" + typeOfBin + " data:\nTitle: " + metadata["Title"] + "\nAuthor: " + metadata["Author"] + "\nDescription: " + metadata["Description"]); Clipboard.SetText(initURL); }
/// <summary> /// Main function to be called by the menu /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void ClickShowdownImportPKMModded(object sender, EventArgs e) { CheckALMUpdate(); // Check for Auto Legality Mod Updates AutomaticLegality.C_SAV = C_SAV; AutomaticLegality.PKME_Tabs = PKME_Tabs; AutomaticLegality.ImportModded(); // Finish the job }
private void PGLShowdownSet(object sender, EventArgs e) { if (!Clipboard.ContainsImage()) { return; } var rentalTeam = new QRParser().decryptQRCode(Clipboard.GetImage()); string data = ""; foreach (QRPoke p in rentalTeam.team) { data += p.ToShowdownFormat(false) + Environment.NewLine + Environment.NewLine; } Clipboard.SetText(data.TrimEnd()); AutomaticLegality.ImportModded(); MessageBox.Show("Exported OwO", "Alert"); }
private void SmogonGenning(object sender, EventArgs e) { PKM rough = PKMEditor.PreparePKM(); string speciesName = Util.GetSpeciesList("en")[rough.Species]; string form = new ShowdownSet(ShowdownSet.GetShowdownText(rough)).Form; string url = GetURL(speciesName, form); string smogonPage = GetSmogonPage(url); string[] split1 = smogonPage.Split(new string[] { "\",\"abilities\":" }, StringSplitOptions.None); List <string> sets = new List <string>(); for (int i = 1; i < split1.Length; i++) { sets.Add(split1[i].Split(new string[] { "\"]}" }, StringSplitOptions.None)[0]); } string showdownSpec = speciesName; if (form != null) { if (form != "Mega" || form != "") { showdownSpec += ("-" + form); } } string showdownsets = ""; foreach (string set in sets) { showdownsets = showdownsets + ConvertSetToShowdown(set, showdownSpec) + Environment.NewLine + Environment.NewLine; } showdownsets.TrimEnd(); if (showdownsets.Length == 0) { MessageBox.Show("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; } Clipboard.SetText(showdownsets); try { AutomaticLegality.ImportModded(); } catch { MessageBox.Show("Something went wrong"); } MessageBox.Show(AlertText(showdownSpec, sets.Count, GetTitles(smogonPage))); }