public static string GetText(string text, RawlerBase rawler, RawlerBase parent) { Document doc = new Document(); doc.SetText(text); if (parent != null) { doc.SetParent(parent); } rawler.SetParent(doc); rawler.SetParent(); var last = rawler.GetDescendantRawler().Last(); rawler.Run(); return(last.Text); }
/// <summary> /// このクラスでの実行すること。 /// </summary> /// <param name="runChildren"></param> public override void Run(bool runChildren) { var page = this.GetAncestorRawler().OfType <Page>().FirstOrDefault(); if (page != null) { if (tmpUrl == page.GetCurrentUrl()) { tmpCount++; if (tmpCount >= reloadCount) { ReportManage.ErrReport(this, "ReloadCount:規定数のリロード回数を超えました。"); OverCountTree.SetParent(this); OverCountTree.Run(); return; } } else { tmpUrl = page.GetCurrentUrl(); tmpCount = 0; } page.Reload(); Task.Delay((int)(sleepSeconds * 1000)).Wait(); } base.Run(runChildren); }
public override void Run(bool runChildren) { try { RawlerBase rawler = (RawlerBase)XamlServices.Load(FileName.Convert(this)); rawler.SetParent(this); rawler.Run(); } catch (Exception ex) { ReportManage.ErrReport(this, ex.ToString()); } }
/// <summary> /// クローンを作る /// </summary> /// <param name="parent"></param> /// <returns></returns> public virtual RawlerBase Clone(RawlerBase parent) { RawlerBase clone = new RawlerBase(); RawlerLib.ObjectLib.FildCopy(this, clone); clone.SetParent(parent); CloneEvent(clone); clone.Children.Clear(); foreach (var item in this.Children) { var child = item.Clone(clone); clone.AddChildren(child); } return(clone); }
/// <summary> /// PreTreeを通したあとのText /// </summary> /// <returns></returns> protected string GetText() { if (this.Parent != null) { if (preTree != null) { preTree.SetParent(); return(RawlerBase.GetText(this.Parent.Text, PreTree, this.Parent)); } else { return(this.Parent.Text); } } else { return(this.text); } }
/// <summary> /// このクラスでの実行すること。 /// </summary> /// <param name="runChildren"></param> public override void Run(bool runChildren) { var data = this.GetAncestorRawler().OfType <Data>().FirstOrDefault(); if (data != null) { if (data.GetCurrentDataRow().DataDic.Count >= MinAttributeCount) { base.Run(runChildren); } else { if (FailedTree != null) { FailedTree.SetParent(this); FailedTree.Run(); } } } }
/// <summary> /// 最初に挿入する。 /// </summary> /// <param name="rawler"></param> public void AddFirst(RawlerBase rawler) { children.Insert(0, rawler); rawler.SetParent(this); }
/// <summary> /// 子を追加する。 /// </summary> /// <param name="rawler"></param> public void AddChildren(RawlerBase rawler) { children.Add(rawler); rawler.SetParent(this); }