Exemple #1
0
        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);
        }
Exemple #2
0
        /// <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();
                System.Threading.Thread.Sleep((int)(sleepSeconds * 1000));
            }
            base.Run(runChildren);
        }
Exemple #3
0
 public override void Run(bool runChildren)
 {
     try
     {
         RawlerBase rawler = (RawlerBase)System.Xaml.XamlServices.Load(FileName);
         rawler.SetParent(this);
         rawler.Run();
     }
     catch (Exception ex)
     {
         ReportManage.ErrReport(this, ex.ToString());
     }
 }
Exemple #4
0
        /// <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);
        }
Exemple #5
0
 /// <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);
     }
 }
Exemple #6
0
        /// <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();
                    }
                }
            }
        }
Exemple #7
0
 /// <summary>
 /// 最初に挿入する。
 /// </summary>
 /// <param name="rawler"></param>
 public void AddFirst(RawlerBase rawler)
 {
     children.Insert(0, rawler);
     rawler.SetParent(this);
 }
Exemple #8
0
 /// <summary>
 /// 子を追加する。
 /// </summary>
 /// <param name="rawler"></param>
 public void AddChildren(RawlerBase rawler)
 {
     children.Add(rawler);
     rawler.SetParent(this);
 }