public async Task LoadAsync() { await _deckPage.LoadAsync(); Match match = Regex.Match(_deckPage.Content, @"{{Deck.*\|Deck=([^}]+)}}", RegexOptions.Singleline); if (match.Success) { Cards = match.Groups[1].Value.Trim(); } }
public async Task <DecklistsEntry> GetEntryAsync(string pageTitle) { await _page.LoadAsync(); Match match = Regex.Match(_page.Content, @"{{DecklistRow\s*\|link\s*=\s*" + Regex.Escape(pageTitle), RegexOptions.Singleline); if (!match.Success) { return(null); } string entryText = ExtractEntry(_page.Content, match.Index); return(new DecklistsEntry(entryText)); }
private async void buttonOK_Click(object sender, EventArgs e) { labelStatus.ForeColor = SystemColors.ControlText; SetStatus("Checking name availability", false); UpdateUI(true); string name = _deckPrefix + textBoxDeckName.Text; WikiaPage page = new WikiaPage(_client, name); await page.LoadAsync(); UpdateUI(false); if (page.Exists) { SetStatus("A deck with that name already exists.", true); } else { DeckPage = page; DeckName = textBoxDeckName.Text; DialogResult = DialogResult.OK; Close(); } }