Beispiel #1
0
        public override void Run(bool runChildren)
        {
            currentDataRow = new DataRowObject();
            SetText(GetText());
            base.Run(runChildren);
            if (file == null)
            {
                file = this.GetUpperRawler <File>();
                if (file == null)
                {
                    ReportManage.ErrUpperNotFound <File>(this);
                    return;
                }
            }

            if (MustAttributes.IsNullOrEmpty() == false)
            {
                var must = MustAttributes.Split(',');
                if (currentDataRow.Attributes.Intersect(must).Count() == must.Count())
                {
                    if (SaveType == FileType.Ltsv)
                    {
                        file.WriteLine(currentDataRow.ToLtsv());
                    }
                    else
                    {
                        file.WriteLine(currentDataRow.DataDic.Select(n => n.Value.JoinText(",")).JoinText("\t"));
                    }
                }
            }
            else
            {
                if (SaveType == FileType.Ltsv)
                {
                    file.WriteLine(currentDataRow.ToLtsv());
                }
                else
                {
                    file.WriteLine(currentDataRow.DataDic.Select(n => n.Value.JoinText(",")).JoinText("\t"));
                }
            }
            if (currentDataRow.IsDataNull())
            {
                if (EmptyTree != null)
                {
                    EmptyTree.SetParent(this);
                    EmptyTree.Run();
                }
            }
        }
Beispiel #2
0
 public override void Run(bool runChildren)
 {
     if (hash == null)
     {
         hash = this.GetUpperRawler <HashSet>();
         if (hash == null)
         {
             ReportManage.ErrUpperNotFound <HashSet>(this);
             return;
         }
     }
     hash.AddHash(GetText());
     base.Run(runChildren);
 }
Beispiel #3
0
 public override void Run(bool runChildren)
 {
     SetText(GetText());
     if (hash == null)
     {
         hash = this.GetUpperRawler <HashSet>();
         if (hash == null)
         {
             ReportManage.ErrUpperNotFound <HashSet>(this);
             return;
         }
     }
     if (hash.CheckContains(GetText()) == Result)
     {
         base.Run(runChildren);
     }
 }
Beispiel #4
0
        public override void RunBatch(IEnumerable <string> list)
        {
            var login = this.GetUpperRawler <TwitterLogin>();

            if (login == null)
            {
                ReportManage.ErrUpperNotFound <TwitterLogin>(this);
            }
            string[] list1 = null;
            bool     flag  = true;

            do
            {
                flag = true;
                try
                {
                    if (ParentUserIdType == ParentUserIdType.ScreenName)
                    {
                        var l = login.Token.Users.Lookup(list);
                        list1 = l.Select(n => Codeplex.Data.DynamicJson.Serialize(n)).ToArray();
                    }
                    else
                    {
                        long[] longList = null;
                        try
                        {
                            longList = list.Select(n => long.Parse(n)).ToArray();
                        }
                        catch (Exception ex)
                        {
                            ReportManage.ErrReport(this, "tweetIdが数値ではありません。" + ex.Message + "\t" + list.JoinText(","));
                        }
                        var l = login.Token.Users.Lookup(longList);
                        list1 = l.Select(n => Codeplex.Data.DynamicJson.Serialize(n)).ToArray();
                    }
                }
                catch (Exception ex1)
                {
                    ReportManage.ErrReport(this, ex1.Message);
                    flag = false;
                    System.Threading.Thread.Sleep(TimeSpan.FromMinutes(3));
                }
            } while (flag);
            base.RunBatch(list1);
        }
Beispiel #5
0
        public override void Run(bool runChildren)
        {
            var p = this.GetUpperRawler <PalallelReadFile>();

            string[] l;
            if (p == null)
            {
                ReportManage.ErrUpperNotFound <PalallelReadFile>(this);
            }
            while (true)
            {
                l = p.ReadLines();
                if (l == null)
                {
                    break;
                }
                RunChildrenForArray(true, l);
            }
        }
Beispiel #6
0
        public override void Run(bool runChildren)
        {
            var queue = this.GetUpperRawler <ParallelQueue>();

            if (queue != null)
            {
                var deqeue = queue.Dequeue();
                while (deqeue != null)
                {
                    SetText(deqeue);
                    base.Run(runChildren);
                    deqeue = queue.Dequeue();
                }
                LoopEndEvent?.Invoke(this, EventArgs.Empty);
            }
            else
            {
                ReportManage.ErrUpperNotFound <ParallelQueue>(this);
            }
        }
Beispiel #7
0
        public override void Run(bool runChildren)
        {
            var file = this.GetUpperRawler <File>();

            if (file != null)
            {
                if (string.IsNullOrEmpty(Line))
                {
                    file.WriteLine(GetText());
                }
                else
                {
                    file.WriteLine(Line.Convert(this));
                }
            }
            else
            {
                ReportManage.ErrUpperNotFound <File>(this);
            }
            base.Run(runChildren);
        }