本文整理汇总了C#中PageList类的典型用法代码示例。如果您正苦于以下问题:C# PageList类的具体用法?C# PageList怎么用?C# PageList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PageList类属于命名空间,在下文中一共展示了PageList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TestInitialize
public void TestInitialize()
{
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
{
Formatting = Formatting.None,
Converters = new JsonConverter[] { new JsonKnownTypeConverter() }
};
string jsonPageList = AssemblyResourceReader.ReadAsString("Test_Data.PageList.json");
this.pageList = JsonConvert.DeserializeObject<PageList>(jsonPageList);
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:10,代码来源:PageListTests.cs
示例2: Start
protected override void Start()
{
if(Pages.Any()) return;
var pl = new PageList(Site);
pl.FillAllFromCategoryTree("Kategorie:Schmuck");
Pages.AddRange(pl.ToEnumerable());
pl.FillAllFromCategoryTree("Kategorie:Rücken");
Pages.AddRange(pl.ToEnumerable());
}
开发者ID:knabbi,项目名称:GW2WBot,代码行数:12,代码来源:AufgestiegenerSchmuckJob.cs
示例3: GetAllPage
public static PageList GetAllPage()
{
if (s_PageCache == null)
{
lock (s_SyncObj)
{
string path = GetConfigPath();
s_PageCache = XmlHelper.LoadFromXmlCache<PageList>(path);
return s_PageCache;
}
}
else
return s_PageCache;
}
开发者ID:ZhouHengYi,项目名称:HFramework,代码行数:14,代码来源:PageConfig.cs
示例4: PageReplacementAlgorithm
/// <summary>
/// Creates a new instance of <see cref="PageReplacementAlgorithm"/>.
/// </summary>
/// <param name="pool">The memory pool that blocks will be allocated from.</param>
public PageReplacementAlgorithm(MemoryPool pool)
{
if (pool.PageSize < 4096)
throw new ArgumentOutOfRangeException("PageSize Must be greater than 4096", "pool");
if (!BitMath.IsPowerOfTwo(pool.PageSize))
throw new ArgumentException("PageSize Must be a power of 2", "pool");
m_maxValidPosition = (int.MaxValue - 1) * (long)pool.PageSize; //Max position
m_syncRoot = new object();
m_memoryPageSizeMask = pool.PageSize - 1;
m_memoryPageSizeShiftBits = BitMath.CountBitsSet((uint)m_memoryPageSizeMask);
m_pageList = new PageList(pool);
m_arrayIndexLocks = new WeakList<PageLock>();
}
开发者ID:GridProtectionAlliance,项目名称:openHistorian,代码行数:19,代码来源:PageReplacementAlgorithm.cs
示例5: Main
static void Main(string[] args)
{
foreach (var line in File.ReadLines("config.txt"))
{
var indexOfSep = line.IndexOf('=');
var key = line.Substring(0,indexOfSep).Trim();
var val = line.Substring(indexOfSep + 1).Trim();
if (key == "user") User = val;
if (key == "pass") Pass = val;
if (key == "apiAuthentication") ApiAuthentication = val;
}
if (string.IsNullOrEmpty(User) || string.IsNullOrEmpty(Pass) || string.IsNullOrEmpty(ApiAuthentication))
{
Console.WriteLine("Incomplete config");
return;
}
var statusApi = new StatusApi();
statusApi.SetStatus(false);
var s = new Site("http://wiki-de.guildwars2.com/wiki/", User, Pass);
if (args.Contains("-generatePagelist") || !File.Exists("pagelist.txt"))
{
Console.WriteLine("Generating pagelist...");
var pagelist = new PageList(s);
pagelist.FillFromCategoryTree("Guild Wars 2");
pagelist.SaveTitlesToFile("pagelist.txt");
}
try
{
Run(s);
}
finally
{
statusApi.SetStatus(false);
}
}
开发者ID:knabbi,项目名称:GW2WBot,代码行数:41,代码来源:Program.cs
示例6: GetLinks
/// <summary>Finds all internal wikilinks in page text, excluding interwiki
/// links, links to sister projects, categories, embedded images and links in
/// image descriptions.</summary>
/// <returns>Returns the PageList object, in which page titles are the wikilinks,
/// found in text.</returns>
public PageList GetLinks()
{
MatchCollection matches = Site.wikiLinkRE.Matches(text);
StringCollection exclLinks = new StringCollection();
exclLinks.AddRange(GetInterWikiLinks());
exclLinks.AddRange(GetSisterWikiLinks(true));
string str;
int fragmentPosition;
PageList pl = new PageList(site);
for(int i = 0; i < matches.Count; i++) {
str = matches[i].Groups[1].Value;
if (str.StartsWith(site.namespaces["6"] + ":", true, site.langCulture) ||
str.StartsWith(Site.wikiNSpaces["6"] + ":", true, site.langCulture) ||
str.StartsWith(site.namespaces["14"] + ":", true, site.langCulture) ||
str.StartsWith(Site.wikiNSpaces["14"] + ":", true, site.langCulture))
continue;
str = str.TrimStart(':');
if (exclLinks.Contains(str))
continue;
fragmentPosition = str.IndexOf("#");
if (fragmentPosition != -1)
str = str.Substring(0, fragmentPosition);
pl.Add(new Page(site, str));
}
return pl;
}
开发者ID:EmausWP,项目名称:SharpInterwiki,代码行数:31,代码来源:DotNetWikiBot.cs
示例7: GetMediaWikiMessage
/// <summary>Gets a specified MediaWiki message.</summary>
/// <param name="title">Title of the message.</param>
/// <returns>Returns raw text of the message.
/// If the message doesn't exist, exception is thrown.</returns>
public string GetMediaWikiMessage(string title)
{
if (string.IsNullOrEmpty(title))
throw new ArgumentNullException("title");
title = namespaces["8"].ToString() + ":" + Bot.Capitalize(RemoveNSPrefix(title, 8));
if (messages == null)
messages = new PageList(this);
else if (messages.Contains(title))
return messages[title].text;
string src;
try {
src = GetPageHTM(site + indexPath + "index.php?title=" +
HttpUtility.UrlEncode(title.Replace(" ", "_")) +
"&action=raw&usemsgcache=1&dontcountme=s");
}
catch (WebException e) {
if (e.Message.Contains(": (404) "))
throw new WikiBotException(
string.Format(Bot.Msg("MediaWiki message \"{0}\" was not found."), title));
else
throw;
}
if (string.IsNullOrEmpty(src)) {
throw new WikiBotException(
string.Format(Bot.Msg("MediaWiki message \"{0}\" was not found."), title));
}
messages.Add(new Page(this, title));
messages[messages.Count()-1].text = src;
return src;
}
开发者ID:EmausWP,项目名称:SharpInterwiki,代码行数:34,代码来源:DotNetWikiBot.cs
示例8: CompleteLogin
void CompleteLogin()
{
if (errorMessage != null)
{
MessageBox.Show(errorMessage);
loadingDialog.Hide();
Login();
return;
}
numLoadAheadPages = loginForm.MaxLoadAheadPages;
numCategoryPagesToRetrieve = loginForm.MaxCategoryPages;
randomizePageOrder = loginForm.RandomizeOrder;
loadPageListOnDemand = !randomizePageOrder;
pageList = new PageList(site);
pageListSource = loginForm.PageListSource;
pageListSourceValue = loginForm.PageListSourceValue;
if (loadPageListOnDemand)
{
// Actually just loading some of the list of pages, more will be loaded on-demand later
loadingDialog.Message = "Loading list of pages...";
}
else
{
loadingDialog.Message = "Loading list of pages (up to " + numCategoryPagesToRetrieve + ")...";
}
Thread fillFromCategoryThread = new Thread(new ThreadStart(delegate()
{
switch (pageListSource)
{
case PageListSource.category:
if (loadPageListOnDemand)
{
pageList.FillSomeFromCategoryEx(pageListSourceValue, ref pageListNext);
}
else
{
pageList.FillAllFromCategoryEx(pageListSourceValue, numCategoryPagesToRetrieve);
}
Invoke(new MethodInvoker(CompletePageListLoad));
break;
case PageListSource.file:
pageList.FillFromFile(pageListSourceValue);
Invoke(new MethodInvoker(CompletePageListLoad));
break;
default:
throw new ArgumentOutOfRangeException();
}
//pageList.FillFromFile("pages.txt"); // just for debugging to load up some pages
}));
fillFromCategoryThread.Start();
}
开发者ID:wikigit,项目名称:Persondata-o-matic,代码行数:54,代码来源:FormMain.cs
示例9: GetEmpty
/// <summary>
/// ����һ���յķ�ҳ�����
/// </summary>
/// <returns></returns>
public static PageList GetEmpty()
{
PageList p = new PageList();
p.Results = new ArrayList();
p.Current = 1;
p.RecordCount = 0;
return p;
}
开发者ID:jilumvc,项目名称:Sajoo,代码行数:12,代码来源:PageList.cs
示例10: FillSubsFromCategory
/// <summary>Gets subcategories titles for this PageList from specified wiki category page,
/// excluding other pages. Use FillFromCategory function to get other pages.</summary>
/// <param name="categoryName">Category name, with or without prefix.</param>
public void FillSubsFromCategory(string categoryName)
{
int count = pages.Count;
PageList pl = new PageList(site);
pl.FillAllFromCategory(categoryName);
pl.FilterNamespaces(new int[] {14});
pages.AddRange(pl.pages);
if (pages.Count != count)
Bot.LogEvent(Bot.Msg("PageList filled with {0} subcategory page titles, " +
"found in \"{1}\" category."), (pages.Count - count).ToString(), categoryName);
else
Console.Error.WriteLine(
Bot.Msg("Nothing was found in \"{0}\" category."), categoryName);
}
开发者ID:wikigit,项目名称:Picasa-Review-Bot,代码行数:17,代码来源:DotNetWikiBot.cs
示例11: GetMediaWikiMessagesEx
/// <summary>Gets all MediaWiki messages from "Special:Allmessages" page and dumps
/// them to HTM file.</summary>
/// <param name="forceLoad">If true, the messages are updated unconditionally. Otherwise
/// the messages are updated only if they are outdated.</param>
public void GetMediaWikiMessagesEx(bool forceLoad)
{
if (messages == null)
messages = new PageList(this);
string filePathName = "Cache" + Path.DirectorySeparatorChar +
HttpUtility.UrlEncode(site.Replace("://", ".")) + ".messages.htm";
if (forceLoad == true || !File.Exists(filePathName) ||
(DateTime.Now - File.GetLastWriteTime(filePathName)).Days > 90) {
Bot.LogEvent(Bot.Msg("Updating MediaWiki messages dump. Please, wait..."));
string res = site + indexPath + "index.php?title=Special:Allmessages";
File.WriteAllText(filePathName, GetPageHTM(res), Encoding.UTF8);
Bot.LogEvent(Bot.Msg("MediaWiki messages dump updated successfully."));
}
XmlDocument doc = new XmlDocument();
doc.XmlResolver = null;
string text = File.ReadAllText(filePathName, Encoding.UTF8).Replace(" ", " "); ;
doc.LoadXml(text);
XmlNodeList nl1 = doc.DocumentElement.SelectNodes(
".//ns:table[@id = 'allmessagestable']/ns:tr[@class = 'def' or @class = 'orig']/" +
"ns:td/ns:a/ns:span", xmlNS);
XmlNodeList nl2 = doc.DocumentElement.SelectNodes(
".//ns:table[@id = 'allmessagestable']/ns:tr[@class = 'def' or @class = 'new']/" +
"ns:td[last()]", xmlNS);
if (nl1.Count == 0 || nl1.Count != nl2.Count)
throw new WikiBotException(Bot.Msg("MediaWiki messages parsing failed."));
for (int i = 0; i < nl1.Count; i++) {
messages.Add(new Page(this, HttpUtility.HtmlDecode(nl1[i].InnerXml)));
messages[messages.Count()-1].text = HttpUtility.HtmlDecode(nl2[i].InnerXml.Trim());
}
}
开发者ID:wikigit,项目名称:Picasa-Review-Bot,代码行数:34,代码来源:DotNetWikiBot.cs
示例12: SingleSectionValid
public void SingleSectionValid()
{
ApplicationData applicationData = new ApplicationData
{
{ "text_field_one", string.Empty },
{ "text_field_three", "even more data" },
{ "text_field_two", string.Empty }
};
Application application = new Application(null, FORM_ID, null, null, applicationData);
PageList pagesToValidate = new PageList { this.product.FormDefinition.Pages.First() };
ValidationResults results = this.ApplicationManager.ValidateApplication(this.sessionData, application, pagesToValidate, this.product.FormDefinition.Pages.AllControls, 2);
Assert.IsTrue(results.IsValid);
}
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:14,代码来源:ApplicationManagerTests.cs
示例13: Revert
/// <summary>Undoes the last edit, so page text reverts to previous contents.
/// The function doesn't affect other operations like renaming.</summary>
/// <param name="comment">Revert comment.</param>
/// <param name="isMinorEdit">Minor edit mark (pass true for minor edit).</param>
public void Revert(string comment, bool isMinorEdit)
{
if (string.IsNullOrEmpty(title))
throw new WikiBotException(Bot.Msg("No title specified for page to revert."));
PageList pl = new PageList(site);
if (Bot.useBotQuery == true && site.botQuery == true &&
site.botQueryVersions.ContainsKey("ApiQueryRevisions.php"))
pl.FillFromPageHistoryEx(title, 2, false);
else
pl.FillFromPageHistory(title, 2);
if (pl.Count() != 2) {
Console.Error.WriteLine(Bot.Msg("Can't revert page \"{0}\"."), title);
return;
}
pl[1].Load();
Save(pl[1].text, comment, isMinorEdit);
Bot.LogEvent(Bot.Msg("Page \"{0}\" was reverted."), title);
}
开发者ID:wikigit,项目名称:Picasa-Review-Bot,代码行数:22,代码来源:DotNetWikiBot.cs
示例14: Main
public static int Main()
{
// Se registra en la página y configura el bot
Site welp = iniciar();
leerOpciones(Environment.GetCommandLineArgs());
if (welp == null)
return 1;
// Cuenta del número de ediciones
int cuenta = 0;
// Obtiene todos los trabajos (de momento en el espacio de nombre Principal)
PageList todas = new PageList(welp);
todas.FillFromAllPages("Trabajo:", 0, false, Int32.MaxValue, "Trabajo;");
foreach (Page pag in todas)
{
pag.Load();
// Si ya hay indicación de curso no hace nada
List<string> cats = pag.GetCategories();
if (cats.Exists(patronCCurso.IsMatch))
continue;
// Para averiguar el curso obtiene la fecha de la
// primera edición
PageList hist = new PageList(welp);
hist.FillFromPageHistory(pag.title, Int32.MaxValue);
DateTime fc = hist[hist.Count()-1].timestamp;
// Distingue en base a ella el curso
int año = fc.Year;
// Si es antes del 29 de septiembre (aprox) es que es
// del curso que empieza en el año anterior
if (fc.Month < 9 || fc.Month == 9 && fc.Day < 29)
año--;
string curso = "Curso " + año + "-" + (año + 1);
// Muestra información por consola
Console.Error.WriteLine("«" + pag.title + "» creado en " + fc + " => " + curso);
cuenta++;
if (!simulado) {
pag.AddToCategory(curso);
pag.Save("bot: categorización de trabajos por curso", true);
}
}
// Resumen de las operaciones
Console.Error.WriteLine("El bot " + (simulado ? "hubiera realizado " : "realizó ") + cuenta + " ediciones.");
return 0;
}
开发者ID:ningit,项目名称:wikielp-bots,代码行数:64,代码来源:Categorizador.cs
示例15: GetMediaWikiMessages
/// <summary>Gets all MediaWiki messages and dumps it to XML file.</summary>
/// <param name="forceLoad">If true, the messages are forced to be updated.</param>
public void GetMediaWikiMessages(bool forceLoad)
{
if (forceLoad == false)
messages = new PageList(this);
string filePathName = "Cache/" + HttpUtility.UrlEncode(site.Replace('/','_').Replace(':','_'))+ ".xml";
if (forceLoad == false && File.Exists(filePathName) &&
(DateTime.Now - File.GetLastWriteTime(filePathName)).Days <= 90) {
messages.FillAndLoadFromXMLDump(filePathName);
return;
}
Console.WriteLine("Updating MediaWiki messages dump. Please, wait...");
PageList pl = new PageList(this);
pl.FillFromAllPages("!", 8, false, 10000);
File.Delete(filePathName);
pl.SaveXMLDumpToFile(filePathName);
Console.WriteLine("MediaWiki messages dump updated successfully.");
messages.FillAndLoadFromXMLDump(filePathName);
}
开发者ID:BackupTheBerlios,项目名称:wikifighter-svn,代码行数:21,代码来源:DotNetWikiBot.cs
示例16: UploadOriginalVersion
private static bool UploadOriginalVersion(out string failureReason, Page page, string mediaUrl,
string wikiImageFilename, string picasaImageFilename,
bool fetchThumbnailVersion, bool allowWikiBigger)
{
// if (!wikiImageFilename.ToLower().EndsWith(".jpg") && !wikiImageFilename.ToLower().EndsWith(".jpeg") &&
// !wikiImageFilename.ToLower().EndsWith(".png"))
// {
// failureReason = "Cannot compare non-bitmap files to original source - requires manual validation";
// return false;
// }
failureReason = null;
Bitmap wikiBitmap = new Bitmap(wikiImageFilename);
// First have the Picasa server resize to the desired size - this will
// ensure exactly the same resizing algorithm is used.
string thumbnailUrl =
new Regex("^(.*)/([^/]*)$").Replace(mediaUrl, "${1}/s" + wikiBitmap.Width + "/${2}");
string filename = "temp_picasa_image";
if (!fetchThumbnailVersion || !WgetToFile(thumbnailUrl, filename))
{
filename = picasaImageFilename;
}
Bitmap picasaBitmap = new Bitmap(filename);
if (wikiBitmap.Width < picasaBitmap.Width ||
wikiBitmap.Height < picasaBitmap.Height)
{
// Couldn't get version of same size from server - stretch to fit
Bitmap newPicasaBitmap = new Bitmap(picasaBitmap, wikiBitmap.Width, wikiBitmap.Height);
picasaBitmap.Dispose();
picasaBitmap = newPicasaBitmap;
}
bool wikiBitmapIsBigger = false;
if (wikiBitmap.Width >= picasaBitmap.Width ||
wikiBitmap.Height >= picasaBitmap.Height)
{
if (allowWikiBigger)
{
wikiBitmapIsBigger = true;
Bitmap newWikiBitmap = new Bitmap(wikiBitmap, picasaBitmap.Width, picasaBitmap.Height);
wikiBitmap.Dispose();
wikiBitmap = newWikiBitmap;
}
else
{
// Wiki version is bigger, something odd going on, skip it
wikiBitmap.Dispose();
picasaBitmap.Dispose();
failureReason = "license matches and is valid - but Commons version is of a different size than the Picasa version, may have been edited locally";
return false;
}
}
double avgDiff = ImagesMeanSquareDifference(wikiBitmap, picasaBitmap);
wikiBitmap.Dispose();
picasaBitmap.Dispose();
if (avgDiff >= 0.032 && avgDiff < 0.10)
{
failureReason = "license matches and is valid - but Picasa and Commons image were not a close enough match";
return false;
}
else if (avgDiff < 0.032)
{
// Got an approximate match, need to upload the full-size version
// (unless we've done so before and were reverted)
PageList pageHistory = new PageList(page.site);
pageHistory.FillFromPageHistory(page.title, int.MaxValue);
bool alreadyUploaded = false;
foreach (Page revision in pageHistory)
{
if (revision.lastUser == username && revision.comment.Contains("uploaded a new version"))
{
alreadyUploaded = true;
}
}
if (!alreadyUploaded && !wikiBitmapIsBigger)
{
string saveText = page.text;
page.UploadImage(picasaImageFilename,
"Uploading version from source, revert me if incorrect",
"", "", "");
// Set back to current wikitext
page.Load();
page.text = saveText;
}
return true;
}
else
{
failureReason = "license matches and is valid - but Picasa and Commons image do not match";
return false;
}
}
开发者ID:wikigit,项目名称:Picasa-Review-Bot,代码行数:100,代码来源:Program.cs
示例17: Main
static void Main(string[] args)
{
username = args[0];
password = args[1];
Bot.unsafeHttpHeaderParsingUsed = 0;
Site site = new Site(wikiSiteUrl, username, password);
while (true)
{
int totalPagesProcessed = 0;
try
{
PageList pageList = new PageList(site);
#if true
if (catScanning != null)
pageList.FillFromCategory(catScanning);
else
pageList.FillFromSearchResults(searchScanning, int.MaxValue);
#endif
string failureReason = null;
foreach (Page page in pageList)
{
if (resumeAfter != null)
{
if (page.title == resumeAfter) resumeAfter = null;
continue;
}
totalPagesProcessed++;
if (!page.title.StartsWith("File:"))
{
continue;
}
while (true)
{
try
{
page.Load();
if (tagCompletedRegex.Match(page.text).Success)
{
break;
}
if (!tagRegex.Match(page.text).Success &&
!page.text.ToLower().Contains("{{picasareviewunnecessary}}") &&
!page.text.ToLower().Contains("user:picasa review bot/reviewed-error"))
{
Regex licenseReviewRegex = new Regex("{{LicenseReview\\|[^|]*\\|([^|]*)\\|([^}]*)}}");
Match m;
if ((m = licenseReviewRegex.Match(page.text)).Success)
{
page.text = licenseReviewRegex.Replace(page.text, "{{picasareview|" + m.Groups[1].ToString() + "|" + m.Groups[2].ToString() + "}}");
SavePage(page, "Converting old LicenseReview tag into picasareview tag");
break;
}
else
{
page.text += "\n{{picasareview}}\n";
}
}
bool success = false;
do
{
File.Delete("temp_wiki_image");
File.Delete("temp_picasa_image");
File.Delete("temp_picasa_image_full");
string licenseName, mediaUrl;
bool reviewUnnecessary = false;
if (CheckIfReviewUnnecessary(page))
{
// Keep running so we can upload the original version, break out later
// (unless it has an OTRS tag, in which case we shouldn't raise the resolution,
// or is Flickr reviewed, in which case only a lower-resolution version may
// be released on Flickr)
reviewUnnecessary = true;
success = true;
if (HasOtrsTag(page) || IsFlickrReviewed(page)) continue;
}
if (!page.title.ToLower().EndsWith(".jpg") && !page.title.ToLower().EndsWith(".png") && !page.title.ToLower().EndsWith(".tiff"))
{
failureReason = "can only review image files, not other file types";
continue;
}
if (!FetchPicasaImageInfo(page, out licenseName, out mediaUrl))
{
failureReason = "could not retrieve image information from Picasa";
continue;
}
if (!reviewUnnecessary && !CheckLicense(page, licenseName))
{
failureReason = "image license on Picasa is invalid";
continue;
//.........这里部分代码省略.........
开发者ID:wikigit,项目名称:Picasa-Review-Bot,代码行数:101,代码来源:Program.cs
示例18: ShufflePageList
private static void ShufflePageList(Random r, PageList list)
{
for (int i = list.Count() - 1; i >= 1; i--)
{
int j = r.Next(0, i + 1);
Page temp = list[j];
list[j] = list[i];
list[i] = temp;
}
}
开发者ID:wikigit,项目名称:Persondata-o-matic,代码行数:10,代码来源:FormMain.cs
示例19: GetMediaWikiMessages
/// <summary>Gets all MediaWiki messages from "Special:Allmessages" page and loads them into
/// site.messages PageList. The function is not backward compatible.</summary>
public void GetMediaWikiMessages()
{
if (messages == null)
messages = new PageList(this);
Console.WriteLine(Bot.Msg("Updating MediaWiki messages dump. Please, wait..."));
string res = site + indexPath + "index.php?title=Special:Allmessages";
string src = "";
Page p = null;
Regex nextPortionRE = new Regex("offset=([^\"]+)\" title=\"[^\"]+\" rel=\"next\"");
do {
src = GetPageHTM(res + (src != ""
? "&offset=" + HttpUtility.HtmlDecode(nextPortionRE.Match(src).Groups[1].Value)
: "&limit=5000"));
using (XmlReader reader = GetXMLReader(src)) {
reader.ReadToFollowing("tbody");
while (reader.Read()) {
if (reader.Name == "tr" && reader.NodeType == XmlNodeType.Element &&
reader["id"] != null)
p = new Page(this, namespaces["8"].ToString() + ":" +
Bot.Capitalize(reader["id"].Replace("msg_", "")));
else if (reader.Name == "td" &&
(reader["class"] == "am_default" || reader["class"] == "am_actual"))
p.text = reader.ReadString();
else if (reader.Name == "tr" && reader.NodeType == XmlNodeType.EndElement)
messages.Add(p);
else if (reader.Name == "tbody" &&
reader.NodeType == XmlNodeType.EndElement)
break;
}
}
} while (nextPortionRE.IsMatch(src));
if (p != null)
messages.Add(p);
Console.WriteLine(Bot.Msg("MediaWiki messages dump updated successfully."));
}
开发者ID:EmausWP,项目名称:SharpInterwiki,代码行数:37,代码来源:DotNetWikiBot.cs
示例20: GetNavStructures
/// <summary>
/// Returns a navigational structures for a book. This is based on the ncx.xml file.
/// </summary>
/// <param name="bookId"></param>
/// <param name="toc"></param>
/// <param name="pageList"></param>
/// <returns></returns>
public void GetNavStructures(string bookId, out TableOfContents toc, out PageList pageList)
{
toc = null;
pageList = null;
// Get the dtbook xml
IDirectory bookDirectory = GetBookFolder(bookId);
IList<IFile> ncxFile = bookDirectory.GetFiles(GetPackage(bookId).NcxXmlPath);
if (ncxFile.Count == 1)
{
// Set the Xml on the TOC. All other properties are derived from this.
XDocument tocXml = XDocument.Load(ncxFile[0].Open(FileMode.Open, FileAccess.Read, FileShare.Read));
toc = new TableOfContents(tocXml);
pageList = new PageList(tocXml);
}
// It's OK not to have a TOC. Let the null get returned if no ncxFile found.
}
开发者ID:jmbe,项目名称:buttercup-swedish,代码行数:25,代码来源:DataContext.cs
注:本文中的PageList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论