예제 #1
0
        public void SearchConnection(ref GlobusHttpHelper GlobusHttpHelper, string Email, string Password, string proxyAddress, int ProxyPort, string proxyUsername, string proxyPassword)
        {
            try
            {
                Campaign_lstSearchconnectionThread.Clear();


                int  SearchMinDelay = 0;
                int  SearchMaxDelay = 0;
                bool DelayReset     = true;
                if (chkUniqueConnectin.Checked)
                {
                    ManageConnections.ConnectUsing_Search.UseuniqueConn = true;
                    foreach (string itemKeyword in CampainGroupCreate.Campaign_lstConnectionSearchKeyword)
                    {
                        try
                        {
                            ManageConnections.ConnectUsing_Search.lstQueuKeywords.Enqueue(itemKeyword);
                        }
                        catch { }
                    }
                }

                if (CampainGroupCreate.Campaign_lstConnectionSearchKeyword.Count == 0)
                {
                    MessageBox.Show("Please Add Keywords!");
                    AddLoggerLinkedInProfileManager("[ " + DateTime.Now + " ] => [ Please Add Keywords! ]");
                    return;
                }
                else
                {
                    Queue <string> que_SearchKeywords = new Queue <string>();
                    foreach (string itemKeyword in CampainGroupCreate.Campaign_lstConnectionSearchKeyword)
                    {
                        que_SearchKeywords.Enqueue(itemKeyword);
                    }

                    LinkedInMaster LinkedIn_Master = new LinkedInMaster();
                    ManageConnections.ConnectUsing_Search ConnectUsing_Search = new ConnectUsing_Search(Email, Password, proxyAddress, ProxyPort.ToString(), proxyUsername, proxyPassword, que_SearchKeywords);
                    ManageConnections.ConnectUsing_Search.ConnectSearchUsingkeyword(ref ConnectUsing_Search, SearchMinDelay, SearchMaxDelay);

                    //ConnectUsing_Search.ConnectionSearch();

                    //ConnectUsingSearch obj_ConnectUsingSearch = new ConnectUsingSearch(Email, Password, proxyAddress, ProxyPort.ToString(), proxyUsername, proxyPassword);
                    //obj_ConnectUsingSearch.ConnectionSearch();
                }
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Connection --> btnSearchConnection_Click() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Connection --> btnSearchConnection_Click() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddConnectionErrorLogs);
            }
        }
예제 #2
0
        private void StartAcceptInvitationMultiThread(object Parameter)
        {
            string Account = string.Empty;

            try
            {
                try
                {
                    if (IsStop)
                    {
                        return;
                    }

                    if (!IsStop)
                    {
                        lstThread_AcceptInvitation.Add(Thread.CurrentThread);
                        lstThread_AcceptInvitation        = lstThread_AcceptInvitation.Distinct().ToList();
                        Thread.CurrentThread.IsBackground = true;
                    }
                }
                catch
                {
                }

                Array paramsArray = new object[1];
                paramsArray = (Array)Parameter;
                KeyValuePair <string, LinkedInMaster> item = (KeyValuePair <string, LinkedInMaster>)paramsArray.GetValue(0);
                GlobusHttpHelper HttpHelper = new GlobusHttpHelper();
                LinkedinLogin    Login      = new LinkedinLogin();

                LinkedInMaster LinkedIn_Master = item.Value;
                string         linkedInKey     = item.Key;
                Account = item.Key;

                Login.accountUser   = item.Key;
                Login.accountPass   = item.Value._Password;
                Login.proxyAddress  = item.Value._ProxyAddress;
                Login.proxyPort     = item.Value._ProxyPort;
                Login.proxyUserName = item.Value._ProxyUsername;
                Login.proxyPassword = item.Value._ProxyPassword;

                ClsAcceptInvitations obj_ClsAcceptInvitations = new ClsAcceptInvitations(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword);

                // Add Event
                Login.logger.addToLogger += new EventHandler(AcceptInvitationsLogEvents_addToLogger);
                obj_ClsAcceptInvitations.acceptInvitationsLogEvents.addToLogger += new EventHandler(AcceptInvitationsLogEvents_addToLogger);

                if (!Login.IsLoggedIn)
                {
                    //AddAcceptInvitationsLogger("[ " + DateTime.Now + " ] => [ Logging In With Account " + item.Key + " ]");

                    Login.LoginHttpHelper(ref HttpHelper);
                }

                if (Login.IsLoggedIn)
                {
                    obj_ClsAcceptInvitations.StartAcceptInvitations(ref HttpHelper);
                }
                else
                {
                    AddAcceptInvitationsLogger("[ " + DateTime.Now + " ] => [ Couldn't Login With Account " + item.Key + " ]");
                }

                // Remove Event
                Login.logger.addToLogger -= new EventHandler(AcceptInvitationsLogEvents_addToLogger);
                obj_ClsAcceptInvitations.acceptInvitationsLogEvents.addToLogger -= new EventHandler(AcceptInvitationsLogEvents_addToLogger);
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Accept Invitation --> StartAcceptInvitation() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Accept Invitation --> StartAcceptInvitation() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddConnectionErrorLogs);
            }

            finally
            {
                counter_AcceptInvitation--;
                if (counter_AcceptInvitation == 0)
                {
                    BtnAccectInvitation.Invoke(new MethodInvoker(delegate
                    {
                        AddAcceptInvitationsLogger("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                        AddAcceptInvitationsLogger("-------------------------------------------------------------------------------------------------------------------");
                        BtnAccectInvitation.Cursor = Cursors.Default;
                    }));
                }
            }
        }
예제 #3
0
        private void AddaCoverMulti_List(object oo)
        {
            try
            {
                if (!IsCloseCalledForProfileManager)
                {
                    try
                    {
                        lstThreadForLinkedInProfileManager.Add(Thread.CurrentThread);
                        lstThreadForLinkedInProfileManager.Distinct();
                        Thread.CurrentThread.IsBackground = true;
                    }
                    catch
                    {
                    }
                    Array paramArr = new object[2];
                    paramArr = (Array)oo;

                    LinkedInMaster linkedInMaster = (LinkedInMaster)paramArr.GetValue(0);//KeyValuePair<string, Facebooker> item = (KeyValuePair<string, Facebooker>)paramArr.GetValue(0);
                    //  KeyValuePair<string, LinkedInMaster> item = (KeyValuePair<string, LinkedInMaster>)paramArr.GetValue(0);

                    //Facebooker facebooker = item.Value;

                    GlobusHttpHelper HttpHelper = new GlobusHttpHelper();
                    LinkedinLogin    Login      = new LinkedinLogin();



                    string accountUser = linkedInMaster._Username;

                    string accountPass   = linkedInMaster._Password;
                    string proxyAddress  = linkedInMaster._ProxyAddress;
                    string proxyPort     = linkedInMaster._ProxyPort;
                    string proxyUserName = linkedInMaster._ProxyUsername;
                    string proxyPassword = linkedInMaster._ProxyPassword;

                    if (!Login.IsLoggedIn)
                    {
                        //Login.LoginHttpHelper(ref HttpHelper);
                        Login.logger.addToLogger += new EventHandler(logger_LinkedInProfileManageraddToLogger);
                        Login.LoginHttpHelper(ref HttpHelper, accountUser, accountPass, proxyAddress, proxyUserName, proxyPassword, proxyPort);
                    }

                    if (Login.IsLoggedIn)
                    {
                        LinkedinProfileImgUploader obj_LinkedinProfileManager = new LinkedinProfileImgUploader(accountUser, accountPass, proxyAddress, proxyPort, proxyUserName, proxyPassword);

                        ////facebooker.loginChecker.pumpMessageEvent.addToLogger += ProfileManagerLogEvents_addToLogger;

                        obj_LinkedinProfileManager.LinkedInProfileManagerLogEvents.addToLogger += new EventHandler(logger_LinkedInProfileManageraddToLogger);

                        //facebooker.StartAddaCover(ref obj_AddaCover, lstCoverPics);

                        obj_LinkedinProfileManager.SetProfilePic(ref HttpHelper);


                        ////facebooker.loginChecker.pumpMessageEvent.addToLogger -= ProfileManagerLogEvents_addToLogger;
                        Login.logger.addToLogger -= new EventHandler(logger_LinkedInProfileManageraddToLogger);
                        obj_LinkedinProfileManager.LinkedInProfileManagerLogEvents.addToLogger -= new EventHandler(logger_LinkedInProfileManageraddToLogger);
                    }
                    else
                    {
                        AddLoggerLinkedInProfileManager("[ " + DateTime.Now + " ] => [ Couldn't Login With Username >>> " + accountUser + " ]");
                        return;
                    }
                }
            }
            catch
            {
            }

            finally
            {
                if (!IsCloseCalled)
                {
                    count_ThreadController--;
                    lock (lockr_ThreadController)
                    {
                        if (!IsCloseCalled)
                        {
                            Monitor.Pulse(lockr_ThreadController);
                        }
                    }
                }
            }
        }
예제 #4
0
        private void AddaCoverMulti_List(object oo)
        {
            try
            {
                if (!IsCloseCalledForProfileManager)
                {
                    try
                    {
                        lstThreadForLinkedInProfileManager.Add(Thread.CurrentThread);
                        lstThreadForLinkedInProfileManager.Distinct();
                        Thread.CurrentThread.IsBackground = true;
                    }
                    catch
                    {
                    }
                    Array paramArr = new object[2];
                    paramArr = (Array)oo;

                    LinkedInMaster linkedInMaster = (LinkedInMaster)paramArr.GetValue(0);//KeyValuePair<string, Facebooker> item = (KeyValuePair<string, Facebooker>)paramArr.GetValue(0);
                    //  KeyValuePair<string, LinkedInMaster> item = (KeyValuePair<string, LinkedInMaster>)paramArr.GetValue(0);

                    //Facebooker facebooker = item.Value;

                    GlobusHttpHelper HttpHelper = new GlobusHttpHelper();
                    LinkedinLogin    Login      = new LinkedinLogin();


                    string accountUser   = linkedInMaster._Username;
                    string accountPass   = linkedInMaster._Password;
                    string proxyAddress  = linkedInMaster._ProxyAddress;
                    string proxyPort     = linkedInMaster._ProxyPort;
                    string proxyUserName = linkedInMaster._ProxyUsername;
                    string proxyPassword = linkedInMaster._ProxyPassword;

                    linkedInMaster.logger.addToLogger += new EventHandler(logger_LinkedInProfileManageraddToLogger);
                    linkedInMaster.LoginHttpHelper(ref HttpHelper);

                    if (linkedInMaster.IsLoggedIn)
                    {
                        LinkedinProfileImgUploader obj_LinkedinProfileManager = new LinkedinProfileImgUploader(accountUser, accountPass, proxyAddress, proxyPort, proxyUserName, proxyPassword);

                        obj_LinkedinProfileManager.LinkedInProfileManagerLogEvents.addToLogger += logger_LinkedInProfileManageraddToLogger;

                        NativeMethods.DeleteUrlCacheEntry("http://www.linkedin.com/");

                        obj_LinkedinProfileManager.SetProfilePic(ref HttpHelper);

                        NativeMethods.DeleteUrlCacheEntry("http://www.linkedin.com/");

                        obj_LinkedinProfileManager.LinkedInProfileManagerLogEvents.addToLogger -= new EventHandler(logger_LinkedInProfileManageraddToLogger);
                    }

                    linkedInMaster.logger.addToLogger -= new EventHandler(logger_LinkedInProfileManageraddToLogger);
                }
            }
            catch
            {
            }

            finally
            {
                if (!IsCloseCalled)
                {
                    count_ThreadController--;
                    lock (lockr_ThreadController)
                    {
                        if (!IsCloseCalled)
                        {
                            Monitor.Pulse(lockr_ThreadController);
                        }
                    }
                }
            }
        }
예제 #5
0
        private void thread_AddaCoverStart()
        {
            try
            {
                if (!IsCloseCalledForProfileManager)
                {
                    try
                    {
                        lstThreadForLinkedInProfileManager.Add(Thread.CurrentThread);
                        lstThreadForLinkedInProfileManager.Distinct();
                        Thread.CurrentThread.IsBackground = true;
                    }
                    catch
                    {
                    }

                    //int numberOfAccountPatch = 20;

                    List <List <string> > list_listAccounts = new List <List <string> >();

                    #region
                    if (Globals.listAccounts.Count > 0)
                    {
                        if (threads == 0)
                        {
                            // numberOfAccountPatch = RandomNumberGenerator.GenerateRandom(0, lstGroupURLsFile.Count - 1);
                        }
                        list_listAccounts = ListUtilities.Split(Globals.listAccounts, threads);
                        foreach (List <string> listAccounts in list_listAccounts)
                        {
                            try
                            {
                                foreach (string account in listAccounts)
                                {
                                    lock (lockr_ThreadController)
                                    {
                                        try
                                        {
                                            if (count_ThreadController >= listAccounts.Count)
                                            {
                                                Monitor.Wait(lockr_ThreadController);
                                            }

                                            string acc = account.Remove(account.IndexOf(':'));

                                            //Run a separate thread for each account
                                            LinkedInMaster item = null;
                                            LinkedInManager.linkedInDictionary.TryGetValue(acc, out item);

                                            if (item != null)
                                            {
                                                Thread AddaCoverThread = new Thread(AddaCoverMulti_List);
                                                AddaCoverThread.Name         = "workerThread_AddaCover_" + acc;
                                                AddaCoverThread.IsBackground = true;

                                                try
                                                {
                                                    // dictionary_LikerThreads.Add(AddaCoverThread.Name, AddaCoverThread);
                                                }
                                                catch { }

                                                AddaCoverThread.Start(new object[] { item });

                                                count_ThreadController++;
                                                //tempCounterAccounts++;
                                            }
                                        }
                                        catch { }
                                    }
                                }
                            }
                            catch
                            {
                            }
                        }
                    }

                    else
                    {
                        MessageBox.Show("Please Upload The Accounts !");
                        return;
                    }
                    #endregion
                }
            }
            catch
            {
            }
        }
예제 #6
0
        private bool Login_InBoardProGetData()
        {
            bool isLoggedin = false;

            try
            {
                try
                {
                    AddLoggerCompanyEmployeeSearch("[ " + DateTime.Now + " ] => [ Process Running Please wait...]");

                    if (SearchCriteria.SignIN)
                    {
                        LinkedinLogin Login = new LinkedinLogin();
                        //For Sign Out
                        Login.LogoutHttpHelper();
                        SearchCriteria.SignOut = true;
                    }

                    if (SearchCriteria.SignOut)
                    {
                        SearchCriteria.LoginID = string.Empty;
                        if (LinkedInManager.linkedInDictionary.Count() > 0)
                        {
                            try
                            {
                                object temp = null;
                                comboBoxemail.Invoke(new MethodInvoker(delegate
                                {
                                    temp = comboBoxemail.SelectedItem;
                                }));

                                if (temp != null)
                                {
                                    //GlobusHttpHelper httpHelper = new GlobusHttpHelper();
                                    string acc = "";
                                    comboBoxemail.Invoke(new MethodInvoker(delegate
                                    {
                                        acc = comboBoxemail.SelectedItem.ToString();
                                        SearchCriteria.LoginID = comboBoxemail.SelectedItem.ToString();//change 21/08/12
                                    }));
                                    //string acc = account.Remove(account.IndexOf(':'));

                                    //Run a separate thread for each account
                                    LinkedInMaster item = null;
                                    LinkedInManager.linkedInDictionary.TryGetValue(acc, out item);

                                    //item.logger.addToLogger += LinkedinSearchLogEvents_addToLogger;
                                    item.LoginHttpHelper(ref HttpHelper);

                                    if (item.IsLoggedIn)
                                    {
                                        AddLoggerCompanyEmployeeSearch("[ " + DateTime.Now + " ] => [ Logged in With : " + acc + " ]");
                                        isLoggedin = true;
                                    }

                                    if (SearchCriteria.loginREsponce.Contains("Your LinkedIn account has been temporarily restricted"))
                                    {
                                        AddLoggerCompanyEmployeeSearch("[ " + DateTime.Now + " ] => [ " + SearchCriteria.LoginID + "Your LinkedIn account has been temporarily restricted ]");
                                    }

                                    if (SearchCriteria.loginREsponce.Contains("Please confirm your email address"))
                                    {
                                        AddLoggerCompanyEmployeeSearch("[ " + DateTime.Now + " ] => [ " + SearchCriteria.LoginID + " account has been temporarily restricted Please confirm your email address ]");
                                    }

                                    if (!item.IsLoggedIn)
                                    {
                                        AddLoggerCompanyEmployeeSearch("[ " + DateTime.Now + " ] => [ Couldn't Login With : " + acc + " ]");
                                    }
                                    // InBoardPro.LinkedinSearch obj_LinkedinSearch = new InBoardPro.LinkedinSearch(item._Username, item._Password, item._ProxyAddress, item._ProxyPort, item._ProxyUsername, item._ProxyPassword);
                                    SearchCriteria.SignIN  = true;
                                    SearchCriteria.SignOut = false;
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> comboBoxemail_SelectedIndexChanged() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> comboBoxemail_SelectedIndexChanged() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPreScrapperErrorLogs);
                            }
                        }
                    }
                }
                catch
                {
                }
            }
            catch
            {
            }

            return(isLoggedin);
        }
예제 #7
0
        public void SendInviteUsingKeyWords(object Parameter)
        {
            try
            {
                if (IsStop)
                {
                    return;
                }

                if (!IsStop)
                {
                    lstSearchconnectionThread.Add(Thread.CurrentThread);
                    lstSearchconnectionThread.Distinct().ToList();
                    Thread.CurrentThread.IsBackground = true;
                }
            }
            catch
            {
            }

            string Account     = string.Empty;
            Array  paramsArray = new object[1];

            paramsArray = (Array)Parameter;

            KeyValuePair <string, LinkedInMaster> item = (KeyValuePair <string, LinkedInMaster>)paramsArray.GetValue(0);

            int SearchMinDelay          = Convert.ToInt32(paramsArray.GetValue(1));
            int SearchMaxDelay          = Convert.ToInt32(paramsArray.GetValue(2));
            GlobusHttpHelper HttpHelper = new GlobusHttpHelper();
            LinkedinLogin    Login      = new LinkedinLogin();

            LinkedInMaster LinkedIn_Master = item.Value;
            string         linkedInKey     = item.Key;

            Account = item.Key;

            Login.logger.addToLogger += new EventHandler(loggerAddConnection_addToLogger);

            if (chk_InvitePerDay.Checked)
            {
                AddLoggerManageConnection("[ " + DateTime.Now + " ] => [ Checking Invites Per Day ]");
                SearchCriteria.NumberOfRequestPerKeyword = 0;
                SearchCriteria.NumberOfrequestPerDay     = true;
                if (!string.IsNullOrEmpty(txt_campMaximumNoRetweet.Text) && NumberHelper.ValidateNumber(txt_campMaximumNoRetweet.Text))
                {
                    SearchCriteria.NumberOfRequestPerKeyword = Convert.ToInt32(txt_campMaximumNoRetweet.Text);
                    AddLoggerManageConnection("[ " + DateTime.Now + " ] => [ " + SearchCriteria.NumberOfRequestPerKeyword + " Maximum No Of Invites Per Day ]");
                }
                else
                {
                    SearchCriteria.NumberOfRequestPerKeyword = 10;
                    AddLoggerManageConnection("[ " + DateTime.Now + " ] => [ Setting Maximum No Of Invites Per Day as 10 ]");
                }

                clsDBQueryManager DbQueryManager = new clsDBQueryManager();
                DataSet           Ds             = DbQueryManager.SearchWithInvite(Account, "SearchWithInvite");

                int TodayTweet = Ds.Tables["tb_SearchWithInvite"].Rows.Count;
                SearchCriteria.AlreadyRequestedUser = TodayTweet;
                AddLoggerManageConnection("[ " + DateTime.Now + " ] => [ " + TodayTweet + " Already Invites today ]");

                if (TodayTweet >= SearchCriteria.NumberOfRequestPerKeyword)
                {
                    AddLoggerManageConnection("[ " + DateTime.Now + " ] => [ Already Invited : " + SearchCriteria.NumberOfRequestPerKeyword + " ]");
                    AddLoggerManageConnection("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                    return;
                }
            }


            try
            {
                {
                    Queue <string> que_SearchKeywords = new Queue <string>();

                    foreach (string itemKeyword in _lstConnectionSearchKeyword)
                    {
                        que_SearchKeywords.Enqueue(itemKeyword);
                    }

                    ManageConnections.ConnectUsingSearchKeywod ConnectUsing_Search = new ConnectUsingSearchKeywod(item.Value._Username, item.Value._Password, item.Value._ProxyAddress, item.Value._ProxyPort, item.Value._ProxyUsername, item.Value._ProxyPassword, que_SearchKeywords);
                    ManageConnections.ConnectUsing_Search.SearchUsingkeywordForInvite(ref ConnectUsing_Search, SearchMinDelay, SearchMaxDelay);
                }
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Connection --> SendInviteUsingKeyWords() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Connection --> SendInviteUsingKeyWords() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddConnectionErrorLogs);
            }
            finally
            {
                counter_Search_connection--;
                if (counter_Search_connection == 0)
                {
                    if (btnSearchKeyword.InvokeRequired)
                    {
                        btnSearchKeyword.Invoke(new MethodInvoker(delegate
                        {
                            AddLoggerManageConnection("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                            AddLoggerManageConnection("---------------------------------------------------------------------------------------------------------------------------");
                            btnSearchKeyword.Cursor = Cursors.Default;
                        }));
                    }
                }
            }
        }
        private void StartSendInvitation()
        {
            try
            {
                int NoofThread = 5;
                if (NumberHelper.ValidateNumber(TxtNoOfThreads.Text.Trim()))
                {
                    NoofThread = Convert.ToInt32(TxtNoOfThreads.Text.Trim());
                    ThreadPool.SetMaxThreads(NoofThread, 5);
                }
                else
                {
                    AddInviteMemberThroughProfUrlLogger("[ " + DateTime.Now + " ] => [ Please Fill Integer value in TextBox(No. of Threads) ]");
                    TxtNoOfThreads.Text = "5";
                }

                if (isDivideURLsAmongAccounts && LinkedInManager.linkedInDictionary.Count > 0)
                {
                    List <List <string> > list_listTargetURLs = new List <List <string> >();

                    List <List <string> > list_listAccounts = new List <List <string> >();

                    try
                    {
                        list_listAccounts = ListUtilities.Split(Globals.listAccounts, NoofThread);
                    }
                    catch { }

                    #region Divide URLs among accounts

                    #region User Divude Checked
                    if (isDivideURLsAmongAccounts)
                    {
                        int splitNo = 0;
                        splitNo = lstProfileURL.Count / Globals.listAccounts.Count;

                        //int remainder = grouplist.Count % Globals.listAccounts.Count;
                        //if (remainder != 0 && splitNo != 0)
                        //{
                        //    splitNo = splitNo + 1;
                        //}

                        //else if (rdBtnDivideByGivenNo.Checked)
                        //{
                        //    if (!string.IsNullOrEmpty(txtScrapeNoOfUsers.Text) && NumberHelper.ValidateNumber(txtScrapeNoOfUsers.Text))
                        //    {
                        //        int res = Convert.ToInt32(txtScrapeNoOfUsers.Text);
                        //        splitNo = res;//listUserIDs.Count / res;
                        //    }
                        //}
                        if (splitNo == 0)
                        {
                            splitNo = Globals.listAccounts.Count; //RandomNumberGenerator.GenerateRandom(0, grouplist.Count - 1);
                        }
                        list_listTargetURLs = ListUtilities.Split(lstProfileURL, splitNo);
                    }


                    #endregion

                    #endregion


                    int index = 0;
                    while (index <= list_listTargetURLs.Count - 1)
                    {
                        foreach (List <string> listAccounts in list_listAccounts)
                        {
                            if (index > list_listTargetURLs.Count - 1)
                            {
                                break;
                            }
                            //int tempCounterAccounts = 0;
                            try
                            {
                                foreach (string account in listAccounts)
                                {
                                    try
                                    {
                                        if (index > list_listTargetURLs.Count - 1)
                                        {
                                            break;
                                        }

                                        List <string> listGrpURLs_PerAccount = new List <string>();
                                        listGrpURLs_PerAccount = list_listTargetURLs[index];

                                        lock (lockr_ThreadController)
                                        {
                                            try
                                            {
                                                if (count_ThreadController >= listAccounts.Count)
                                                {
                                                    Monitor.Wait(lockr_ThreadController);
                                                }


                                                string acc = account.Remove(account.IndexOf(':'));

                                                //Run a separate thread for each account

                                                LinkedInMaster item = null;
                                                LinkedInManager.linkedInDictionary.TryGetValue(acc, out item);

                                                if (item != null)
                                                {
                                                    Thread likerThread = null;

                                                    // else
                                                    {
                                                        //Send only 1 request on a url
                                                        //if ane account has sent request, no other account shud send more request
                                                        likerThread = new Thread(StartSendInvitationMultyThread_DivideUrlsAccordingAccount);

                                                        likerThread.Name         = "workerThread_Requestsent_" + acc;
                                                        likerThread.IsBackground = true;

                                                        likerThread.Start(new object[] { item, listGrpURLs_PerAccount });
                                                        index++;
                                                    }

                                                    //likerThread.Name = "workerThread_Requestsent_" + acc;
                                                    //likerThread.IsBackground = true;

                                                    //try
                                                    //{
                                                    //    dictionary_GroupJoiningThreads.Add(likerThread.Name, likerThread);
                                                    //}
                                                    //catch { }

                                                    //likerThread.Start(new object[] { item, queueGrpurl });

                                                    count_ThreadController++;
                                                    //tempCounterAccounts++;
                                                }
                                            }
                                            catch { }
                                        }
                                    }
                                    catch { }
                                }
                            }
                            catch { }
                        }
                    }
                }
                else
                {
                    if (LinkedInManager.linkedInDictionary.Count > 0)
                    {
                        try
                        {
                            foreach (KeyValuePair <string, LinkedInMaster> item in LinkedInManager.linkedInDictionary)
                            {
                                ThreadPool.SetMaxThreads(NoofThread, 5);

                                ThreadPool.QueueUserWorkItem(new WaitCallback(StartSendInvitationMultyThread), new object[] { item });
                                //StartSendInvitationMultyThread(new object[] { item });

                                // Thread.Sleep(1000);
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Accept Invitation --> StartAcceptInvitation() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Accept Invitation --> StartAcceptInvitation() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddConnectionErrorLogs);
                        }
                    }
                    else
                    {
                        AddInviteMemberThroughProfUrlLogger("[ " + DateTime.Now + " ] => [ Please Load Account ! ]");
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error >>> " + ex.StackTrace);
            }
        }
        private void StartSendInvitationMultyThread_DivideUrlsAccordingAccount(object Parameter)
        {
            string        Account       = string.Empty;
            List <string> lstProfileUrl = new List <string>();

            try
            {
                try
                {
                    if (IsStop)
                    {
                        return;
                    }

                    if (!IsStop)
                    {
                        lstThread_AcceptInvitation.Add(Thread.CurrentThread);
                        lstThread_AcceptInvitation        = lstThread_AcceptInvitation.Distinct().ToList();
                        Thread.CurrentThread.IsBackground = true;
                    }
                }
                catch
                {
                }

                Array paramsArray = new object[2];

                paramsArray = (Array)Parameter;

                // KeyValuePair<string, LinkedInMaster> item = (KeyValuePair<string, LinkedInMaster>)paramsArray.GetValue(0);

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

                GlobusHttpHelper HttpHelper = new GlobusHttpHelper();
                LinkedinLogin    Login      = new LinkedinLogin();

                LinkedInMaster item = (LinkedInMaster)paramsArray.GetValue(0); //item.Value;
                //string linkedInKey = item.Key;
                //Account = item.Key;

                //Login.accountUser = item.Key;
                //Login.accountPass = item.Value._Password;
                //Login.proxyAddress = item.Value._ProxyAddress;
                //Login.proxyPort = item.Value._ProxyPort;
                //Login.proxyUserName = item.Value._ProxyUsername;
                //Login.proxyPassword = item.Value._ProxyPassword;

                Login.accountUser   = item._Username;
                Login.accountPass   = item._Password;
                Login.proxyAddress  = item._ProxyAddress;
                Login.proxyPort     = item._ProxyPort;
                Login.proxyUserName = item._ProxyUsername;
                Login.proxyPassword = item._ProxyPassword;

                ClsInviteMemberThroughProfileURL obj_ClsInviteMemberThroughProfileURL = new ClsInviteMemberThroughProfileURL(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword);

                // Add Event
                Login.logger.addToLogger += new EventHandler(AcceptInvitationsLogEvents_addToLogger);
                obj_ClsInviteMemberThroughProfileURL.acceptInvitationsLogEvents.addToLogger += new EventHandler(AcceptInvitationsLogEvents_addToLogger);

                if (!Login.IsLoggedIn)
                {
                    // AddAcceptInvitationsLogger("Logging In With Account" + Login.accountUser);

                    Login.LoginHttpHelper(ref HttpHelper);
                }

                if (Login.IsLoggedIn)
                {
                    obj_ClsInviteMemberThroughProfileURL.StartSendInvitations_DivideUrlsAccordingAccount(ref HttpHelper, lstProfileUrl);
                }
                else
                {
                    AddInviteMemberThroughProfUrlLogger("[ " + DateTime.Now + " ] => [ Couldn't Login With Account " + Login.accountUser + " ]");
                }

                // Remove Event
                Login.logger.addToLogger -= new EventHandler(AcceptInvitationsLogEvents_addToLogger);
                obj_ClsInviteMemberThroughProfileURL.acceptInvitationsLogEvents.addToLogger -= new EventHandler(AcceptInvitationsLogEvents_addToLogger);
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Accept Invitation --> StartAcceptInvitation() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Accept Invitation --> StartAcceptInvitation() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddConnectionErrorLogs);
            }

            finally
            {
                lock (lockr_ThreadController)
                {
                    count_ThreadController--;
                    Monitor.Pulse(lockr_ThreadController);
                }
            }
        }
예제 #10
0
        private void LinkedInStartScrapperThread()
        {
            foreach (string[] itemArr in listArrSftwareinputData)
            {
                try
                {
                    LinkedInMaster objLinkedInMaster = new LinkedInMaster();
                    if (!itemArr[0].Contains("PostalCode"))
                    {
                        try
                        {
                            if (!string.IsNullOrEmpty(itemArr[0]))
                            {
                                objLinkedInMaster._Postalcode = itemArr[0];
                            }
                        }
                        catch { }
                        try
                        {
                            if (!string.IsNullOrEmpty(itemArr[1]))
                            {
                                objLinkedInMaster._Distance = itemArr[1];
                            }
                        }
                        catch { }
                        try
                        {
                            if (!string.IsNullOrEmpty(itemArr[2]))
                            {
                                objLinkedInMaster._IndustryType = itemArr[2];
                            }
                        }
                        catch { }
                        try
                        {
                            if (!string.IsNullOrEmpty(itemArr[3]))
                            {
                                objLinkedInMaster._LastName = itemArr[3];
                            }
                        }
                        catch { }
                        try
                        {
                            if (!string.IsNullOrEmpty(itemArr[4]))
                            {
                                objLinkedInMaster._Username = itemArr[4];
                            }
                        }
                        catch { }
                        try
                        {
                            if (!string.IsNullOrEmpty(itemArr[5]))
                            {
                                objLinkedInMaster._Password = itemArr[5];
                            }
                        }
                        catch { }
                        try
                        {
                            // objLinkedInMaster._ProxyAddress = itemArr[6];
                            if (!string.IsNullOrEmpty(itemArr[6]))
                            {
                                string[] words = itemArr[6].Split(new char[] { char.Parse(":") });
                                if (words.Count() > 1)
                                {
                                    try
                                    {
                                        string Portno = words[1];
                                        objLinkedInMaster._ProxyPort    = Portno;
                                        objLinkedInMaster._ProxyAddress = words[0]; //+ ":" + words[1] + ":" + words[2] + ":" + words[3];
                                    }
                                    catch { }
                                }
                                else
                                {
                                    try
                                    {
                                        objLinkedInMaster._ProxyAddress = words[0];// +":" + words[1] + ":" + words[2] + ":" + words[3];
                                    }
                                    catch { }
                                }
                            }
                            //string[] Arrport=Regex.Split(itemArr[6], ":");
                        }
                        catch { }
                        try
                        {
                            if (!string.IsNullOrEmpty(itemArr[7]))
                            {
                                objLinkedInMaster._ProxyPassword = itemArr[7];
                            }
                        }
                        catch { }
                        try
                        {
                            LinkedInManager.linkedInDictionaryExcelInput.Add(objLinkedInMaster._Username + ":" + objLinkedInMaster._LastName + ":" + objLinkedInMaster._Postalcode, objLinkedInMaster);
                        }
                        catch { }
                    }
                }
                catch { }
            }
            Thread objloginthread = new Thread(StartScarpperLoginUsingThreadPool);

            objloginthread.Start();
        }
예제 #11
0
        private void InBoardProGetDataThread()
        {
            foreach (string[] itemArr in excelData)
            {
                try
                {
                    LinkedInMaster objLinkedInMaster = new LinkedInMaster();
                    try
                    {
                        if (!string.IsNullOrEmpty(itemArr[0]))
                        {
                            objLinkedInMaster._Postalcode = itemArr[0];
                        }
                    }
                    catch { }
                    try
                    {
                        if (!string.IsNullOrEmpty(itemArr[1]))
                        {
                            objLinkedInMaster._Distance = itemArr[1];
                        }
                    }
                    catch { }
                    try
                    {
                        if (!string.IsNullOrEmpty(itemArr[2]))
                        {
                            objLinkedInMaster._IndustryType = itemArr[2];
                        }
                    }
                    catch { }
                    try
                    {
                        if (!string.IsNullOrEmpty(itemArr[3]))
                        {
                            objLinkedInMaster._LastName = itemArr[3];
                        }
                    }
                    catch { }
                    try
                    {
                        if (!string.IsNullOrEmpty(itemArr[4]))
                        {
                            objLinkedInMaster._Username = itemArr[4];
                        }
                    }
                    catch { }
                    try
                    {
                        if (!string.IsNullOrEmpty(itemArr[5]))
                        {
                            objLinkedInMaster._Password = itemArr[5];
                        }
                    }
                    catch { }
                    try
                    {
                        objLinkedInMaster._ProxyAddress = itemArr[6];
                        if (!string.IsNullOrEmpty(itemArr[6]))
                        {
                            string[] words = itemArr[6].Split(new char[] { char.Parse(":") });
                            if (words.Count() > 1)
                            {
                                try
                                {
                                    string Portno = words[1];
                                    objLinkedInMaster._ProxyPort    = Portno;
                                    objLinkedInMaster._ProxyAddress = words[0];// +":" + words[1] + ":" + words[2] + ":" + words[3];
                                }
                                catch { }
                            }
                            else
                            {
                                try
                                {
                                    objLinkedInMaster._ProxyAddress = words[0];//+ ":" + words[1] + ":" + words[2] + ":" + words[3];
                                }
                                catch { }
                            }
                        }
                        // string[] itemss=
                    }
                    catch { }
                    try
                    {
                        if (!string.IsNullOrEmpty(itemArr[7]))
                        {
                            objLinkedInMaster._ProxyPassword = itemArr[7];
                        }
                    }
                    catch { }
                    try
                    {
                        if (!string.IsNullOrEmpty(itemArr[0]) && !string.IsNullOrEmpty(itemArr[1]))
                        {
                            LinkedInManager.linkedInDictionaryExcelInput.Add(objLinkedInMaster._Username + ":" + objLinkedInMaster._LastName + ":" + objLinkedInMaster._Postalcode, objLinkedInMaster);
                        }
                        else
                        {
                            break;
                        }
                    }
                    catch { }
                }
                catch { }
            }
            Thread objloginthread = new Thread(StartLoginUsingThreadPool);

            objloginthread.Start();
        }
예제 #12
0
        private void LoadDataGrid()
        {
            Ld_lstAccountCheckerEmail.Clear();
            try
            {
                DataTable dt = objclsLDAccount.SelectAccoutsForGridView();

                //ds = new DataSet();
                //ds.Tables.Add(dt);

                try
                {
                    this.Invoke(new MethodInvoker(delegate
                    {
                        lblAccountStatus.Text = "Process Running !";
                    }));
                }
                catch
                {
                }



                dgvAccount.Invoke(new MethodInvoker(delegate
                {
                    dgvAccount.DataSource = dt;
                }));

                Globals.listAccounts.Clear();
                LinkedInManager.linkedInDictionary.Clear();


                ///Add Twitter instances to TweetAccountContainer.dictionary_TweetAccount
                foreach (DataRow dRow in dt.Rows)
                {
                    try
                    {
                        LinkedInMaster LinkedIn = new LinkedInMaster();
                        LinkedIn._Username      = dRow[0].ToString();
                        LinkedIn._Password      = dRow[1].ToString();
                        LinkedIn._ProxyAddress  = dRow[2].ToString();
                        LinkedIn._ProxyPort     = dRow[3].ToString();
                        LinkedIn._ProxyUsername = dRow[4].ToString();
                        LinkedIn._ProxyPassword = dRow[5].ToString();

                        //if (!string.IsNullOrEmpty(dRow[7].ToString()))
                        //{
                        //    LinkedIn.profileStatus = int.Parse(dRow[7].ToString());
                        //}
                        //if (Globals.IsFreeVersion)
                        //{
                        //    if (dt.Rows.Count >= 5)
                        //    {
                        //        InBoardPro.FrmFreeTrial frmFreeTrial = new InBoardPro.FrmFreeTrial();
                        //        frmFreeTrial.TopMost = true;
                        //        frmFreeTrial.BringToFront();
                        //        frmFreeTrial.ShowDialog();
                        //        break;
                        //    }
                        //}


                        Globals.listAccounts.Add(LinkedIn._Username + ":" + LinkedIn._Password + ":" + LinkedIn._ProxyAddress + ":" + LinkedIn._ProxyPort + ":" + LinkedIn._ProxyUsername + ":" + LinkedIn._ProxyPassword);
                        LinkedInManager.linkedInDictionary.Add(LinkedIn._Username, LinkedIn);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                }

                Ld_lstAccountCheckerEmail.AddRange(Globals.listAccounts);

                try
                {
                    if (dt.Rows.Count > 0)
                    {
                        label6.Invoke(new MethodInvoker(delegate
                        {
                            label6.Text = dt.Rows.Count.ToString();
                        }));
                    }
                    else
                    {
                        label6.Invoke(new MethodInvoker(delegate
                        {
                            label6.Text = (0).ToString();
                        }));
                    }
                }
                catch
                {
                }

                Console.WriteLine(Globals.listAccounts.Count + " Accounts loaded");
                AddToListBox("[ " + DateTime.Now + " ] => [ " + Globals.listAccounts.Count + " Accounts loaded ]");
                Log("[ " + DateTime.Now + " ] => [ " + Globals.listAccounts.Count + " Accounts loaded ]");

                try
                {
                    this.Invoke(new MethodInvoker(delegate
                    {
                        lblAccountStatus.Text = "PROCESS COMPLETED";
                    }));
                }
                catch
                {
                }
            }
            catch { }

            //RaiseLoadAccountsEvent();
        }
예제 #13
0
        public void LoadGridView()
        {
            try
            {
                DataTable dt = objclsLinkedINAccount.SelectAccoutsForGridView();
                try
                {
                    dgvAccount.Invoke(new MethodInvoker(delegate
                    {
                        dgvAccount.DataSource = dt;
                    }));
                }
                catch { }

                //*** Add to Dictonary ***************************

                LinkedInManager.linkedInDictionary.Clear();


                try
                {
                    foreach (DataRow DTRow in dt.Rows)
                    {
                        try
                        {
                            LinkedInMaster objLinkedInMaster = new LinkedInMaster();
                            objLinkedInMaster._Username      = DTRow[0].ToString();
                            objLinkedInMaster._Password      = DTRow[1].ToString();
                            objLinkedInMaster._ProxyAddress  = DTRow[2].ToString();
                            objLinkedInMaster._ProxyPort     = DTRow[3].ToString();
                            objLinkedInMaster._ProxyUsername = DTRow[4].ToString();
                            objLinkedInMaster._ProxyPassword = DTRow[5].ToString();

                            LinkedInManager.linkedInDictionary.Add(objLinkedInMaster._Username, objLinkedInMaster);
                            //Ld_lstAccountCheckerEmail.Add(objLinkedInMaster._Username, objLinkedInMaster);
                            if (Globals.IsFreeVersion)
                            {
                                if (dt.Rows.Count >= 5)
                                {
                                    if (_accountcounter > 4)
                                    {
                                        FrmFreeTrial frmFreeTrial = new FrmFreeTrial();
                                        frmFreeTrial.TopMost = true;
                                        frmFreeTrial.ShowDialog();
                                        break;
                                    }
                                    else
                                    {
                                        _accountcounter++;
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                        }
                    }

                    //AddLoggerAccountLoad(LinkedInManager.linkedInDictionary.Count + " Accounts loaded");
                    ////AddLoggerAccounts(LinkedInManager.linkedInDictionary.Count + " Accounts loaded");
                    //Log(LinkedInManager.linkedInDictionary.Count + " Accounts loaded");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    AddLoggerAccountLoad("[ " + DateTime.Now + " ] => [ Account Loading has some problem in GridView ]");
                }

                try
                {
                    this.Invoke(new MethodInvoker(delegate
                    {
                        lblAccountStatus.Text = "PROCESS COMPLETED";
                    }));
                }
                catch
                {
                }

                try
                {
                    if (dt.Rows.Count > 0)
                    {
                        label6.Invoke(new MethodInvoker(delegate
                        {
                            label6.Text = dt.Rows.Count.ToString();
                        }));
                    }
                    else
                    {
                        label6.Invoke(new MethodInvoker(delegate
                        {
                            label6.Text = (0).ToString();
                        }));
                    }
                }
                catch
                {
                }
            }
            catch
            {
            }
        }
예제 #14
0
        public void GetStartProcessForFollow(object paramarray)
        {
            string CampaignName = string.Empty;

            try
            {
                Interlocked.Increment(ref counterThreadsCampaignFollow);

                string Account     = string.Empty;
                Array  paramsArray = new object[5];
                paramsArray = (Array)paramarray;

                KeyValuePair <string, CampaignAccountManager> keyValuePair = (KeyValuePair <string, CampaignAccountManager>)paramsArray.GetValue(0);
                LinkedinLogin Login = new LinkedinLogin();
                //KeyValuePair<string, LinkedInMaster> item = (KeyValuePair<string, LinkedInMaster>)paramsArray.GetValue(0);
                GlobusHttpHelper       HttpHelper       = new GlobusHttpHelper();
                LinkedInMaster         LinkedIn_Master1 = new LinkedInMaster();
                CampaignAccountManager LinkedIn_Master  = keyValuePair.Value;
                string linkedInKey = keyValuePair.Key;
                Account = keyValuePair.Key;

                string SearchType = (string)paramsArray.GetValue(1);

                int KeywordFilePath = (int)paramsArray.GetValue(2);

                int UrlFilePath = (int)paramsArray.GetValue(3);

                int DelayStart = (int)paramsArray.GetValue(4);

                int DelayEnd = (int)paramsArray.GetValue(5);

                CampaignName = (string)paramsArray.GetValue(6);

                bool IsSchedulDaily = (bool)paramsArray.GetValue(7);

                DateTime SchedulerStartTime = (DateTime)paramsArray.GetValue(7);

                DateTime SchedulerEndTime = (DateTime)paramsArray.GetValue(8);

                //bool IsInviteperDay = (bool)paramsArray.GetValue(8);

                //int NumberOfInivitePerDay = (int)paramsArray.GetValue(9);

                //string Message = (string)paramsArray.GetValue(10);

                //bool Isspintax = (bool)paramsArray.GetValue(11);
                //Initialize Values in Local Variable

                string accKey = (string)keyValuePair.Key;
                CampaignAccountManager campACCManager = (CampaignAccountManager)keyValuePair.Value;



                //Add List Of Working thread
                //we are using this list when we stop/abort running camp processes..
                try
                {
                    cls_variables.Lst_WokingThreads.Add(CampaignName + "_" + campACCManager.Username, Thread.CurrentThread);
                }
                catch (Exception)
                {
                }


                //
                ////////
                // JOIN GROUP METHOD!!
                ///////
                //
            }
            catch (Exception)
            {
            }
            finally
            {
                ////count_AccountforCampaignFollower--;
                //Interlocked.Decrement(ref counterThreadsCampaignFollow);
                //lock (lockerThreadsCampaignFollow)
                //{
                //    Monitor.Pulse(lockerThreadsCampaignFollow);
                //}
                if (counterThreadsCampaignFollow == 0)
                {
                    AddLoggerManageConnection("[ " + DateTime.Now + " ] => [ Process is completed for Campaign " + CampaignName + " ]");
                    //_IsFollowProcessStart = true;
                }
            }
        }