本文整理汇总了C#中Chapter类的典型用法代码示例。如果您正苦于以下问题:C# Chapter类的具体用法?C# Chapter怎么用?C# Chapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Chapter类属于命名空间,在下文中一共展示了Chapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例6: TrajectorySubParser_
public TrajectorySubParser_(Chapter chapter, Scene scene)
: base(chapter)
{
this.trajectory = new Trajectory();
//scene.setTrajectory(trajectory);
this.scene = scene;
}
示例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);
}
}
示例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();
}
示例9: Add
public Chapter Add(Chapter chapterToAdd)
{
this.chapterRepository.Add(chapterToAdd);
this.chapterRepository.Save();
return chapterToAdd;
}
示例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;
}
示例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]);
}
示例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;
}
示例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;
}
示例14: Add
internal void Add(Chapter chapter)
{
if (_downloading.Contains(chapter))
return;
var copy = _downloading.ToList();
copy.Add(chapter);
_downloading = copy;
}
示例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();
}