Ejemplo n.º 1
0
        private void Start_GetMentionsMultithreaded(object parameters)
        {
            try
            {
                Array paramsArray = new object[2];

                paramsArray = (Array)parameters;

                KeyValuePair<string, TweetAccountManager> keyValue = (KeyValuePair<string, TweetAccountManager>)paramsArray.GetValue(0);

                List<string> list_userIDsToFollow = new List<string>();//(List<string>)paramsArray.GetValue(1);

                TweetAccountManager tweetAccountManager = keyValue.Value;

                //tweetAccountManager.unFollower.logEvents.addToLogger += new EventHandler(logEvents_UnFollower_addToLogger);
                tweetAccountManager.logEvents.addToLogger += new EventHandler(Randomiser_AddToLogger);

                if (!tweetAccountManager.IsLoggedIn)
                {
                    tweetAccountManager.Login();
                }

                if (tweetAccountManager.AccountStatus == "Account Suspended")
                {
                    clsDBQueryManager database = new clsDBQueryManager();
                    database.UpdateSuspendedAcc(tweetAccountManager.Username);

                    AddToRandomiserLog("[ " + DateTime.Now + " ] => [ Account Suspended With User Name : " + tweetAccountManager.Username + " ]");
                    return;
                }

                tweetAccountManager.GetMentions();

                tweetAccountManager.logEvents.addToLogger -= Randomiser_AddToLogger;
            }
            catch
            {
            }
        }
Ejemplo n.º 2
0
        private void Start_ReplyMultithreaded(object parameters)
        {
            try
            {
                Array paramsArray = new object[2];

                paramsArray = (Array)parameters;

                KeyValuePair<string, TweetAccountManager> keyValue = (KeyValuePair<string, TweetAccountManager>)paramsArray.GetValue(0);


                List<string> list_userIDsToFollow = new List<string>();//(List<string>)paramsArray.GetValue(1);

                TweetAccountManager tweetAccountManager = keyValue.Value;

                if (tweetAccountManager.Username == userName)
                {

                    if (userDisplayName.Length + screenName.Length + message.Length < 140)
                    {

                        //tweetAccountManager.unFollower.logEvents.addToLogger += new EventHandler(logEvents_UnFollower_addToLogger);
                        tweetAccountManager.logEvents.addToLogger += new EventHandler(ReplyInterface_AddToLogger);

                        if (!tweetAccountManager.IsLoggedIn)
                        {
                            tweetAccountManager.Login();
                        }

                        if (tweetAccountManager.AccountStatus == "Account Suspended")
                        {
                            clsDBQueryManager database = new clsDBQueryManager();
                            database.UpdateSuspendedAcc(tweetAccountManager.Username);

                            AddToReplyInterfaceLog("[ " + DateTime.Now + " ] => [ Account Suspended With User Name : " + tweetAccountManager.Username + " ]");
                            return;
                        }

                        tweetAccountManager.Reply_MentionReplyInterface(PostAuthenticityToken, statusId, userDisplayName, screenName, message, userName);

                        tweetAccountManager.logEvents.addToLogger -= ReplyInterface_AddToLogger;

                        BindData();
                    }
                    else
                    {
                        MessageBox.Show("Please Edit  The Message Of Edit Message Box . Since The Message Length Is Greater Than 140 Characters !");
                        return;
                    }

                }
                
            }
            catch
            {
            }

            finally
            {
                try
                {
                   // BindData();
                }
                catch
                {
                }
            }
        }
Ejemplo n.º 3
0
        private void Start_RandomiserMultithreaded(object parameters)
        {
            try
            {
                if (!IsCloseCalledForRandomiser)
                {
                    try
                    {
                        Thread.CurrentThread.IsBackground = true;
                    }
                    catch
                    {
                    }
                    Array paramsArray = new object[2];

                    paramsArray = (Array)parameters;

                    KeyValuePair<string, TweetAccountManager> keyValue = (KeyValuePair<string, TweetAccountManager>)paramsArray.GetValue(0);

                    List<string> list_userIDsToFollow = new List<string>();//(List<string>)paramsArray.GetValue(1);

                    TweetAccountManager tweetAccountManager = keyValue.Value;

                    Randomiser.Randomiser obj_Randomiser = new Randomiser.Randomiser(tweetAccountManager.Username, tweetAccountManager.userID, tweetAccountManager.Password, tweetAccountManager.Screen_name, tweetAccountManager.proxyAddress, tweetAccountManager.proxyPort, tweetAccountManager.proxyUsername, tweetAccountManager.proxyPassword);

                    if (lstQuotes.Count > 0)
                    {
                        obj_Randomiser.Quotes = lstQuotes;
                    }
                    else
                    {
                        AddToRandomiserLog("[ " + DateTime.Now + " ] => [ Please Upload The Quotes ! ]");
                        return;
                    }

                    if (lstReTweet.Count > 0)
                    {
                        obj_Randomiser.ReTweets = lstReTweet;
                    }
                    else
                    {
                        AddToRandomiserLog("[ " + DateTime.Now + " ] => [ Please Upload The ReTweets ! ]");
                        return;
                    }

                    if (lstNormalTweets.Count > 0)
                    {
                        obj_Randomiser.NormalTweets = lstNormalTweets;
                    }
                    else
                    {
                        AddToRandomiserLog("[ " + DateTime.Now + " ] => [ Please Upload The Normal Tweets ! ]");
                        return;
                    }

                    if (lstFakeReplies.Count > 0)
                    {
                        obj_Randomiser.FakeReplies = lstFakeReplies;
                    }
                    else
                    {
                        AddToRandomiserLog("[ " + DateTime.Now + " ] => [ Please Upload The Fake Replies ! ]");
                        return;
                    }

                    if (lstFakeReplies.Count > 0)
                    {
                        obj_Randomiser.FakeScreenName = lstFakeScreenName;
                    }
                    else
                    {
                        AddToRandomiserLog("[ " + DateTime.Now + " ] => [ Please Upload The Fake Screen Name ! ]");
                        return;
                    }

                    if (chkUseMention.Checked)
                    {
                        if (lstMentions.Count > 0)
                        {
                            obj_Randomiser.Mentions = lstMentions;

                            obj_Randomiser.useMention = chkUseMention.Checked;
                        }
                        else
                        {
                            AddToRandomiserLog("[ " + DateTime.Now + " ] => [ Please Upload The Mentions ! ]");
                            return;
                        }
                    }

                    if (chkboxUseFollow.Checked)
                    {
                        if (lstFollow.Count > 0)
                        {
                            obj_Randomiser.Follow = lstFollow;

                            obj_Randomiser.useFollow = chkboxUseFollow.Checked;
                        }
                        else
                        {
                            AddToRandomiserLog("[ " + DateTime.Now + " ] => [ Please Upload Follow Username ]");
                            return;
                        }

                        #region UseFollowSetting
                        if (chkUseFollowSetting.Checked)
                        {
                            try
                            {
                                // Only one object can be created of  clsUseFollowSetting
                                clsUseFollowSetting obj_clsUseFollowSetting = clsUseFollowSetting.GetObject();
                                obj_Randomiser._DontFollowUsersThatUnfollowedBefore = obj_clsUseFollowSetting._DontFollowUsersThatUnfollowedBefore;

                                obj_Randomiser._DontFollowUsersWithNoPicture = obj_clsUseFollowSetting._DontFollowUsersWithNoPicture;

                                #region User Without Picture
                                if (obj_Randomiser._DontFollowUsersWithNoPicture)
                                {
                                    List<string> tempdata = new List<string>();
                                    try
                                    {
                                        foreach (string newitem in lstFollow)
                                        {
                                            tempdata.Add(newitem);
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> StartFollowing() -- User With No Picture --> " + ex.Message, Globals.Path_FollowerErroLog);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartFollowing() -- User With No Picture --> " + ex.Message, Globals.Path_TwtErrorLogs);
                                    }
                                    lstFollow.Clear();

                                    AddToRandomiserLog("[ " + DateTime.Now + " ] => [ Checking Profile Image in Extracted User id's ]");

                                    foreach (string item in tempdata)
                                    {
                                        string containsIamge = TwitterDataScrapper.GetPhotoFromUsername(item);
                                        Thread.Sleep(2000);
                                        if (containsIamge == "true")
                                        {
                                            AddToRandomiserLog("[ " + DateTime.Now + " ] => [ " + item + " Contains Image ]");
                                            lstFollow.Add(item);
                                        }
                                        else if (containsIamge == "false")
                                        {
                                            AddToRandomiserLog("[ " + DateTime.Now + " ] => [ " + item + " Not Contains Image ]");
                                            ///Add in blacklist table
                                        }
                                        else if (containsIamge == "Rate limit exceeded")
                                        {
                                            AddToRandomiserLog("[ " + DateTime.Now + " ] => [ Cannot Make Request. Rate limit exceeded ]");
                                            AddToRandomiserLog("[ " + DateTime.Now + " ] => [ Please Try After Some Time ]");
                                        }
                                        AddToRandomiserLog("[ " + DateTime.Now + " ] => [ Sleep For 4 Seconds ]");
                                        Thread.Sleep(4000);
                                    }
                                    AddToRandomiserLog("[ " + DateTime.Now + " ] => [ " + lstFollow.Count + " Users Contain Profile Image ]");
                                }

                                #endregion

                                obj_Randomiser._DontFollowUsersWithFollowingsFollowersRatio = obj_clsUseFollowSetting._DontFollowUsersWithFollowingsFollowersRatio;
                                obj_Randomiser._FollowingsFollowersRatio = obj_clsUseFollowSetting._FollowingsFollowersRatio;

                                obj_Randomiser._NoOFfollow = obj_clsUseFollowSetting._NoOFfollow;
                                obj_Randomiser._MaximumFollow = obj_clsUseFollowSetting._MaximumFollow;

                                obj_Randomiser._DontFollowUsersWithManyLinks = obj_clsUseFollowSetting._DontFollowUsersWithManyLinks;
                                obj_Randomiser._NoOfLinks = obj_clsUseFollowSetting._NoOfLinks;

                                #region followUserWithmanyLinks
                                if (obj_Randomiser._DontFollowUsersWithManyLinks)
                                {
                                    AddToRandomiserLog("[ " + DateTime.Now + " ] => [ Checking For Links in Tweets ]");
                                    if (!string.IsNullOrEmpty(obj_Randomiser._NoOfLinks.ToString()) && NumberHelper.ValidateNumber(obj_Randomiser._NoOfLinks.ToString()))
                                    {
                                        TwitterDataScrapper.Percentage = Convert.ToInt32(obj_Randomiser._NoOfLinks.ToString());
                                    }
                                    else
                                    {
                                        TwitterDataScrapper.Percentage = 40;
                                        AddToRandomiserLog("[ " + DateTime.Now + " ] => [ Setting Default Percentage : 40% ]");
                                    }
                                    List<string> tempdata = new List<string>();
                                    try
                                    {
                                        foreach (string newitem in lstFollow)
                                        {
                                            tempdata.Add(newitem);
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> StartFollowing() -- User With too Many Links --> " + ex.Message, Globals.Path_FollowerErroLog);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartFollowing() -- User With too Many Links --> " + ex.Message, Globals.Path_TwtErrorLogs);
                                    }
                                    lstFollow.Clear();
                                    foreach (string item in tempdata)
                                    {
                                        try
                                        {
                                            bool toomanyLinks = TwitterDataScrapper.GetStatusLinks(item);
                                            if (toomanyLinks)
                                            {
                                                lstFollow.Add(item);
                                                AddToRandomiserLog("[ " + DateTime.Now + " ] => [ Added User id : " + item + " To Follow List ]");
                                            }
                                        }
                                        catch
                                        {
                                        }
                                    }
                                }
                                #endregion

                                obj_Randomiser._UseGroups = obj_clsUseFollowSetting._UseGroups;
                                obj_Randomiser._UseGroup = obj_clsUseFollowSetting._UseGroup;

                                if (obj_Randomiser._UseGroups)
                                {
                                    if (tweetAccountManager.GroupName != obj_Randomiser._UseGroup)
                                    {
                                        AddToRandomiserLog("[ " + DateTime.Now + " ] => [ " + keyValue.Key + " Group Name Does Not Match ]");
                                        return;
                                    }
                                }
                            }
                            catch
                            {
                            }
                        }

                        #endregion

                        #region UseFollowBySearchKeyword
                        if (chkUseFollowBySearchKeyword.Checked)
                        {
                            try
                            {
                                clsFollowBySearchKeywords obj_clsFollowBySearchKeywords = clsFollowBySearchKeywords.GetObject();

                                obj_Randomiser._UseFollowbySearchKeyword = true;

                                obj_Randomiser._Followbysinglekeywordperaccount = obj_clsFollowBySearchKeywords._Followbysinglekeywordperaccount;

                                obj_Randomiser._NoFollowByPerAccount=obj_clsFollowBySearchKeywords._NoFollowByPerAccount;

                                if (obj_clsFollowBySearchKeywords.lstKeywords.Count > 0)
                                {
                                    obj_Randomiser.lstKeywords = obj_clsFollowBySearchKeywords.lstKeywords;
                                }
                                else
                                {
                                    MessageBox.Show("Please Upload The Follow By Search Keyword File !");
                                    return;
                                }
                            }
                            catch
                            {
                            }
                        }
                        #endregion

                        //if (chkBox_NoOFfollowPerTime.Checked)
                        {
                            try
                            {
                                obj_Randomiser._NoOFfollowPerTime = true;
                                obj_Randomiser.noOFfollowPerTime = Convert.ToInt32(txtMaxNoOfFollowPerTime.Text);
                            }
                            catch
                            {
                                txtMaxNoOfFollowPerTime.Text = (2).ToString();
                                obj_Randomiser.noOFfollowPerTime = 2;//Convert.ToInt32(txtMaxNoOfFollowPerTime.Text);
                            }
                        }
                    }

                    if (!string.IsNullOrEmpty(txtNoOfPostingQuotes.Text))
                    {
                        try
                        {
                            obj_Randomiser.QuotesPosting = numberOfPostingQuotes;
                        }
                        catch
                        {

                        }

                    }
                    else
                    {
                        obj_Randomiser.QuotesPosting = 5;
                    }

                    if (!string.IsNullOrEmpty(txtNoOfPostingNormalTweets.Text))
                    {
                        try
                        {
                            obj_Randomiser.NormalTweetsPosting = numberOfPostingNormalTweets;
                        }
                        catch
                        {

                        }

                    }
                    else
                    {
                        obj_Randomiser.NormalTweetsPosting = 5;
                    }

                    if (!string.IsNullOrEmpty(txtNoOfPostingReTweets.Text))
                    {
                        try
                        {
                            obj_Randomiser.ReTweetsPosting = numberOfPostingReTweetes;
                        }
                        catch
                        {

                        }

                    }
                    else
                    {
                        obj_Randomiser.ReTweetsPosting = 5;
                    }

                    if (!string.IsNullOrEmpty(txtFakeReplies.Text))
                    {
                        try
                        {
                            obj_Randomiser.FakeRepliesPosting = numberOfPostingFakeReplies;
                        }
                        catch
                        {

                        }

                    }
                    else
                    {
                        obj_Randomiser.FakeRepliesPosting = 5;
                    }

                    if (!string.IsNullOrEmpty(txtAfterNoOfPosting.Text))
                    {
                        try
                        {
                            obj_Randomiser.AfterNoOfPosting = afternumberOfPosting;
                        }
                        catch
                        {

                        }

                    }
                    else
                    {
                        obj_Randomiser.AfterNoOfPosting = 5;
                    }

                    if (!string.IsNullOrEmpty(txtMinDelay.Text))
                    {
                        try
                        {
                            obj_Randomiser.MinTimeDelay = minDelay;
                        }
                        catch
                        {

                        }

                    }
                    else
                    {
                        obj_Randomiser.MinTimeDelay = 5 * 60 * 1000;
                    }

                    if (!string.IsNullOrEmpty(txtMaxDelay.Text))
                    {
                        try
                        {
                            obj_Randomiser.MaxTimeDelay = maxDelay;
                        }
                        catch
                        {

                        }
                    }
                    else
                    {
                        obj_Randomiser.MaxTimeDelay = 10 * 60 * 1000;
                    }

                    //tweetAccountManager.unFollower.logEvents.addToLogger += new EventHandler(logEvents_UnFollower_addToLogger);
                    tweetAccountManager.logEvents.addToLogger += new EventHandler(Randomiser_AddToLogger);

                    if (!tweetAccountManager.IsLoggedIn)
                    {
                        tweetAccountManager.Login();
                    }

                    if (tweetAccountManager.AccountStatus == "Account Suspended")
                    {
                        clsDBQueryManager database = new clsDBQueryManager();
                        database.UpdateSuspendedAcc(tweetAccountManager.Username);

                        AddToRandomiserLog("[ " + DateTime.Now + " ] => [ Account Suspended With User Name : " + tweetAccountManager.Username + " ]");
                        return;
                    }

                    tweetAccountManager.LoginRandomiser(ref obj_Randomiser);

                    tweetAccountManager.logEvents.addToLogger -= Randomiser_AddToLogger;
                }
            }
            catch
            {
            }
        }
Ejemplo n.º 4
0
        public void ReTweetDivideRetweet(List<TwitterDataScrapper.StructTweetIDs> lst_DivideTweets, int minDelay, int maxDelay)
        {
            try
            {
                if (!IsLoggedIn)
                {
                    Login();
                }

                if (IsNotSuspended)
                {
                    if (IsLoggedIn)
                    {

                        int counter_Retweet = 0;

                        //TwitterDataScrapper.StructTweetIDs item = new TwitterDataScrapper.StructTweetIDs();
                        //while (que_lst_Struct_TweetData.Count > 0)
                        foreach (var item in lst_DivideTweets)
                        {
                            //foreach (TwitterDataScrapper.StructTweetIDs item in static_lst_Struct_TweetData)
                            //{
                            if (!RetweetPerDay)
                            {
                                if (counter_Retweet >= noOfRetweets)
                                {
                                    Log("[ " + DateTime.Now + " ] => [ " + counter_Retweet + " ReTweets Done For " + Username + " ]");
                                    break;
                                }
                            }
                            else if (RetweetPerDay)
                            {
                                if (AlreadyRetweeted >= NoOFRetweetPerDay)
                                {
                                    Log("[ " + DateTime.Now + " ] => [ Already Tweeted " + AlreadyRetweeted + " ]");
                                    break;
                                }
                            }

                            lock (locker_qque_lst_Struct_TweetData)
                            {
                                //if (que_lst_Struct_TweetData.Count > 0)
                                //{
                                //    item = que_lst_Struct_TweetData.Dequeue();
                                //}
                                //else
                                //{

                                //}

                            }

                            string tweetStatus;

                            int delay = 10 * 1000;

                            try
                            {
                                //delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                                if (Globals.IsGlobalDelay && Globals.IsCheckValueOfDelay)
                                {
                                    delay = RandomNumberGenerator.GenerateRandom(Globals.MinGlobalDelay, Globals.MaxGlobalDelay);
                                }
                                else
                                {
                                    delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                                }
                            }
                            catch (Exception ex)
                            {
                                delay = 10;
                                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager --  ReTweet()  -- " + Username + " --> " + ex.Message, Globals.Path_TweetAccountManager);
                            }

                            tweeter.ReTweet(ref globusHttpHelper, pgSrc_Profile, postAuthenticityToken, item.ID_Tweet, "", out tweetStatus);

                            if (tweetStatus == "posted")
                            {
                                counter_Retweet++;
                                AlreadyRetweeted++;
                                clsDBQueryManager DataBase = new clsDBQueryManager();
                                string dbTweetMessage = StringEncoderDecoder.Encode(item.wholeTweetMessage);
                                DataBase.InsertMessageData(Username, "ReTweet", item.ID_Tweet, dbTweetMessage);
                                Log("[ " + DateTime.Now + " ] => [ Retweeted " + counter_Retweet + ": >> " + item.username__Tweet_User + " by " + Username + " ]");
                                GlobusFileHelper.AppendStringToTextfileNewLine(item.username__Tweet_User + " by " + Username, Globals.path_RetweetInformation);
                            }
                            else
                            {
                                Log("[ " + DateTime.Now + " ] => [ >>Couldn't Retweet >> " + item.ID_Tweet_User + " by " + Username + " ]");
                                //GlobusFileHelper.AppendStringToTextfileNewLine("Retweeted " + counter_Retweet + ": >> " + item.username__Tweet_User + " by " + Username, Globals.path_RetweetInformation);
                            }

                            Log("[ " + DateTime.Now + " ] => [ Retweet Delayed for " + delay + " Seconds ]");
                            Thread.Sleep(delay * 1000);
                        }

                        Log("[ " + DateTime.Now + " ] => [ Finished Retweeting with : " + Username + " ]");
                        Log("------------------------------------------------------------------------------------------------------------------------------------------");
                    }
                    else
                    {
                        Log("[ " + DateTime.Now + " ] => [ Couldn't log in with " + Username + " ]");
                        GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_FailedLoginAccounts);
                    }
                }
                else
                {
                    clsDBQueryManager database = new clsDBQueryManager();
                    database.UpdateSuspendedAcc(Username);
                    Log("[ " + DateTime.Now + " ] => [ " + Username + ">>Account Suspended ]");

                    return;
                }
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager() - retweet --> " + ex.Message, Globals.Path_TweetingErroLog);
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager --  ReTweet()  -- " + Username + " --> " + ex.Message, Globals.Path_TweetAccountManager);
            }
        }
Ejemplo n.º 5
0
        public void Tweet(List<string> lst_tweetMessage, int minDelay, int maxDelay)
        {
            //Login();

            //if (true)

            if (!IsLoggedIn)
            {
                Login();
            }

            if (IsNotSuspended)
            {
                if (IsLoggedIn)
                {
                    int counter_Tweet = 0;

                    #region <<Set delay time if Minimum or maximum delay time is not set >>
                    //Set delay time if Minimum or maximum delay time is not set
                    if (minDelay == 0 || maxDelay == 0)
                    {
                        try
                        {
                            if (minDelay == 0)
                            {
                                minDelay = 0;
                            }
                            if (maxDelay == 0)
                            {
                                maxDelay = 10;
                            }
                        }
                        catch (Exception)
                        {
                        }
                    }
                    #endregion

                    #region Separate Tweets per account

                    if (!AllTweetsPerAccount)
                    {
                        while (que_TweetMessages.Count > 0)
                        {
                            if (!TweetPerDay)
                            {
                                if (counter_Tweet >= NoOfTweets)
                                {
                                    break;
                                }
                            }
                            else if (TweetPerDay)
                            {
                                if (AlreadyTweeted >= NoOfTweetPerDay)
                                {
                                    Log("[ " + DateTime.Now + " ] => [ Already Tweeted " + AlreadyTweeted + " ]");
                                    break;
                                }
                            }

                            string tweetMessage = "";
                            string tweetStatus;
                            #region commented
                            //int delay = 10 * 1000;
                            //int delay = 0;
                            //try
                            //{
                            //    if (DelayTweet > 0)
                            //    {
                            //        //int SomeDelay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                            //        //delay = DelayTweet - SomeDelay;

                            //        //if (delay < 0)
                            //        //{
                            //        //    delay = RandomNumberGenerator.GenerateRandom(0, 20);
                            //        //}

                            //        //TimeSpan T = EndTime - DateTime.Now;
                            //        //if (T.TotalSeconds <= 0)
                            //        //{
                            //        //    Log("Time Completed Tweeting Stopped For " + Username);
                            //        //    break;
                            //        //}

                            //        if (DelayTweet > 0)
                            //        {
                            //            int SomeDelay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                            //            delay = DelayTweet - SomeDelay;
                            //            TimeSpan T = EndTime - DateTime.Now;
                            //            if (T.TotalSeconds <= 0)
                            //            {
                            //                Log("[ " + DateTime.Now + " ] => [ Time Completed Tweeting Stopped For " + Username + " ]");
                            //                break;
                            //            }
                            //        }
                            //        else
                            //        {
                            //            delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                            //        }
                            //    }
                            //    else
                            //    {
                            //        delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                            //    }
                            //}
                            //catch (Exception ex)
                            //{
                            //    GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> Tweet() -- DelayTweet --> " + ex.Message, Globals.Path_TweetingErroLog);
                            //    GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager --  Tweet() --> " + ex.Message, Globals.Path_TweetAccountManager);
                            //}
                            #endregion

                            lock (locker_que_TweetMessage)
                            {
                                if (que_TweetMessages.Count > 0)
                                {
                                    try
                                    {
                                        tweetMessage = que_TweetMessages.Dequeue();
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> StartTweetingMultithreaded() -- locker_que_TweetMessage --> " + ex.Message, Globals.Path_TweetingErroLog);
                                        GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager --  Tweet() --> " + ex.Message, Globals.Path_TweetAccountManager);
                                    }
                                }
                                else
                                {
                                    Log("[ " + DateTime.Now + " ] => [ All Loaded Tweet Messages Used ]");
                                    //break;
                                }
                            }

                            if (UseHashTags)
                            {
                                lock (locker_que_hashtags)
                                {

                                    if (que_TweetMessages_Hashtags.Count > 0)
                                    {
                                        try
                                        {
                                            Hashtags = que_TweetMessages_Hashtags.Dequeue();
                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> StartTweetingMultithreaded() -- Tweet -- que_TweetMessages_Hashtags --> " + ex.Message, Globals.Path_TweetingErroLog);
                                            GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager --  Tweet -- que_TweetMessages_Hashtags  --> " + ex.Message, Globals.Path_TweetAccountManager);
                                        }
                                    }
                                    else
                                    {
                                        Log("[ " + DateTime.Now + " ] => [ All Loaded Hash Tags Are Used ]");
                                        //break;
                                    }
                                }
                            }
                            if (!string.IsNullOrEmpty(Hashtags))
                            {
                                tweetMessage = Hashtags + " " + tweetMessage;
                            }

                            tweeter.Tweet(ref globusHttpHelper, postAuthenticityToken, tweetMessage, out tweetStatus);

                            if (tweetStatus == "posted")
                            {
                                try
                                {
                                    Log("[ " + DateTime.Now + " ] => [ >> Tweeted >> " + tweetMessage + " by " + Username + " ]");
                                    clsDBQueryManager DataBase = new clsDBQueryManager();
                                    string dbTweetMessage = StringEncoderDecoder.Encode(tweetMessage);
                                    DataBase.InsertMessageData(Username, "Tweet", "null", dbTweetMessage);
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword + ":" + tweetMessage, Globals.path_SuccessfullyTweetAccounts);
                                    //Log("[ " + DateTime.Now + " ] => [ Tweet Delayed for " + delay + " Seconds ]");
                                    try
                                    {
                                        RemoveFollwerFromTxtFile(FileTweetPath, tweetMessage);
                                    }
                                    catch { }
                                    //Thread.Sleep(delay * 1000);
                                    counter_Tweet++;
                                    AlreadyTweeted++;
                                    Globals.totalcountTweet++;
                                }
                                catch (Exception ex)
                                {
                                    GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> StartTweetingMultithreaded() -- tweetStatus --> " + ex.Message, Globals.Path_TweetingErroLog);
                                    GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager --  Tweet()  -- " + Username + " --> " + ex.Message, Globals.Path_TweetAccountManager);
                                }
                            }
                            else
                            {
                                if (UseHashTags)
                                {
                                    que_TweetMessages_Hashtags.Enqueue(Hashtags);
                                    que_TweetMessages.Enqueue(tweetMessage);
                                }
                                else
                                {
                                    que_TweetMessages.Enqueue(tweetMessage);
                                }
                                Log("[ " + DateTime.Now + " ] => [ >>Couldn't Post >> " + tweetMessage + " by " + Username + " ]");
                                GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword + ":" + tweetMessage, Globals.path_FailedToTweetAccounts);
                                //Thread.Sleep(delay * 1000);

                                //delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                                //Thread.Sleep(delay * 1000);
                                //Log("[ " + DateTime.Now + " ] => [ Tweet Delayed for " + delay + " Seconds ]");
                            }

                            //int delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                            int delay = 10 * 1000;
                            int delay1 = 10 * 1000;
                            try
                            {
                                if (Globals.IsGlobalDelay && Globals.IsCheckValueOfDelay)
                                {
                                    if (Globals.FollowerRunningText == "FollowerModule" && Globals.TweetRunningText == "TweetModule")
                                    {
                                        delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                                        delay1 = RandomNumberGenerator.GenerateRandom(Globals.MinGlobalDelay, Globals.MaxGlobalDelay);

                                        Log("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                                        Thread.Sleep(delay * 1000);

                                        Log("[ " + DateTime.Now + " ] => [ Global Delay for Tweet: " + delay1 + " Seconds ]");
                                        Thread.Sleep(delay1 * 1000);
                                    }
                                    else
                                    {
                                        delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                                        Log("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                                        Thread.Sleep(delay * 1000);
                                    }
                                }
                                else
                                {
                                    delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);

                                    Log("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                                    Thread.Sleep(delay * 1000);
                                }
                            }
                            catch { }
                            //Log("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                            //Thread.Sleep(delay * 1000);

                        }

                    }
                    #endregion

                    #region All Tweets per account
                    else
                    {
                        while (que_TweetMessages_PerAccount.Count > 0)
                        {
                            //if (!TweetPerDay)
                            //{
                            //    if (counter_Tweet >= NoOfTweets)
                            //    {
                            //        break;
                            //    }
                            //}
                            //else if (TweetPerDay)
                            //{
                            //    if (AlreadyTweeted >= NoOfTweetPerDay)
                            //    {
                            //        Log("Already Tweeted " + AlreadyTweeted);
                            //        break;
                            //    }
                            //}

                            string tweetMessage = "";
                            string tweetStatus;
                            int delay = 0;
                            int delay1 = 0;
                            try
                            {
                                if (DelayTweet > 0)
                                {
                                    //int SomeDelay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                                    int SomeDelay = 10 * 1000;
                                    try
                                    {
                                        if (Globals.IsGlobalDelay && Globals.IsCheckValueOfDelay)
                                        {
                                            SomeDelay = RandomNumberGenerator.GenerateRandom(Globals.MinGlobalDelay, Globals.MaxGlobalDelay);
                                        }
                                        else
                                        {
                                            SomeDelay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                                        }
                                    }
                                    catch { }

                                    delay = DelayTweet - SomeDelay;
                                    TimeSpan T = EndTime - DateTime.Now;
                                    if (T.TotalSeconds <= 0)
                                    {
                                        Log("[ " + DateTime.Now + " ] => [ Time Completed Tweeting Stopped For " + Username + " ]");
                                        break;
                                    }
                                }
                                else
                                {
                                    delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> Tweet() -- DelayTweet --> " + ex.Message, Globals.Path_TweetingErroLog);
                                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager --  Tweet() --> " + ex.Message, Globals.Path_TweetAccountManager);
                            }

                            lock (locker_que_TweetMessage)
                            {
                                if (que_TweetMessages_PerAccount.Count > 0)
                                {
                                    try
                                    {
                                        tweetMessage = que_TweetMessages_PerAccount.Dequeue();
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> StartTweetingMultithreaded() -- locker_que_TweetMessage --> " + ex.Message, Globals.Path_TweetingErroLog);
                                        GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager --  Tweet() --> " + ex.Message, Globals.Path_TweetAccountManager);
                                    }
                                }
                                else
                                {
                                    Log("[ " + DateTime.Now + " ] => [ All Loaded Tweet Messages Used ]");
                                    //break;
                                }
                            }

                            if (UseHashTags)
                            {
                                lock (locker_que_hashtags)
                                {

                                    if (que_TweetMessages_Hashtags.Count > 0)
                                    {
                                        try
                                        {
                                            Hashtags = que_TweetMessages_Hashtags.Dequeue();
                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> StartTweetingMultithreaded() -- Tweet -- que_TweetMessages_Hashtags --> " + ex.Message, Globals.Path_TweetingErroLog);
                                            GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager --  Tweet -- que_TweetMessages_Hashtags  --> " + ex.Message, Globals.Path_TweetAccountManager);
                                        }
                                    }
                                    else
                                    {
                                        Log("[ " + DateTime.Now + " ] => [ All Loaded Hash Tags Are Used ]");
                                        //break;
                                    }
                                }
                            }
                            if (!string.IsNullOrEmpty(Hashtags))
                            {
                                tweetMessage = Hashtags + " " + tweetMessage;
                            }

                            tweeter.Tweet(ref globusHttpHelper, postAuthenticityToken, tweetMessage, out tweetStatus);

                            if (tweetStatus == "posted")
                            {
                                try
                                {
                                    Log("[ " + DateTime.Now + " ] => [ >> Tweeted >> " + tweetMessage + " by " + Username + " ]");
                                    clsDBQueryManager DataBase = new clsDBQueryManager();
                                    string dbTweetMessage = StringEncoderDecoder.Encode(tweetMessage);
                                    DataBase.InsertMessageData(Username, "Tweet", "null", dbTweetMessage);
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword + ":" + tweetMessage, Globals.path_SuccessfullyTweetAccounts);
                                    //Log("[ " + DateTime.Now + " ] => [ Tweet Delayed for " + delay + " Seconds ]");
                                    //Thread.Sleep(delay * 1000);

                                    try
                                    {
                                        if (Globals.IsGlobalDelay && Globals.IsCheckValueOfDelay)
                                        {
                                            if (Globals.FollowerRunningText == "FollowerModule" && Globals.TweetRunningText == "TweetModule")
                                            {
                                                delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                                                delay1 = RandomNumberGenerator.GenerateRandom(Globals.MinGlobalDelay, Globals.MaxGlobalDelay);

                                                Log("[ " + DateTime.Now + " ] => [ Tweet Delayed for " + delay + " Seconds ]");
                                                Thread.Sleep(delay * 1000);

                                                Log("[ " + DateTime.Now + " ] => [ Global Delay for Tweet: " + delay1 + " Seconds ]");
                                                Thread.Sleep(delay1 * 1000);
                                            }
                                            else
                                            {
                                                delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                                                Log("[ " + DateTime.Now + " ] => [ Tweet Delayed for " + delay + " Seconds ]");
                                                Thread.Sleep(delay * 1000);
                                            }
                                        }
                                        else
                                        {
                                            delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);

                                            Log("[ " + DateTime.Now + " ] => [ Tweet Delayed for " + delay + " Seconds ]");
                                            Thread.Sleep(delay * 1000);
                                        }
                                    }
                                    catch { }

                                    counter_Tweet++;
                                    AlreadyTweeted++;
                                    Globals.totalcountTweet++;
                                }
                                catch (Exception ex)
                                {
                                    GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> StartTweetingMultithreaded() -- tweetStatus --> " + ex.Message, Globals.Path_TweetingErroLog);
                                    GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager --  Tweet()  -- " + Username + " --> " + ex.Message, Globals.Path_TweetAccountManager);
                                }

                                try
                                {
                                    RemoveFollwerFromTxtFile(FileTweetPath, tweetMessage);
                                }
                                catch { }
                            }
                            else
                            {
                                Log("[ " + DateTime.Now + " ] => [ >>Couldn't Post >> " + tweetMessage + " by " + Username + " ]");
                                GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword + ":" + tweetMessage, Globals.path_FailedToTweetAccounts);
                                //Thread.Sleep(delay * 1000);
                                //Log("[ " + DateTime.Now + " ] => [ Tweet Delayed for " + delay + " Seconds ]");

                                try
                                {
                                    if (Globals.IsGlobalDelay && Globals.IsCheckValueOfDelay)
                                    {
                                        if (Globals.FollowerRunningText == "FollowerModule" && Globals.TweetRunningText == "TweetModule")
                                        {
                                            delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                                            delay1 = RandomNumberGenerator.GenerateRandom(Globals.MinGlobalDelay, Globals.MaxGlobalDelay);

                                            Log("[ " + DateTime.Now + " ] => [ Tweet Delayed for " + delay + " Seconds ]");
                                            Thread.Sleep(delay * 1000);

                                            Log("[ " + DateTime.Now + " ] => [ Global Delay for Tweet: " + delay1 + " Seconds ]");
                                            Thread.Sleep(delay1 * 1000);
                                        }
                                        else
                                        {
                                            delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                                            Log("[ " + DateTime.Now + " ] => [ Tweet Delayed for " + delay + " Seconds ]");
                                            Thread.Sleep(delay * 1000);
                                        }
                                    }
                                    else
                                    {
                                        delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);

                                        Log("[ " + DateTime.Now + " ] => [ Tweet Delayed for " + delay + " Seconds ]");
                                        Thread.Sleep(delay * 1000);
                                    }
                                }
                                catch { }
                            }

                        }

                    }
                    #endregion
                    GlobusFileHelper.AppendStringToTextfileNewLine("Module Tweet count : " + counter_Tweet + " using UserName: "******"[ " + DateTime.Now + " ] => [ Finished Tweeting with : " + Username + " ]");
                    Log("------------------------------------------------------------------------------------------------------------------------------------------");
                }
                else
                {
                    Log("[ " + DateTime.Now + " ] => [ Couldn't log in with " + Username + " ]");
                    GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_FailedLoginAccounts);
                }
            }
            else if (Globals.proxyNotWorking)
            {
                Globals.proxyNotWorking = false;
                Log("[ " + DateTime.Now + " ] => [ " + Username + ">>Error in Login. ]");
                return;
            }
            else
            {
                clsDBQueryManager database = new clsDBQueryManager();
                database.UpdateSuspendedAcc(Username);
                Log("[ " + DateTime.Now + " ] => [ " + Username + ">>Account Suspended ]");
                return;
            }
        }
Ejemplo n.º 6
0
        public void GetFollowercount()
        {
            try
            {
                Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en");
                GlobusRegex rgx = new GlobusRegex();
                string URL = string.Empty;

                string PageSource = globusHttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/" + Screen_name), "", "");

                URL = globusHttpHelper.gResponse.ResponseUri.AbsoluteUri;

                if (PageSource.Contains("btn resend-confirmation-email-link"))
                {
                    Isnonemailverifiedaccounts = true;
                }

               if (!PageSource.Contains("Account suspended") && !PageSource.Contains("currently suspended") && !URL.Contains("https://twitter.com/account/suspended") && !PageSource.Contains("account-suspended"))
                {
                    //int indexStart = PageSource.IndexOf("data-nav=\"followers\"");
                    //string start = PageSource.Substring(indexStart).Replace("data-nav=\'followers\'", "");
                    //int indexEnd = start.IndexOf("</strong>");
                    //string end = start.Substring(0, indexEnd).Replace("<strong>", "").Replace(">", "").Replace("\n", "").Replace(" ", "");
                    if (PageSource.Contains("data-element-term=\"follower_stats"))
                    {
                        try
                        {
                            int indexStart = PageSource.IndexOf("data-element-term=\"follower_stats");
                            string start = PageSource.Substring(indexStart).Replace("data-element-term=\"follower_stats", "");
                            int indexEnd = start.IndexOf("</strong>");
                            string end = start.Substring(0, indexEnd).Replace("<strong>", "").Replace(">", "").Replace("\n", "").Replace(" ", "");
                            if (end.Contains("<strongtitle="))
                            {
                                try
                                {
                                    end = end.Split('\"')[6].Replace("strongtitle=", "");
                                }
                                catch { }
                            }

                            FollowerCount = rgx.StripTagsRegex(end).Replace("data-nav=\"followers\"", string.Empty).Replace("\n", string.Empty).Replace("\"", string.Empty).Trim();

                        }
                        catch { }

                        try
                        {
                            int indexStart1 = PageSource.IndexOf("data-element-term=\"following_stats");
                            string start1 = PageSource.Substring(indexStart1).Replace("data-element-term=\"following_stats", "");
                            int indexEnd1 = start1.IndexOf("</strong>");
                            string end1 = start1.Substring(0, indexEnd1).Replace("<strong>", "").Replace(">", "").Replace("\n", "").Replace(" ", "");
                            if (end1.Contains("<strongtitle="))
                            {
                                try
                                {
                                    end1 = end1.Split('\"')[6].Replace("strongtitle=", "");
                                }
                                catch { }
                            }
                            FollwingCount = rgx.StripTagsRegex(end1).Replace("data-nav=\"following\"", string.Empty).Replace("\n", string.Empty).Replace("\"", string.Empty).Trim();

                        }
                        catch { }
                    }
                    else
                    {
                        try
                        {
                            int indexStart = PageSource.IndexOf("ProfileNav-item ProfileNav-item--following");
                            string start = PageSource.Substring(indexStart).Replace("ProfileNav-item ProfileNav-item--following", "");
                            int indexEnd = start.IndexOf("data-nav=\"following");
                            string end = start.Substring(0, indexEnd).Replace("data-nav=\"following", "").Replace("<a class=\"ProfileNav-stat ProfileNav-stat--link u-borderUserColor u-textCenter js-tooltip js-nav u-textUserColor\" title=", "").Replace("Following", "").Replace(",", "").Replace("\n", "").Replace("\"", "").Replace(">", "").Trim();
                            FollwingCount = rgx.StripTagsRegex(end).Replace("data-nav=\"followers\"", string.Empty).Replace("\n", string.Empty).Replace("\"", string.Empty).Replace("following", string.Empty).Trim();
                        }
                        catch { }

                        try
                        {
                            int indexStart = PageSource.IndexOf("ProfileNav-item ProfileNav-item--follower");
                            string start = PageSource.Substring(indexStart).Replace("ProfileNav-item ProfileNav-item--follower", "");
                            int indexEnd = start.IndexOf("data-nav=\"followers");
                            string end = start.Substring(1, indexEnd).Replace("data-nav=\"followers", "").Replace("<a class=\"ProfileNav-stat ProfileNav-stat--link u-borderUserColor u-textCenter js-tooltip js-nav u-textUserColor\" title=", "").Replace("followers", "").Replace(",", "").Replace("\n", "").Replace("\"", "").Replace(">", "").Replace("Followers", "").Trim();

                            FollowerCount = rgx.StripTagsRegex(end).Replace("data-nav=\"followers\"", string.Empty).Replace("\n", string.Empty).Replace("\"", string.Empty).Replace("followers", string.Empty).Trim();
                            if(FollowerCount.Contains(" "))
                            {
                                FollowerCount = FollowerCount.Split(' ')[0].Trim();
                            }
                        }
                        catch { }
                    }

                    AccountStatus = "Active";
                    IsNotSuspended = true;
                }
                else if (PageSource.Contains("Account suspended") || URL.Contains("https://twitter.com/account/suspended") || PageSource.Contains("account-suspended"))
                {
                    Log("[ " + DateTime.Now + " ] => [ " + Username + " - Account Suspended ] ");
                    //reminveSuspendedAccounts(Username);
                    clsDBQueryManager database = new clsDBQueryManager();
                    database.UpdateSuspendedAcc(Username);
                    AccountStatus = "Account Suspended";
                    IsNotSuspended = false;
                    Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_SuspendedEmailAccounts);

                }
            }
            catch (Exception ex)
            {

            }
        }
Ejemplo n.º 7
0
        private void StartCheckingAccount(object parameters)
        {

            TweetAccountManager tweetAccountManager = new TweetAccountManager();

            lstThreadAppFollow.Add(Thread.CurrentThread);
            lstThreadAppFollow = lstThreadAppFollow.Distinct().ToList();
            Thread.CurrentThread.IsBackground = true;

            try
            {
                Array paramsArray = new object[3];

                paramsArray = (Array)parameters;

                KeyValuePair<string, TweetAccountManager> keyValue = (KeyValuePair<string, TweetAccountManager>)paramsArray.GetValue(0);


                AddToListBox("[ " + DateTime.Now + " ] => [ Starting Checking Account : " + keyValue.Key + " ]");

                tweetAccountManager = keyValue.Value;

                if (!tweetAccountManager.IsLoggedIn)
                {
                    tweetAccountManager.Login();
                }
                if (tweetAccountManager.IsLoggedIn)
                {
                    AddToListBox("[ " + DateTime.Now + " ] => [ SuccessFully Logged In with Account:  " + keyValue.Key + " ]");
                }
                if (tweetAccountManager.AccountStatus == "Account Suspended")
                {
                    AddToListBox("[ " + DateTime.Now + " ] => [ Suspended  Account:  " + keyValue.Key + " ]");
                    clsDBQueryManager database = new clsDBQueryManager();
                    database.UpdateSuspendedAcc(tweetAccountManager.Username);
                    return;
                }

                DataTable dt = objclsFBAccount.SelectAccoutsForGridView();

                if (!Globals.IsRefreshAccountExecute)
                {
                    btnRefresh.Invoke(new MethodInvoker(delegate
                    {
                        dgvAccounts.DataSource = dt;

                    }));
                }
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> startCheckingAccount() -- Method --> " + ex.Message, Globals.Path_TwtErrorLogs);
            }
            finally
            {
                counter_Account--;
                
                if (counter_Account == 0)
                {
                    if (btnRefresh.InvokeRequired)
                    {
                        btnRefresh.Invoke(new MethodInvoker(delegate
                        {
                            AddToListBox("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                            AddToListBox("---------------------------------------------------------------------------------------------------------------------------");

                        }));
                    }
                }
            }
        }
Ejemplo n.º 8
0
        private void Star_ScrapTweetAndReplyMultithreaded(object parameters)
        {
            try
            {
                Array paramsArray = new object[2];

                paramsArray = (Array)parameters;

                KeyValuePair<string, TweetAccountManager> keyValue = (KeyValuePair<string, TweetAccountManager>)paramsArray.GetValue(0);


                List<string> list_userIDsToFollow = new List<string>();//(List<string>)paramsArray.GetValue(1);

                TweetAccountManager tweetAccountManager = keyValue.Value;

                //tweetAccountManager.unFollower.logEvents.addToLogger += new EventHandler(logEvents_UnFollower_addToLogger);
                tweetAccountManager.logEvents.addToLogger += new EventHandler(ReplyInterface_AddToLogger);

                if (!tweetAccountManager.IsLoggedIn)
                {
                    tweetAccountManager.Login();
                }

                if (tweetAccountManager.AccountStatus == "Account Suspended")
                {
                    clsDBQueryManager database = new clsDBQueryManager();
                    database.UpdateSuspendedAcc(tweetAccountManager.Username);

                    AddToReplyInterfaceLog("Account Suspended With User Name : " + tweetAccountManager.Username);
                    return;
                }

                tweetAccountManager.ScrapTweetAndReply();

                BindData();

                tweetAccountManager.logEvents.addToLogger -= ReplyInterface_AddToLogger;
            }
            catch
            {
            }
        } 
Ejemplo n.º 9
0
        public void StartAddtoFollow(object data)
        {
            try
            {
                try
                {
                    if (Is_Stop_ScrapeWhoToFollow)
                    {
                        return;
                    }
                    lstWhoToFollowScrapeThread.Add(Thread.CurrentThread);
                    lstWhoToFollowScrapeThread = lstWhoToFollowScrapeThread.Distinct().ToList();
                    Thread.CurrentThread.IsBackground = true;

                }
                catch
                { }

                Array paramsArray = new object[2];

                paramsArray = (Array)data;

                KeyValuePair<string, TweetAccountManager> keyValue = (KeyValuePair<string, TweetAccountManager>)paramsArray.GetValue(0);
                int NoOFPages = (int)paramsArray.GetValue(1);
                TweetAccountManager tweetAccountManager = keyValue.Value;

                AddThreadToDictionary(strModule(Module.WhoToScrap), tweetAccountManager.Username);

                AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Logging In With " + keyValue.Key + " ]");
                if (!tweetAccountManager.IsLoggedIn)
                {
                    tweetAccountManager.Login();
                    if (!tweetAccountManager.IsLoggedIn)
                    {
                        AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Not Logged In With " + keyValue.Key + " ]");
                        return;
                    }
                }
                AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Logged In With " + keyValue.Key + " ]");

                if (tweetAccountManager.AccountStatus == "Account Suspended")
                {
                    clsDBQueryManager database = new clsDBQueryManager();
                    database.UpdateSuspendedAcc(tweetAccountManager.Username);

                    AddToScrapeLogs("[ " + DateTime.Now + " ] => [ Account Suspended With User Name : " + tweetAccountManager.Username + " ]");
                    return;
                }

                foreach (string Keyword in lstscrapeWhoTofoollow)
                {
                    ScrapeWhotoFollow(tweetAccountManager, Keyword, NoOFPages);
                }
            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> StartAddtoFollow() --> " + ex.Message, Globals.Path_ScrapeUsersErroLog);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartAddtoFollow() --> " + ex.Message, Globals.Path_TwtErrorLogs);
            }
            finally
            {
                counterFoScrpeWhoToFollow++;
                if (counterFoScrpeWhoToFollow == TweetAccountContainer.dictionary_TweetAccount.Count)
                {
                    AddToScrapeLogs("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                    AddToScrapeLogs("------------------------------------------------------------------------------------------------------------------------------------------");
                }
            }
        }
Ejemplo n.º 10
0
        private void StartFollowingMultithreaded(object parameters)
        {
            TweetAccountManager tweetAccountManager = new TweetAccountManager();
            try
            {
                Array paramsArray = new object[3];

                paramsArray = (Array)parameters;

                KeyValuePair<string, TweetAccountManager> keyValue = (KeyValuePair<string, TweetAccountManager>)paramsArray.GetValue(0);

                List<string> list_userIDsToFollow = (List<string>)paramsArray.GetValue(1);

                bool OtherUser = (bool)paramsArray.GetValue(2);
                int strMinDelay = (int)paramsArray.GetValue(3);
                int strMaxDelay = (int)paramsArray.GetValue(4);

                int intMinDelay = strMinDelay;
                int intMaxDelay = strMaxDelay;

                List<string> lstFollowers = new List<string>();
                List<string> lstFollowings = new List<string>();

                AddToLog_Follower("[ " + DateTime.Now + " ] => [ Starting Follower For Account : " + keyValue.Key + " ]");

                tweetAccountManager = keyValue.Value;
                TweetAccountManager.FileFollowUrlPath = txtPathUserIDs.Text.ToString();

                if (chkboxUseGroups.Checked)
                {
                    if (tweetAccountManager.GroupName != txtUseGroup.Text)
                    {
                        AddToLog_Follower("[ " + DateTime.Now + " ] => [ " + keyValue.Key + " Group Name Does Not Match ]");
                        return;
                    }
                }

                //Add to Threads Dictionary
                AddThreadToDictionary(strModule(Module.Follow), tweetAccountManager.Username);
                tweetAccountManager.follower.logEvents.addToLogger += new EventHandler(logEvents_Follower_addToLogger);
                tweetAccountManager.logEvents.addToLogger += logEvents_Follower_addToLogger;

                if (!tweetAccountManager.IsLoggedIn)
                {
                    tweetAccountManager.Login();
                }

                if (tweetAccountManager.AccountStatus == "Account Suspended")
                {
                    clsDBQueryManager database = new clsDBQueryManager();
                    database.UpdateSuspendedAcc(tweetAccountManager.Username);
                    return;
                }

                try
                {
                    AddToLog_Follower("[ " + DateTime.Now + " ] => [ " + list_userIDsToFollow.Count() + " user id in List ]");
                }
                catch (Exception)
                {
                }

                if (list_userIDsToFollow.Count > 0)
                {

                    tweetAccountManager.FollowUsingURLs(list_userIDsToFollow, intMinDelay, intMaxDelay, OtherUser);
                }
                else
                {
                    AddToLog_Follower("[ " + DateTime.Now + " ] => [ No ID's To Follow ]");
                }

                // tweetAccountManager.follower.logEvents.addToLogger -= logEvents_Follower_addToLogger;
                //tweetAccountManager.logEvents.addToLogger -= logEvents_Follower_addToLogger;
            }
            catch (Exception ex)
            {
                ErrorLogger.AddToErrorLogText(ex.Message);
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> StartFollowingMultithreaded() --> " + ex.Message, Globals.Path_FollowerErroLog);
                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartFollowingMultithreaded() --> " + ex.Message, Globals.Path_TwtErrorLogs);
            }

            finally
            {
                counter_AccountFollwer--;
                //TweetAccountManager tweetAccountManager = new TweetAccountManager();
                tweetAccountManager.follower.logEvents.addToLogger -= new EventHandler(logEvents_Follower_addToLogger);
                tweetAccountManager.logEvents.addToLogger -= logEvents_Follower_addToLogger;

                if (counter_AccountFollwer == 0)
                {
                    if (btnStartFollowing.InvokeRequired)
                    {
                        btnStartFollowing.Invoke(new MethodInvoker(delegate
                        {
                            Globals.FollowerRunningText = string.Empty;
                            GlobusFileHelper.AppendStringToTextfileNewLine("Module Follow count Total: " + Globals.totalcountFollower , Globals.path_CountNoOfProcessDone);
                            AddToLog_Follower("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                            AddToLog_Follower("---------------------------------------------------------------------------------------------------------------------------");

                        }));
                    }
                }
            }
        }