本文整理汇总了C#中Chapter类的典型用法代码示例。如果您正苦于以下问题:C# Chapter类的具体用法?C# Chapter怎么用?C# Chapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Chapter类属于命名空间,在下文中一共展示了Chapter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Page
internal Page(Chapter a_chapter, string a_url, int a_index, ulong a_id, string a_name, byte[] a_hash,
string a_image_file_path, PageState a_state) : base(a_id)
{
Hash = a_hash;
ImageFilePath = a_image_file_path;
m_state = a_state;
Chapter = a_chapter;
URL = HtmlDecode(a_url);
Index = a_index;
if (State == PageState.Downloading)
m_state = PageState.Initial;
if (State == PageState.Waiting)
m_state = PageState.Initial;
if (a_name != "")
{
a_name = a_name.Trim();
a_name = a_name.Replace("\t", " ");
while (a_name.IndexOf(" ") != -1)
a_name = a_name.Replace(" ", " ");
a_name = HtmlDecode(a_name);
Name = FileUtils.RemoveInvalidFileCharacters(a_name);
}
else
Name = Index.ToString();
}
开发者ID:KebinuChiousu,项目名称:MangaCrawler,代码行数:28,代码来源:Page.cs
示例2: DownloadPages
internal override IEnumerable<Page> DownloadPages(Chapter a_chapter)
{
HtmlDocument doc = DownloadDocument(a_chapter);
var pages = doc.DocumentNode.SelectNodes("//select[@name='pagejump']/option");
var result = new List<Page>();
int index = 0;
foreach (var page in pages)
{
index++;
string link = a_chapter.URL;
int page_index = link.LastIndexOf("/page");
link = link.Left(page_index + 5);
link += page.GetAttributeValue("Value", "") + ".html";
Page pi = new Page(a_chapter, link, index, "");
result.Add(pi);
}
if (result.Count == 0)
throw new Exception("Chapter has no pages");
return result;
}
开发者ID:KebinuChiousu,项目名称:MangaCrawler,代码行数:28,代码来源:MangaShareCrawler.cs
示例3: ddlChapters_DataBound
protected void ddlChapters_DataBound(object sender, EventArgs e)
{
//get right chapter by ID taken from ddlChapters.SelectedValue
chap = chap.GetById(new Guid(ddlChapters.SelectedValue));
//call loadChapterContent
loadChapterContent(chap.Title, chap.ChapterContent);
}
开发者ID:bwaites,项目名称:fanatafics,代码行数:7,代码来源:EditChapters.aspx.cs
示例4: DownloadPages
internal override IEnumerable<Page> DownloadPages(Chapter a_chapter)
{
HtmlDocument doc = DownloadDocument(a_chapter);
List<Page> result = new List<Page>();
var top_center_bar = doc.DocumentNode.SelectSingleNode("//div[@id='top_center_bar']");
var pages = top_center_bar.SelectNodes("div[@class='r m']/div[@class='l']/select[@class='m']/option");
int index = 1;
foreach (var page in pages)
{
if (page.NextSibling != null)
{
if (page.NextSibling.InnerText == "Comments")
continue;
}
Page pi = new Page(
a_chapter,
a_chapter.URL.Replace("1.html", String.Format("{0}.html", page.GetAttributeValue("value", ""))),
index,
"");
index++;
result.Add(pi);
}
if (result.Count == 0)
throw new Exception("Chapter has no pages");
return result;
}
开发者ID:KebinuChiousu,项目名称:MangaCrawler,代码行数:35,代码来源:MangaFoxCrawler.cs
示例5: GetChapters
public IEnumerable<IChapter> GetChapters()
{
List<Chapter> retVal = new List<Chapter>();
string content = Utility.GetContent(url);
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(content);
doc.DocumentNode.SelectNodes("//table[@id=\"listing\"]//tr")
.Skip(1)
.ToList()
.ForEach(ch =>
{
Chapter chapter = new Chapter
{
Number = getNumber(ch),
Title = getName(ch),
Uri = getUrl(ch)
};
retVal.Add(chapter);
});
return retVal;
}
开发者ID:vgdagpin,项目名称:MangaAPI,代码行数:25,代码来源:MangaReader.cs
示例6: TrajectorySubParser_
public TrajectorySubParser_(Chapter chapter, Scene scene)
: base(chapter)
{
this.trajectory = new Trajectory();
//scene.setTrajectory(trajectory);
this.scene = scene;
}
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:7,代码来源:TrajectorySubParser_.cs
示例7: Init
// Use this for initialization
public override void Init()
{
go = GameObject.Find("Pinball(Clone)");
if(go == null)
{
go = GameObject.Instantiate(Resources.Load("Prefabs/States/Pinball")) as GameObject;
thisChapter = StateChapterSelect.Instance.Chapters[ID];
m_PinballMono = go.GetComponent<PinballMono>();
for (int i = 0; i < m_PinballMono.Levels.Length; i++)
{
m_PinballMono.Levels[i].SetActive(i == StateChapterSelect.Instance.Chapters[ID].LevelNumber);
}
if(thisChapter.Completed) return;
if(ID == 0)
{
SetBucketPositions();
}
else
{
RandomizeBucketPosition();
}
m_PinballMono.SetFrameParent(true);
m_PinballMono.SetCannonState(true);
}
}
开发者ID:PaulElmo,项目名称:Listen_In-Backup-,代码行数:33,代码来源:StatePinball.cs
示例8: Page
internal Page(Chapter a_chapter, string url, int index, ulong id, string name, byte[] hash,
string imageFilePath, PageState pageState) : base(id)
{
Hash = hash;
ImageFilePath = imageFilePath;
_pageState = pageState;
Chapter = a_chapter;
URL = HtmlDecode(url);
Index = index;
if (State == PageState.Downloading)
_pageState = PageState.Initial;
if (State == PageState.Waiting)
_pageState = PageState.Initial;
if (name != "")
{
name = name.Trim();
name = name.Replace("\t", " ");
while (name.IndexOf(" ") != -1)
name = name.Replace(" ", " ");
name = HtmlDecode(name);
Name = FileUtils.RemoveInvalidFileCharacters(name);
}
else
Name = Index.ToString();
}
开发者ID:tundy,项目名称:MangaCrawler,代码行数:28,代码来源:Page.cs
示例9: Add
public Chapter Add(Chapter chapterToAdd)
{
this.chapterRepository.Add(chapterToAdd);
this.chapterRepository.Save();
return chapterToAdd;
}
开发者ID:newmast,项目名称:Steep,代码行数:7,代码来源:ChapterService.cs
示例10: GetPages
internal override IPage[] GetPages(Chapter chapter, string mangaPageHtml)
{
var document = Parser.Parse(mangaPageHtml);
var listNode = document.QuerySelectorAll("ul.dropdown-menu")[2];
var linksNodes = listNode.QuerySelectorAll("a");
var output = linksNodes.Select((d, e) => new Page(chapter, new Uri(d.Attributes["href"].Value), e + 1)).ToArray();
return output;
}
开发者ID:albertofustinoni,项目名称:MangaScrapeLib,代码行数:8,代码来源:MangaStreamRepository.cs
示例11: AddShouldBeAbleToAddChapter
public void AddShouldBeAbleToAddChapter()
{
Chapter chapter = new Chapter() { Title = "Chapter 1", Duration = TimeSpan.FromSeconds(30) };
this.list.Add(chapter);
Assert.AreEqual(1, this.list.Count);
Assert.AreEqual("Chapter 1", this.list[0].Title);
Assert.AreEqual(TimeSpan.FromSeconds(30), this.list[0].Duration);
Assert.AreEqual(chapter, this.list[0]);
}
开发者ID:TorMueller,项目名称:knuckleball,代码行数:9,代码来源:ChapterListTests.cs
示例12: Add
internal void Add(Chapter a_chapter)
{
if (m_downloading.Contains(a_chapter))
return;
var copy = m_downloading.ToList();
copy.Add(a_chapter);
m_downloading = copy;
}
开发者ID:KebinuChiousu,项目名称:MangaCrawler,代码行数:9,代码来源:Downloading.cs
示例13: GetPages
internal override IPage[] GetPages(Chapter chapter, string mangaPageHtml)
{
var document = Parser.Parse(mangaPageHtml);
var selectNode = document.QuerySelector("select#pageSelect");
var options = selectNode.QuerySelectorAll("option");
var output = options.Select((d, e) => new Page(chapter, new Uri(RootUri, d.Attributes["value"].Value), e + 1)).ToArray();
return output;
}
开发者ID:albertofustinoni,项目名称:MangaScrapeLib,代码行数:9,代码来源:MangaEdenRepository.cs
示例14: Add
internal void Add(Chapter chapter)
{
if (_downloading.Contains(chapter))
return;
var copy = _downloading.ToList();
copy.Add(chapter);
_downloading = copy;
}
开发者ID:tundy,项目名称:MangaCrawler,代码行数:9,代码来源:Downloading.cs
示例15: GetPages
internal override IPage[] GetPages(Chapter Chapter, string MangaPageHtml)
{
var Document = Parser.Parse(MangaPageHtml);
var Node = Document.QuerySelector("#pages");
var Nodes = Node.QuerySelectorAll("option");
var Output = Nodes.Select((d, e) => new Page(Chapter, new Uri(RootUri, d.Attributes["value"].Value), e + 1)).OrderBy(d => d.PageNo);
return Output.ToArray();
}
开发者ID:albertofustinoni,项目名称:MangaScrapeLib,代码行数:10,代码来源:EatMangaRepository.cs
示例16: DownloadPages
internal override IEnumerable<Page> DownloadPages(Chapter chapter)
{
//var doc = DownloadDocument(chapter, chapter.URL + "/page/1");
//var doc = DownloadDocument(chapter);
var doc = new HtmlDocument();
//var h = new HttpDownloader(chapter.URL, null, null);
//doc.OptionReadEncoding = false;
var request = (HttpWebRequest)WebRequest.Create(chapter.URL);
request.Method = "GET";
//request.TransferEncoding = "utf-8";
using (var response = (HttpWebResponse)request.GetResponse())
{
using (var stream = response.GetResponseStream())
{
if (stream != null && stream.CanRead)
{
var stremReader = new StreamReader(stream/*, Encoding.UTF8*/);
doc.LoadHtml(stremReader.ReadToEnd());
}
}
}
var result = new List<Page>();
/*var test = document;
return result;*/
/*if (!string.IsNullOrEmpty(document))
{
var byteArray = Encoding.UTF8.GetBytes(document);
var stream = new MemoryStream(byteArray);
doc.Load(stream, Encoding.UTF8);
}*/
var topbar_right = doc.DocumentNode.SelectSingleNode("//div[@class='topbar_right']");
//var title = (from tag in topbar_right.SelectNodes("./div") where tag.Attributes.Contains("class") && tag.Attributes["class"].Value.Contains("tbtitle") select tag).First();
var title = topbar_right.SelectSingleNode("./div[contains(@class, 'tbtitle dropdown_parent')]");
//return null;
var pagesString = title.SelectSingleNode("./div[@class='text']").InnerHtml;
var pages = Convert.ToInt32(pagesString.Substring(0, pagesString.IndexOf(' ')));
for (var i = 0; i < pages; i++)
{
result.Add(new Page(chapter, chapter.URL + "/page/" + (i+1), i+1, ""));
}
if (result.Count == 0)
throw new Exception("Chapter has no pages");
return result;
}
开发者ID:tundy,项目名称:MangaCrawler,代码行数:54,代码来源:YoMangaCrawler.cs
示例17: GetPages
internal override IPage[] GetPages(Chapter Chapter, string MangaPageHtml)
{
var Document = Parser.Parse(MangaPageHtml);
var Node = Document.QuerySelector("section.readpage_top");
Node = Node.QuerySelector("span.right select");
var Nodes = Node.QuerySelectorAll("option");
var Output = Nodes.Select((d, e) => new Page(Chapter, new Uri(RootUri, d.Attributes["value"].Value), e + 1));
return Output.ToArray();
}
开发者ID:albertofustinoni,项目名称:MangaScrapeLib,代码行数:11,代码来源:MangaHereRepository.cs
示例18: getReviews
protected void getReviews(HiddenField hidnValue, HyperLink hlReviews)
{
Guid storyID = new Guid();
storyID = new Guid(hidnValue.Value);
Guid chapID = new Guid();
Chapter chap = new Chapter();
chap = chap.GetFirstByStoryID(storyID);
chapID = chap.Id;
String navUrl = "~/ReviewsPage.aspx?ChapterID=" + chapID + "&StoryID=" + storyID;
hlReviews.NavigateUrl = navUrl;
}
开发者ID:bwaites,项目名称:fanatafics,代码行数:11,代码来源:UserPage.aspx.cs
示例19: ddlChapters_SelectedIndexChanged
protected void ddlChapters_SelectedIndexChanged(object sender, EventArgs e)
{
//if statement that will run if ddlChapters selected index is greater or equal to zero
if (ddlChapters.SelectedIndex >= 0)
{
//get chapter from Id taken from ddlChapters
chap = chap.GetById(new Guid(this.ddlChapters.SelectedValue));
//call loadChapterContent, passing in the chap Title and ChapterContent
loadChapterContent(chap.Title, chap.ChapterContent);
}
}
开发者ID:bwaites,项目名称:fanatafics,代码行数:11,代码来源:EditChapters.aspx.cs
示例20: GetPages
internal override IPage[] GetPages(Chapter chapter, string mangaPageHtml)
{
var document = Parser.Parse(mangaPageHtml);
var selectorNode = document.QuerySelector("select#page-dropdown");
var optionNodes = selectorNode.QuerySelectorAll("option");
var chaptersRootUri = chapter.FirstPageUri.ToString();
chaptersRootUri = chaptersRootUri.Substring(0, chaptersRootUri.LastIndexOf("/"));
var output = optionNodes.Select((d, e) => new Page(chapter, new Uri(string.Format("{0}/{1}", chaptersRootUri, d.TextContent.Trim())), e + 1)).ToArray();
return output;
}
开发者ID:albertofustinoni,项目名称:MangaScrapeLib,代码行数:12,代码来源:MyMangaRepository.cs
注:本文中的Chapter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论