//dm.outputFeed += outputText;
        public async void processData(List <string> FeedList, DataModel dm, DataAnalyzer da, emojiRef er, urlProcess up)
        {
            var backFeed = await passList(FeedList);

            string outputText = "";
            await Task.Run(() =>
            {
                foreach (string ele in backFeed)
                {
                    StrippedText   = da.TextStrip(ele) + " ";
                    dm.totalMedia += da.SearchForPicUrl(StrippedText);
                    dm.fCount     += da.mentionedWord(StrippedText, "f**k");
                    dm.trumpCount += da.mentionedWord(StrippedText, "trump");
                    dm.bidenCount += da.mentionedWord(StrippedText, "biden");
                    //pngCount += da.mentionedWord(StrippedText, ".png");
                    //jpgCount += da.mentionedWord(StrippedText, ".jpg");
                    percentUrl    = up.urlTracker(StrippedText, dm.totalTweet);
                    er.emojiTally = da.tallyEmoji(StrippedText, er.emojiTally, er.emojiName, dm.totalTweet).Item1;
                    //h += da.tallyEmoji(StrippedText, er.emojiTally, er.emojiName, dm.totalTweet).Item2;
                    dm.totalEmoji += da.tallyEmoji(StrippedText, er.emojiTally, er.emojiName, dm.totalTweet).Item3;
                    tu             = up.topUrl();
                    te             = da.topEmojis(er.emojiName, er.emojiTally);
                    outputText    += StrippedText + "\r\n" + "-----------------------------------------------------------\r\n";
                }
            });

            percentTweet     = ((100 / float.Parse(dm.totalTweet.ToString()))) * dm.totalEmoji;
            percentTweet     = float.Parse(Math.Round(percentTweet, 2).ToString());
            dm.percentTweet  = percentTweet;
            dm.backfeedCount = backFeed.Count;
            dm.totalTweet   += backFeed.Count;
            foreach (string s in te)
            {
                dm.topE += "    " + s + "\r\n";
            }

            foreach (string s in tu)
            {
                dm.top3Url += "    " + s + "\r\n";
            }
            //configure shutoff for the following
            dm.outputFeed += outputText;
            backFeed.Clear();
        }
Example #2
0
        private async void ProcessFeed()
        {
            float  percentTweet = 0;
            string StrippedText = "";

            string[] te       = new string[3];
            string[] tu       = new string[3];
            var      backFeed = await passList(FeedList);

            string rn = "\r\n";

            FeedList.Clear();
            if (backFeed.Count > 0)
            {
                dm.avgTweetPerSec  = tac.avgTweetsPerSecond(dm.seconds, backFeed.Count, dm, this).Item1;
                dm.avgTweetPerMin  = tac.avgTweetsPerSecond(dm.seconds, backFeed.Count, dm, this).Item2;
                dm.runningMinutes  = tac.avgTweetsPerSecond(dm.seconds, backFeed.Count, dm, this).Item3;
                dm.avgTweetPerHour = tac.avgTweetsPerSecond(dm.seconds, backFeed.Count, dm, this).Item4;
                try
                {
                    await Task.Run(() =>
                    {
                        foreach (string ele in backFeed)
                        {
                            StrippedText   = da.TextStrip(ele) + " ";
                            dm.totalMedia += da.SearchForPicUrl(StrippedText);
                            dm.fCount     += da.mentionedWord(StrippedText, "f**k");
                            dm.trumpCount += da.mentionedWord(StrippedText, "trump");
                            dm.bidenCount += da.mentionedWord(StrippedText, "biden");
                            pngCount      += da.mentionedWord(StrippedText, ".png");
                            jpgCount      += da.mentionedWord(StrippedText, ".jpg");
                            dm.percentUrl  = up.urlTracker(StrippedText, dm.totalTweet);
                            er.emojiTally  = da.tallyEmoji(StrippedText, er.emojiTally, er.emojiName, dm.totalTweet).Item1;
                            dm.totalEmoji += da.tallyEmoji(StrippedText, er.emojiTally, er.emojiName, dm.totalTweet).Item3;
                            dm.topHashtags = hp.HashProcess(StrippedText, true);
                            tu             = up.topUrl();
                            te             = da.topEmojis(er.emojiName, er.emojiTally);
                            outputText    += StrippedText + rn + "----------------------------------------------------------" + rn;
                        }
                    });
                }
                catch (Exception)
                {
                    ProcessFeed();
                }
                string topE    = rn;
                string top3Url = "";
                foreach (string s in te)
                {
                    topE += "    " + s + rn;
                }

                foreach (string s in tu)
                {
                    top3Url += "    " + s + rn;
                }
                percentTweet      = ((100 / float.Parse(dm.totalTweet.ToString()))) * dm.totalEmoji;
                percentTweet      = float.Parse(Math.Round(percentTweet, 2).ToString());
                dm.jimmyPageCount = jimmyPageCount;
                dm.totalUrl       = 0;
                dm.top3Url        = top3Url;
                dm.topE           = topE;
                dm.TwitterFeed    = "";
                dm.percentTweet   = percentTweet;
                TB.Text           = outputText;
                outputText        = "";
                statHold.Text     = dd.GenerateDisplay(dm);
            }
            backFeed.Clear();
            backFeed = null;
        }