Exemplo n.º 1
0
        public async Task Update(DecklistsEntry entry)
        {
            int retries = 5;

            while (retries > 0)
            {
                try
                {
                    await _page.OpenAsync();

                    InsertOrReplaceEntry(entry);
                    await _page.SaveAsync("WikiDeck updated " + entry.Link);

                    retries = 0;
                }
                catch (WikiaEditConflictException)
                {
                    --retries;
                    if (retries == 0)
                    {
                        throw;
                    }
                    await Task.Delay(100);
                }
            }
        }
Exemplo n.º 2
0
 public async Task UploadAsync()
 {
     _deckPage.Content = Regex.Replace(
         _deckPage.Content,
         @"({{Deck.*\|Deck=)([^}]+)(}}.*$)",
         x => x.Groups[1] + "\n" + Cards + x.Groups[3],
         RegexOptions.Singleline
         );
     await _deckPage.SaveAsync("Uploaded via WikiDeck");
 }