本文整理汇总了C#中DotNetWikiBot.Page类的典型用法代码示例。如果您正苦于以下问题:C# Page类的具体用法?C# Page怎么用?C# Page使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Page类属于DotNetWikiBot命名空间,在下文中一共展示了Page类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Template
internal Template(Page p, string s)
{
Page = p;
Text = s;
Parameters = p.site.ParseTemplate(s);
Title = Page.site.RemoveNSPrefix(Regex.Match(s, @"^(.+?)($|\|)", RegexOptions.Multiline).Groups[1].Value.Trim(), 10);
}
开发者ID:darthmaim,项目名称:DotNetWikiBot-Extensions,代码行数:7,代码来源:TemplateExtensions.cs
示例2: ConvertPage
public static void ConvertPage(string pageName, string newName, bool overwrite = false)
{
var db = new ZkDataContext();
ForumThread thread = db.ForumThreads.FirstOrDefault(x=> x.WikiKey == pageName);
if (thread == null)
{
Console.WriteLine("No ZK wiki page with name {0} found", pageName);
return;
}
string text = thread.ForumPosts.First().Text;
text = BBCodeToMediaWiki(text);
Page page = new Page(newWiki, newName);
page.Load();
bool update = false;
if (!page.IsEmpty())
{
if (!overwrite)
{
Console.WriteLine("Page already exists, exiting");
return;
}
else update = true;
}
if (newName.StartsWith("Mission Editor", true, System.Globalization.CultureInfo.CurrentCulture))
page.AddToCategory("Mission Editor");
page.Save(text, update ? "" : "Ported from ZK wiki by DotNetWikiBot", update);
}
开发者ID:DeinFreund,项目名称:Zero-K-Infrastructure,代码行数:30,代码来源:WikiPortingMW.cs
示例3: ProcessPage
protected override void ProcessPage(Page p, EditStatus edit)
{
if (p.GetNamespace() != 0) return;
p.Load();
var changes = new List<string>();
p.InsertPlaceholders(GeneralExtensions.Placeholder.Default);
foreach (var replacement in Replacements.Where(replacement => p.text.Contains(replacement.Key)))
{
p.text = p.text.Replace(replacement.Key, replacement.Value);
changes.Add(replacement.Key + " → " + replacement.Value);
}
foreach (var replacement in RegexReplacements)
{
var pattern = replacement.Key;
var replace = replacement.Value;
pattern.Replace(p.text, match =>
{
var replaceWith = RegexParseReplaceWithString(match, replace);
changes.Add(match.Value + " → " + replaceWith);
return replaceWith;
});
}
p.RemovePlaceholders();
if (changes.Count > 0)
{
edit.Save = true;
edit.EditComment = "Ersetzt: " + string.Join(", ", changes);
}
}
开发者ID:knabbi,项目名称:GW2WBot,代码行数:35,代码来源:ReplacementJob.cs
示例4: ProcessPage
protected override void ProcessPage(Page p, EditStatus edit)
{
if (p.GetNamespace() != 0) return;
p.Load();
var before = p.text;
var changes = new List<string>();
Match m;
while ((m = MuenzenRegex.Match(p.text)).Success)
{
var kupfer = 0;
var silber = 0;
var gold = 0;
int.TryParse(m.Groups["kupfer"].Value, out kupfer);
int.TryParse(m.Groups["silber"].Value, out silber);
int.TryParse(m.Groups["gold"].Value, out gold);
var muenzen = kupfer + 100*silber + 10000*gold;
p.text = p.text.Replace(m.Value.Trim(), "{{Münzen|" + muenzen + "}}");
changes.Add(string.Format("{0}g {1}s {2}k → {3}", gold, silber, kupfer, muenzen));
}
if (changes.Count > 0)
{
edit.EditComment = string.Format("Münzen ({0}x): {1}", changes.Count, string.Join(", ", changes));
edit.Save = true;
}
}
开发者ID:knabbi,项目名称:GW2WBot,代码行数:33,代码来源:MuenzenJob.cs
示例5: Section
public Section(string content, Page page, int level)
{
_originalContent = content;
Content = content;
Page = page;
Level = level;
Subsections = SectionExtensions.GetAllSections(Content, page, level + 1);
}
开发者ID:darthmaim,项目名称:DotNetWikiBot-Extensions,代码行数:9,代码来源:SectionExtensions.cs
示例6: exec
public static void exec()
{
string[] line = System.IO.File.ReadAllLines("list");
List<string> ignorelist = new List<string>();
if (System.IO.File.Exists("resultsig"))
{
ignorelist.AddRange (System.IO.File.ReadAllLines("resultsig"));
}
if (System.IO.File.Exists("results"))
{
ignorelist.AddRange (System.IO.File.ReadAllLines("results"));
}
int processed = 1;
foreach (string c in line)
{
if (ignorelist.Contains(c))
{
continue;
}
try
{
Page afc = new Page(MainClass.en, "Wikipedia talk:" + c);
afc.Load();
if ( afc.text == null ||
afc.text.Contains("REDIRECT") ||
afc.text.Contains("{{AFC") ||
afc.text.Contains("{{WPAFC") ||
afc.text == "" ||
afc.text.Contains("[[Category:AfC_submissions_with_missing_AfC_template]]")
)
{
MainClass.DebugLog("OK:" + c);
System.IO.File.AppendAllText("resultsig", c + "\n");
}
else
{
MainClass.DebugLog("Category missing:" + c);
afc.text = afc.text + "\n[[Category:AfC_submissions_with_missing_AfC_template]]";
afc.Save(afc.text, "Bot: inserting [[Category:AfC_submissions_with_missing_AfC_template]]", false);
processed++;
System.IO.File.AppendAllText("results", c + "\n");
if (processed > 100)
{
MainClass.DebugLog("Finished for today");
return;
}
}
}
catch (Exception fail)
{
Console.WriteLine(fail.ToString());
System.IO.File.AppendAllText("errors", c + Environment.NewLine);
}
}
MainClass.Log("end");
}
开发者ID:WPAFC,项目名称:wikibots,代码行数:56,代码来源:Task1.cs
示例7: CheckIfReviewUnnecessary
private static bool CheckIfReviewUnnecessary(Page page)
{
string newPageText;
bool unnecessary = false;
string unnecessaryReason = "";
if (page.text.ToLower().Contains("{{picasareviewunnecessary}}"))
{
// Already marked unnecessary, assume it is
return true;
}
if (IsFlickrReviewed(page))
{
unnecessary = true;
unnecessaryReason = "Also on Flickr and already Flickr reviewed";
}
if (HasOtrsTag(page))
{
unnecessary = true;
unnecessaryReason = "Has OTRS tag";
}
foreach (string tag in new string[] { "{{pd-usgov", "{{pd-art}}", "{{pd-art|", "{{pd-scan}}", "{{pd-scan|", "{{pd-old", "{{pd-us}}", "{{anonymous-eu}}" })
{
if (page.text.ToLower().Contains(tag))
{
unnecessary = true;
unnecessaryReason = "Is public domain";
}
}
if (unnecessary)
{
newPageText = tagRegex.Replace(page.text, "{{picasareviewunnecessary}}");
newPageText = new Regex("\\{\\{User:Picasa Review Bot/reviewed-error\\|[^}]*\\}\\}", RegexOptions.IgnoreCase).
Replace(newPageText, "{{picasareviewunnecessary}}");
if (page.text != newPageText)
{
page.text = newPageText;
SavePage(page, "Marked {{picasareviewunnecessary}}: " + unnecessaryReason);
}
return true;
}
return false;
}
开发者ID:wikigit,项目名称:Picasa-Review-Bot,代码行数:44,代码来源:Program.cs
示例8: ProcessPage
protected override void ProcessPage(Page p, EditStatus edit)
{
if (p.GetNamespace() != 0) return;
p.Load();
var templates = p.GetAllTemplates().Where(t => t.Title.ToLower() == "infobox gegenstand");
foreach (var template in templates)
{
if (template.Parameters.ContainsKey("beschreibung") && _regex.IsMatch(template.Parameters["beschreibung"]))
{
template.Parameters["beschreibung"] = _regex.Replace(template.Parameters["beschreibung"], "[[$1]]");
template.Save();
edit.Save = true;
edit.EditComment = "Attribute in Gegenstandsbeschreibung verlinkt";
}
}
}
开发者ID:knabbi,项目名称:GW2WBot,代码行数:19,代码来源:LinkAttributeInItemDescriptionJob.cs
示例9: ProcessPage
protected override void ProcessPage(Page p, Job.EditStatus edit)
{
if(p.GetNamespace() != 0) return;
p.Load();
foreach (var template in p.GetAllTemplates().Where(
template => (template.Title.Equals("Ausrüstungswerte", StringComparison.OrdinalIgnoreCase)
|| template.Title.Equals("Rezept", StringComparison.OrdinalIgnoreCase)) &&
(template.Parameters.HasValueIgnoreCase("seltenheit", "Aufgestiegen") &&
!template.Parameters.ContainsKey("aufwertung"))))
{
template.InsertParameterAfter("aufwertung", "nein", "infusion2", "infusion");
template.Save();
edit.EditComment = "'aufwertung = nein' hinzugefügt";
edit.Save = true;
}
}
开发者ID:knabbi,项目名称:GW2WBot,代码行数:20,代码来源:AufgestiegenerSchmuckJob.cs
示例10: ProcessPage
protected override void ProcessPage(Page p, EditStatus edit)
{
if (p.GetNamespace() != 0)
return;
p.Load();
//Nur Seiten mit Vorlage:Infobox NSC
if (p.GetAllTemplates().All(t => t.Title.ToLower() != "infobox nsc")) return;
//Nur Seiten, die eine Unterseite mit Angeboten haben...
var m = Regex.Match(p.text, "\\{\\{:" + p.title + "/([^}]+)}}");
if (!m.Success) return;
var subpageTitle = m.Groups[1].Value;
var subpage = new Page(p.site, p.title + "/" + subpageTitle);
subpage.Load();
if (!subpage.Exists())
{
p.text = p.text.Replace(m.Value, "");
edit.EditComment = "Verweis auf nicht vorhandene Angebots-Unterseite „" + subpage.title + "“ entfernt";
edit.Save = true;
}
else
{
var pl2 = new PageList(p.site);
pl2.FillFromLinksToPage(subpage.title);
if (pl2.Count() > 1) return;
var subpageContent = Regex.Replace(subpage.text, "<noinclude>.*?</noinclude>", "").Trim();
p.text = p.text.Replace(m.Value, subpageContent);
subpage.text = "{{Löschantrag|[Bot] In den Hauptartikel „[[" + p.title + "]]“ verschoben}}\n" +
subpage.text;
subpage.Save("[Bot] In Hauptartikel „[[" + p.title + "]]“ verschoben", true);
edit.EditComment = "Angebot von „" + subpage.title + "“ in den Hauptartikel verschoben";
edit.Save = true;
}
}
开发者ID:knabbi,项目名称:GW2WBot,代码行数:41,代码来源:AngebotSubpageToMainarticleJob.cs
示例11: exec
public static void exec()
{
string[] line = System.IO.File.ReadAllLines("list");
List<string> ignorelist = new List<string>();
if (System.IO.File.Exists("resultsig"))
{
ignorelist.AddRange (System.IO.File.ReadAllLines("resultsig"));
}
if (System.IO.File.Exists("results"))
{
ignorelist.AddRange (System.IO.File.ReadAllLines("results"));
}
foreach (string c in line)
{
if (ignorelist.Contains(c))
{
continue;
}
try
{
Page afc = new Page(MainClass.en, "Wikipedia talk:" + c);
afc.Load();
if (afc.text.Contains("REDIRECT") || afc.text.Contains("{{AFC"))
{
MainClass.DebugLog("OK:" + c);
System.IO.File.AppendAllText("resultsig", c + "\n");
}
else
{
MainClass.DebugLog("Template missing:" + c);
System.IO.File.AppendAllText("results", c + "\n");
}
}
catch (Exception fail)
{
Console.WriteLine(fail.ToString());
System.IO.File.AppendAllText("errors", c + "." + Environment.NewLine);
}
}
MainClass.Log("end");
}
开发者ID:WPAFC,项目名称:wikibots,代码行数:41,代码来源:Task4.cs
示例12: ProcessPage
protected override void ProcessPage(Page p, EditStatus edit)
{
if (p.GetNamespace() != 0)
return;
p.Load();
var before = p.text;
foreach (var template in p.GetAllTemplates())
{
if (template.Title == "#dpl:" && template.Parameters.ContainsKey("category") &&
template.Parameters.ContainsKey("linksto") && template.Parameters.ContainsKey("format"))
{
var linksTo = template.Parameters["linksto"];
linksTo = linksTo == p.title ? "{{PAGENAME}}" : linksTo;
if (template.Parameters["category"].ToLower() == "trophäe")
p.text = p.text.Replace(template.Text, "Beschaffung|gegenstand=" + linksTo + "|kategorie=Trophäe");
else if (template.Parameters["category"].ToLower() == "behälter")
p.text = p.text.Replace(template.Text, "Beschaffung|gegenstand=" + linksTo + "|kategorie=Behälter");
}
}
if (p.text.Contains("#dpl:") && p.text.Contains("Behälter"))
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("{0} still contains dpl", p.title);
Console.ResetColor();
}
if (p.text != before)
{
edit.Save = true;
edit.EditComment = "DPL durch {{Beschaffung}} ersetzt";
}
}
开发者ID:knabbi,项目名称:GW2WBot,代码行数:37,代码来源:BeschaffungTemplateJob.cs
示例13: ProcessPage
protected override void ProcessPage(Page p, EditStatus edit)
{
if (p.GetNamespace() != 0) return;
p.Load();
var allChanges = new List<string>();
var before = p.text;
foreach (var template in p.GetAllTemplates())
{
var templateChanges = new List<string>();
if (Replacements.ContainsKey(template.Title))
{
foreach (var parameter in template.Parameters)
{
if (Replacements[template.Title].ContainsKey(parameter.Key))
{
template.ChangeParametername(parameter.Key, Replacements[template.Title][parameter.Key]);
templateChanges.Add(parameter.Key + " → " + Replacements[template.Title][parameter.Key]);
}
}
}
if (templateChanges.Count > 0)
{
template.Save();
allChanges.Add(template.Title + ": " + string.Join(", ", templateChanges));
}
}
if (allChanges.Count > 0)
{
edit.Save = true;
edit.EditComment = "Parameter umbenannt: " + string.Join("; ", allChanges);
}
}
开发者ID:knabbi,项目名称:GW2WBot,代码行数:36,代码来源:RenameTemplateParameterJob.cs
示例14: LoadEx
/// <summary>Loads text and metadata for pages in PageList via XML export interface.
/// Non-existent pages will be automatically removed from the PageList.
/// Please, don't use this function when going to edit big amounts of pages on
/// popular public wikis, as it compromises edit conflict detection. In that case,
/// each page's text should be loaded individually right before its processing
/// and saving.</summary>
public void LoadEx()
{
if (IsEmpty())
throw new WikiBotException(Bot.Msg("The PageList is empty. Nothing to load."));
Bot.LogEvent(Bot.Msg("Loading {0} pages..."), pages.Count);
string res = site.site + site.indexPath +
"index.php?title=Special:Export&action=submit";
string postData = "curonly=True&pages=";
foreach (Page page in pages)
postData += HttpUtility.UrlEncode(page.title) + "\r\n";
XmlReader reader = XmlReader.Create(
new StringReader(site.PostDataAndGetResultHTM(res, postData)));
Clear();
while (reader.ReadToFollowing("page")) {
Page p = new Page(site, "");
p.ParsePageXML(reader.ReadOuterXml());
pages.Add(p);
}
reader.Close();
}
开发者ID:wikigit,项目名称:Picasa-Review-Bot,代码行数:26,代码来源:DotNetWikiBot.cs
示例15: Insert
/// <summary>Inserts an element into this PageList at the specified index.</summary>
/// <param name="page">Page object to insert.</param>
/// <param name="index">Zero-based index.</param>
public void Insert(Page page, int index)
{
pages.Insert(index, page);
}
开发者ID:wikigit,项目名称:Picasa-Review-Bot,代码行数:7,代码来源:DotNetWikiBot.cs
示例16: FillFromPageHistoryEx
/// <summary>Gets page history using bot query interface ("api.php" MediaWiki extension)
/// and fills this PageList with specified number of last page revisions, optionally loading
/// revision texts as well. On most sites not more than 50 last revisions can be obtained.
/// Thanks to Jutiphan Mongkolsuthree for idea and outline of this function.</summary>
/// <param name="pageTitle">Page to get history of.</param>
/// <param name="lastRevisions">Number of last page revisions to obtain.</param>
/// <param name="loadTexts">Load revision texts right away.</param>
public void FillFromPageHistoryEx(string pageTitle, int lastRevisions, bool loadTexts)
{
if (!site.botQuery)
throw new WikiBotException(
Bot.Msg("The \"api.php\" MediaWiki extension is not available."));
if (string.IsNullOrEmpty(pageTitle))
throw new ArgumentNullException("pageTitle");
if (lastRevisions <= 0)
throw new ArgumentOutOfRangeException("lastRevisions",
Bot.Msg("Quantity must be positive."));
Bot.LogEvent(
Bot.Msg("Getting {0} last revisons of \"{1}\" page..."), lastRevisions, pageTitle);
string queryUri = site.site + site.indexPath +
"api.php?action=query&prop=revisions&titles=" +
HttpUtility.UrlEncode(pageTitle) + "&rvprop=ids|user|comment|timestamp" +
(loadTexts ? "|content" : "") + "&format=xml&rvlimit=" + lastRevisions.ToString();
Page p;
using (XmlReader reader = XmlReader.Create(queryUri)) {
reader.ReadToFollowing("api");
reader.Read();
if (reader.Name == "error")
Console.Error.WriteLine(Bot.Msg("Error: {0}"), reader.GetAttribute("info"));
while (reader.ReadToFollowing("rev")) {
p = new Page(site, pageTitle);
p.lastRevisionID = reader.GetAttribute("revid");
p.lastUser = reader.GetAttribute("user");
p.comment = reader.GetAttribute("comment");
p.timestamp =
DateTime.Parse(reader.GetAttribute("timestamp")).ToUniversalTime();
if (loadTexts)
p.text = reader.ReadString();
pages.Add(p);
}
}
Bot.LogEvent(Bot.Msg("PageList filled with {0} last revisons of \"{1}\" page."),
pages.Count, pageTitle);
}
开发者ID:wikigit,项目名称:Picasa-Review-Bot,代码行数:44,代码来源:DotNetWikiBot.cs
示例17: FillFromPageHistory
/// <summary>Gets page history and fills this PageList with specified number of last page
/// revisions. But only revision identifiers, user names, timestamps and comments are
/// loaded, not the texts. Call Load() (but not LoadEx) to load the texts of page revisions.
/// The function combines XML (XHTML) parsing and regular expressions matching.</summary>
/// <param name="pageTitle">Page to get history of.</param>
/// <param name="lastRevisions">Number of last page revisions to get.</param>
public void FillFromPageHistory(string pageTitle, int lastRevisions)
{
if (string.IsNullOrEmpty(pageTitle))
throw new ArgumentNullException("pageTitle");
if (lastRevisions <= 0)
throw new ArgumentOutOfRangeException("quantity",
Bot.Msg("Quantity must be positive."));
Bot.LogEvent(
Bot.Msg("Getting {0} last revisons of \"{1}\" page..."), lastRevisions, pageTitle);
string res = site.site + site.indexPath + "index.php?title=" +
HttpUtility.UrlEncode(pageTitle) + "&limit=" + lastRevisions.ToString() +
"&action=history";
XmlDocument doc = new XmlDocument();
doc.XmlResolver = null;
string text = site.GetPageHTM(res).Replace(" ", " ").Replace("–", "-");
doc.LoadXml(text);
XmlNodeList nl = doc.DocumentElement.SelectNodes("//ns:ul[@id='pagehistory']/ns:li",
site.xmlNS);
Regex revisionLinkRE = new Regex(@"(?<!diff=\d+&)oldid=(\d+).+?>(.+?)<");
XmlNode subn;
foreach (XmlNode n in nl) {
Page p = new Page(site, pageTitle);
p.lastRevisionID = revisionLinkRE.Match(n.InnerXml).Groups[1].Value;
DateTime.TryParse(revisionLinkRE.Match(n.InnerXml).Groups[2].Value,
site.regCulture, DateTimeStyles.AssumeLocal, out p.timestamp);
p.lastUser =
n.SelectSingleNode("ns:span[@class='history-user']/ns:a", site.xmlNS).InnerText;
if ((subn =
n.SelectSingleNode("ns:span[@class='history-size']", site.xmlNS)) != null)
int.TryParse(Regex.Replace(subn.InnerText, @"[^-+\d]", ""),
out p.lastBytesModified);
p.lastMinorEdit =
(n.SelectSingleNode("ns:span[@class='minor']", site.xmlNS) != null) ?
true : false;
p.comment = (n.SelectSingleNode("ns:span[@class='comment']", site.xmlNS) != null) ?
n.SelectSingleNode("ns:span[@class='comment']", site.xmlNS).InnerText : "";
pages.Add(p);
}
Bot.LogEvent(Bot.Msg("PageList filled with {0} last revisons of \"{1}\" page..."),
nl.Count, pageTitle);
}
开发者ID:wikigit,项目名称:Picasa-Review-Bot,代码行数:47,代码来源:DotNetWikiBot.cs
示例18: FillFromAllPageLinks
/// <summary>Gets page titles for this PageList from all links in some wiki page. All links
/// will be retrieved, from all standard namespaces, except interwiki links to other
/// sites. Use FillFromPageLinks function instead to filter namespaces
/// automatically.</summary>
/// <param name="pageTitle">Page title as string.</param>
/// <example><code>pageList.FillFromAllPageLinks("Art");</code></example>
public void FillFromAllPageLinks(string pageTitle)
{
if (string.IsNullOrEmpty(pageTitle))
throw new ArgumentNullException("pageTitle");
if (string.IsNullOrEmpty(Site.WMLangsStr))
site.GetWikimediaWikisList();
Regex wikiLinkRE = new Regex(@"\[\[:*(.+?)(]]|\|)");
Page page = new Page(site, pageTitle);
page.Load();
MatchCollection matches = wikiLinkRE.Matches(page.text);
Regex outWikiLink = new Regex("^(" + Site.WMLangsStr +
/*"|" + Site.WMSitesStr + */ "):");
foreach (Match match in matches)
if (!outWikiLink.IsMatch(match.Groups[1].Value))
pages.Add(new Page(site, match.Groups[1].Value));
Bot.LogEvent(
Bot.Msg("PageList filled with links, found on \"{0}\" page."), pageTitle);
}
开发者ID:wikigit,项目名称:Picasa-Review-Bot,代码行数:24,代码来源:DotNetWikiBot.cs
示例19: FillAndLoadFromXMLDump
/// <summary>Gets page titles and page text from local XML dump.
/// This function consumes much resources.</summary>
/// <param name="filePathName">The path to and name of the XML dump file as string.</param>
public void FillAndLoadFromXMLDump(string filePathName)
{
Bot.LogEvent(Bot.Msg("Loading pages from XML dump..."));
XmlReader reader = XmlReader.Create(filePathName);
while (reader.ReadToFollowing("page")) {
Page p = new Page(site, "");
p.ParsePageXML(reader.ReadOuterXml());
pages.Add(p);
}
reader.Close();
Bot.LogEvent(Bot.Msg("XML dump loaded successfully."));
}
开发者ID:wikigit,项目名称:Picasa-Review-Bot,代码行数:15,代码来源:DotNetWikiBot.cs
示例20: ProcessPage
protected override void ProcessPage(Page p, EditStatus edit)
{
if (p.GetNamespace() != 0)
return;
p.Load();
var changes = new List<string>();
var templates = p.GetAllTemplates();
foreach (var template in templates)
{
if (template.Title == "Rezept")
{
if (template.Parameters.ContainsKey("seltenheit")
&&
new[] {"meisterwerk", "selten", "exotisch", "legendär"}.Contains(
template.Parameters["seltenheit"].ToLower())
&& template.Parameters.ContainsKey("gebunden") &&
template.Parameters["gebunden"].ToLower() == "benutzung")
{
template.Parameters.Remove("gebunden");
template.Save();
changes.Add("Rezept: 'gebunden = benutzung' entfernt");
}
}
else if (template.Title == "Eventbelohnung")
{
string[] parametersToRemove =
{
"ep-gold", "ep-silber", "ep-bronze",
"ep-gold-niederlage", "ep-silber-niederlage", "ep-bronze-niederlage",
"ep-niederlage",
"karma-gold", "karma-silber", "karma-bronze",
"karma-gold-niederlage", "karma-silber-niederlage", "karma-bronze-niederlage",
"karma-niederlage",
"münzen-gold", "münzen-silber", "münzen-bronze",
"münzen-gold-niederlage", "münzen-silber-niederlage", "münzen-bronze-niederlage",
"münzen-niederlage"
};
var removed = new List<string>();
foreach (var parameter in parametersToRemove)
{
if (template.Parameters.ContainsKey(parameter))
{
template.Parameters.Remove(parameter);
removed.Add(parameter);
}
}
if (removed.Any())
{
template.Save();
changes.Add("Eventbelohnung: '" + string.Join("', '", removed) + "' entfernt");
}
}
else if (template.Title == "Infobox Aufgabe")
{
string[] parametersToRemove =
{
"erfahrung", "münzen"
};
var removed = new List<string>();
foreach (var parameter in parametersToRemove)
{
if (template.Parameters.ContainsKey(parameter))
{
template.Parameters.Remove(parameter);
removed.Add(parameter);
}
}
if (removed.Any())
{
template.Save();
changes.Add("Infobox Aufgabe: '" + string.Join("', '", removed) + "' entfernt");
}
}
else if (template.Title == "Infobox Farbstoff")
{
string[] parametersToRemove =
{
"seltenheit"
};
var removed = new List<string>();
foreach (var parameter in parametersToRemove)
{
if (template.Parameters.ContainsKey(parameter))
{
template.Parameters.Remove(parameter);
removed.Add(parameter);
}
}
if (removed.Any())
{
template.Save();
changes.Add("Infobox Farbstoff: '" + string.Join("', '", removed) + "' entfernt");
}
}
}
//.........这里部分代码省略.........
开发者ID:knabbi,项目名称:GW2WBot,代码行数:101,代码来源:RemoveUeberfluessigeParameter.cs
注:本文中的DotNetWikiBot.Page类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论