示例#1
0
 public void addDocument(string text, RawlerBase rawlerTree)
 {
     var d = new Document();
     d.SetText(text);
     d.SetParent(this);
     var tree = rawlerTree.Clone();
     d.AddChildren(tree);
     documents.Add(d);
 }
示例#2
0
        public void addDocument(string text, ICollection<RawlerBase> rawlerTrees)
        {
            var d = new Document();
            d.SetText(text);
            d.SetParent(this);
            foreach (var item in rawlerTrees)
            {
                var tree = item.Clone();
                d.AddChildren(tree);
            }

            documents.Add(d);
        }
示例#3
0
        /// <summary>
        /// このクラスでの実行すること。
        /// </summary>
        /// <param name="runChildren"></param>
        public override void Run(bool runChildren)
        {
            var login = this.GetAncestorRawler().OfType<TwitterLogin>().First();
            bool flag = true;
             Dictionary<string, object> dic = new Dictionary<string, object>();
            string track;
            if(TrackTree !=null)
            {
                TrackTree.SetParent(this);
                track = RawlerBase.GetText(GetText(), TrackTree,this);
            }
            else
            {
                track = Track;
            }
                dic.Add("track",track);
            var stream = login.Token.Streaming.StartObservableStream(StreamingType.Filter,new StreamingParameters(dic)).Publish();

            stream.OfType<StatusMessage>()
                .Subscribe(x => {
                    Document d = new Document() { TextValue = Codeplex.Data.DynamicJson.Serialize(x.Status) };
                    d.SetParent(this);
                    foreach (var item in this.Children)
                    {
                        d.AddChildren(item);
                    }
                    d.Run();
                });
            stream.OfType<WarningMessage>().Subscribe(x => ReportManage.ErrReport(this, x.Message));

              ////  stream.OfType<EventMessage>()
              //      .Subscribe(x => Console.WriteLine("{0} by @{1}", x.Event, x.Source.ScreenName));
            disposable = stream.Connect();
        }