Esempio n. 1
0
        private void Scraper_TweetsProcessed(object sender, TweetProcessedEventArgs e)
        {
            //sampleTweets.AddRange(e.Result);

            Scraper s = (Scraper)sender;

            UpdateListView(e.Number.ToString(), 1, s.TotalTweetSinceStart.ToString());
            UpdateListView(e.Number.ToString(), 2, s.EstimatedCompletionTime.Days.ToString() + "  days, " + s.EstimatedCompletionTime.Minutes.ToString() + " mins, " + s.EstimatedCompletionTime.Seconds.ToString() + " secs.");
        }
Esempio n. 2
0
        private void Scraper_TweetsProcessed(object sender, TweetProcessedEventArgs e)
        {
            sampleTweets.AddRange(e.Result);

            for (int i = 0; i < e.Result.Count - 2; i++)
            {
                double tDiff = e.Result[i].Date.Subtract(e.Result[i + 1].Date).TotalSeconds;

                if (LargetTimeDifference < tDiff)
                {
                    LargetTimeDifference = tDiff;
                }
            }
        }
Esempio n. 3
0
        private void Scraper_TweetsProcessed(object sender, TweetProcessedEventArgs e)
        {
            sampleTweets.AddRange(e.Result);

            if (ProcessDone)
            {
                DateTime endT = DateTime.Now;

                long size = 0;
                using (Stream s = new MemoryStream())
                {
                    BinaryFormatter formatter = new BinaryFormatter();
                    formatter.Serialize(s, sampleTweets);
                    size = s.Length / 1024;
                }


                double sec   = endT.Subtract(t).TotalSeconds;
                double speed = size / sec;

                DateTime FirstTweet = sampleTweets[sampleTweets.Count - 1].Date;
                DateTime LastTweet  = sampleTweets[0].Date;

                double   TweetsTimespan          = LastTweet.Subtract(FirstTweet).TotalSeconds;
                double   SingleDayTweetsEstimate = (86400 / TweetsTimespan) * sampleTweets.Count;
                double   QueriedDays             = this.TwitterQuery.until.Subtract(TwitterQuery.since).TotalDays;
                TimeSpan ETA       = new TimeSpan(Convert.ToInt64(((SingleDayTweetsEstimate * QueriedDays) / sampleTweets.Count) * sec));
                int      Threads   = Convert.ToInt32((InternetSpeed * 1024) / speed);
                TimeSpan ETAThread = new TimeSpan(Convert.ToInt64(ETA.TotalSeconds / Threads));


                //Performance
                lblFileSize.Text = size.ToString() + " kb";
                lblTime.Text     = sec.ToString().ToString() + " sec";
                lblSpeed.Text    = speed.ToString() + " kbps";

                //Estimation
                lblEstimatedTweets.Text  = (SingleDayTweetsEstimate * QueriedDays).ToString();
                lblETASingle.Text        = ETA.Days.ToString() + "  days, " + ETA.Minutes.ToString() + " mins, " + ETA.Seconds.ToString() + " secs.";
                lblThread.Text           = Threads.ToString();
                lblEstimatedThreads.Text = ETAThread.Days.ToString() + "  days, " + ETAThread.Minutes.ToString() + " mins, " + ETAThread.Seconds.ToString() + " secs.";
            }
        }