private void btnSaveDelaySetting_Click(object sender, EventArgs e) { if (GlobusRegex.ValidateNumber(txtGlobalMinDelay.Text)) { Globals.MinGlobalDelay = Convert.ToInt32(txtGlobalMinDelay.Text); Globals.IsCheckValueOfDelay = true; } else { Globals.IsCheckValueOfDelay = false; MessageBox.Show("Please Fill right Delay value."); return; } if (GlobusRegex.ValidateNumber(txtGlobalMaxDelay.Text)) { Globals.MaxGlobalDelay = Convert.ToInt32(txtGlobalMaxDelay.Text); Globals.IsCheckValueOfDelay = true; } else { Globals.IsCheckValueOfDelay = false; MessageBox.Show("Please Fill right Delay value."); return; } if (Globals.MinGlobalDelay > 0 && Globals.MaxGlobalDelay > 0 && Globals.IsCheckValueOfDelay) { //Event_DisableDelaySettings(""); MessageBox.Show("Delay value saved."); } else { //Event_EnableDelaySettings(""); MessageBox.Show("Please Fill right Delay value."); return; } }
private void StartUnFollowingMultithreaded(object parameters) { try { if (IsStopFollowYourFollowers) { return; } // if (!IsStopFollowYourFollowers) { lstIsStopFollowYourFollowers.Add(Thread.CurrentThread); lstIsStopFollowYourFollowers.Distinct(); Thread.CurrentThread.IsBackground = true; } Array paramsArray = new object[2]; paramsArray = (Array)parameters; int NoOfFollwos = 0; KeyValuePair <string, TweetAccountManager> keyValue = (KeyValuePair <string, TweetAccountManager>)paramsArray.GetValue(0); string NofUnfollows = (string)paramsArray.GetValue(1); if (!string.IsNullOrEmpty(NofUnfollows) && NumberHelper.ValidateNumber(NofUnfollows)) { NoOfFollwos = Int32.Parse(NofUnfollows); } bool OtherUser = false; frmMain_NewUI.IsFollowerScreenName = true; List <string> list_userIDsToFollow = new List <string>(); TweetAccountManager tweetAccountManager = keyValue.Value; AddToLog_follow("[ " + DateTime.Now + " ] => [following Process Started For Account : " + keyValue.Key + " ]"); //Add to Threads Dictionary //AddThreadToDictionary(strModule(Module.Follow), tweetAccountManager.Username); tweetAccountManager.unFollower.logEvents.addToLogger += new EventHandler(logEvents_Follower_addToLogger); tweetAccountManager.logEvents.addToLogger += logEvents_Follower_addToLogger; if (!tweetAccountManager.IsLoggedIn) { tweetAccountManager.Login(); } if (!tweetAccountManager.IsLoggedIn) { AddToLog_follow("[ " + DateTime.Now + " ] => [ Not Logged In With Account : " + keyValue.Key + " ]"); return; } //////////////temp mehtod { } //AddToLog_Unfollow("Checking for Persons Not Followed Back"); Thread thread_UnFollowing = null; //Check Test box and anf useing feature box is checked TwitterDataScrapper objTwitterDataScrapper = new TwitterDataScrapper(); //if (rdoFollowYourFollowers.Checked) //thread_UnFollowing = new Thread(() => //{ // list_userIDsToFollow = tweetAccountManager.GetFollowYourFollowersList(); //}); list_userIDsToFollow = tweetAccountManager.GetFollowYourFollowersList(); if (GlobusRegex.ValidateNumber(txtfollowMinDelay.Text)) { followMinDelay = Convert.ToInt32(txtfollowMinDelay.Text); } if (GlobusRegex.ValidateNumber(txtfollowMaxDelay.Text)) { followMaxDelay = Convert.ToInt32(txtfollowMaxDelay.Text); } if (list_userIDsToFollow.Count > 0) { tweetAccountManager.FollowUsingURLs(list_userIDsToFollow, followMinDelay, followMaxDelay, OtherUser); } else { AddToLog_follow("[ " + DateTime.Now + " ] => [ No user id is available for Account : " + keyValue.Key + " ]"); } tweetAccountManager.unFollower.logEvents.addToLogger -= logEvents_Follower_addToLogger; tweetAccountManager.logEvents.addToLogger -= logEvents_Follower_addToLogger; } catch (Exception ex) { ErrorLogger.AddToErrorLogText(ex.Message); GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> StartUnFollowingMultithreaded() --> " + ex.Message, Globals.Path_UnfollowerErroLog); GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartUnFollowingMultithreaded() --> " + ex.Message, Globals.Path_TwtErrorLogs); } finally { counter_Account--; if (counter_Account == 0) { if (btnStartFollow.InvokeRequired) { btnStartFollow.Invoke(new MethodInvoker(delegate { AddToLog_follow("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]"); AddToLog_follow("---------------------------------------------------------------------------------------------------------------------------"); btnStartFollow.Cursor = Cursors.Default; })); } } } }
private void AssignProxy() { try { if (MessageBox.Show("Assign Private/Public proxies from Database???", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { List <string> lstProxies = proxyFetcher.GetPublicProxies(); if (lstProxies.Count > 0) { if (!string.IsNullOrEmpty(txtAccountsPerProxy.Text) && GlobusRegex.ValidateNumber(txtAccountsPerProxy.Text)) { try { accountsPerProxy = int.Parse(txtAccountsPerProxy.Text); } catch { accountsPerProxy = 10; } } AddLoggerAccountLoad("[ " + DateTime.Now + " ] => [ Please Wait Process Running ....! ]"); proxyFetcher.AssignProxiesToAccounts(lstProxies, accountsPerProxy); //AssignProxiesToAccounts(lstProxies); LoadDataGrid(); //Refresh Datagrid if (dgvAccount.RowCount > 1) { AddLoggerAccountLoad("[ " + DateTime.Now + " ] => [ All Proxy has been Alloted. ]"); } else { AddLoggerAccountLoad("[ " + DateTime.Now + " ] => [ Please Load Some Account ]"); } } else { MessageBox.Show("Please assign Private/Public proxies from Proxies Tab in Main Page OR Upload a proxies Text File"); } } catch { } } else { try { using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.Filter = "Text Files (*.txt)|*.txt"; ofd.InitialDirectory = Application.StartupPath; if (ofd.ShowDialog() == DialogResult.OK) { lstProxies = new List <string>(); lstProxies = GlobusFileHelper.ReadFiletoStringList(ofd.FileName); if (!string.IsNullOrEmpty(txtAccountsPerProxy.Text) && GlobusRegex.ValidateNumber(txtAccountsPerProxy.Text)) { try { accountsPerProxy = int.Parse(txtAccountsPerProxy.Text); } catch { accountsPerProxy = 10; } } AddLoggerAccountLoad("[ " + DateTime.Now + " ] => [ Please Wait Process Running ....! ]"); proxyFetcher.AssignProxiesToAccounts(lstProxies, accountsPerProxy); //AssignProxiesToAccounts(lstProxies); LoadDataGrid(); //Refresh Datagrid //AssignProxiesToAccountsModified(); } } } catch { } } AddLoggerAccountLoad("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]"); AddLoggerAccountLoad("----------------------------------------------------------------------------------------"); } catch { } }
private void StartMessagingMultithreaded(object parameters) { try { if (IsStopDirectMessages) { return; } if (!IsStopDirectMessages) { lstIsStopMessaging.Add(Thread.CurrentThread); lstIsStopMessaging.Distinct(); Thread.CurrentThread.IsBackground = true; } List <string> list_userIDsToFollow = new List <string>(); Array paramsArray = new object[2]; paramsArray = (Array)parameters; int NoOfFollwos = 0; KeyValuePair <string, TweetAccountManager> keyValue = (KeyValuePair <string, TweetAccountManager>)paramsArray.GetValue(0); string NofUnfollows = (string)paramsArray.GetValue(1); if (!string.IsNullOrEmpty(NofUnfollows) && NumberHelper.ValidateNumber(NofUnfollows)) { NoOfFollwos = Int32.Parse(NofUnfollows); } bool OtherUser = false; //frmMain_NewUI.IsFollowerScreenName = true; GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper(); TweetAccountManager tweetAccountManager = keyValue.Value; tweetAccountManager.unFollower.logEvents.addToLogger += new EventHandler(logEvents_Follower_addToLogger); tweetAccountManager.logEvents.addToLogger += logEvents_Follower_addToLogger; if (!tweetAccountManager.IsLoggedIn) { tweetAccountManager.Login(); } if (!tweetAccountManager.IsLoggedIn) { AddToLog_follow("[ " + DateTime.Now + " ] => [ Not Logged In With Account : " + keyValue.Key + " ]"); return; } if (GlobusRegex.ValidateNumber(txtDirectMessageMinDelay.Text)) { followMinDelay = Convert.ToInt32(txtDirectMessageMinDelay.Text); } if (GlobusRegex.ValidateNumber(txtDirectMessageMaxDelay.Text)) { followMaxDelay = Convert.ToInt32(txtDirectMessageMaxDelay.Text); } //TwitterDataScrapper objTwitterDataScrapper = new TwitterDataScrapper(); if (list_userIDsToFollowForDirectMessage.Count > 0 && chkFollowers.Checked) { list_userIDsToFollow.AddRange(list_userIDsToFollowForDirectMessage); } else { list_userIDsToFollow = tweetAccountManager.GetFollowerListForDirectMessage(); } if (list_userIDsToFollow.Count > 0) { tweetAccountManager.PostDirectMessage(list_userIDsToFollow, followMinDelay, followMaxDelay, OtherUser); } else { AddToLog_follow("[ " + DateTime.Now + " ] => [ No user id is available for Account : " + keyValue.Key + " ]"); } tweetAccountManager.unFollower.logEvents.addToLogger -= logEvents_Follower_addToLogger; tweetAccountManager.logEvents.addToLogger -= logEvents_Follower_addToLogger; } catch (Exception ex) { ErrorLogger.AddToErrorLogText(ex.Message); GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> StartUnFollowingMultithreaded() --> " + ex.Message, Globals.Path_UnfollowerErroLog); GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartUnFollowingMultithreaded() --> " + ex.Message, Globals.Path_TwtErrorLogs); } finally { counter_Account--; if (counter_Account == 0) { if (btnStartMessaging.InvokeRequired) { btnStartMessaging.Invoke(new MethodInvoker(delegate { AddToLog_follow("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]"); AddToLog_follow("---------------------------------------------------------------------------------------------------------------------------"); btnStartMessaging.Cursor = Cursors.Default; })); } } } }