コード例 #1
0
ファイル: frmMain.cs プロジェクト: brentscheidt/inboard
        public void StartScrapingJobDetails(object Parameter)
        {
            try
            {
                try
                {
                    if (IsStop)
                    {
                        return;
                    }

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

                string account = string.Empty;

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

                paramsArray = (Array)Parameter;

                KeyValuePair<string, LinkedInMaster> item = (KeyValuePair<string, LinkedInMaster>)paramsArray.GetValue(0);
                account = item.Key;
                GlobusHttpHelper HttpHelper = new GlobusHttpHelper();
                LinkedinLogin Login = new LinkedinLogin();

                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;

                Others.StatusUpdate obj_StatusUpdate = new Others.StatusUpdate(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword);

                //Login.logger.addToLogger += new EventHandler(ShareLogEvents_addToLogger);
                obj_StatusUpdate.logger.addToLogger += new EventHandler(ShareLogEvents_addToLogger);

                AddLoggerShare("[ " + DateTime.Now + " ] => [ Logging with Account: " + Login.accountUser + " ]");
                if (!Login.IsLoggedIn)
                {
                    Login.LoginHttpHelper(ref HttpHelper);
                }

                if (!Login.IsLoggedIn)
                {
                    AddLoggerShare("[ " + DateTime.Now + " ] => [ Couldn't Login With Username >>> " + Login.accountUser + " ]");
                    return;
                }
                AddLoggerShare("[ " + DateTime.Now + " ] => [ Logged with Account: " + Login.accountUser + " ]");
                obj_StatusUpdate.startJobScrapingDetails(ref HttpHelper, lstLinkedinJobScraperInputUrl);
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
        }
コード例 #2
0
        public void PostStatusImageShare(object Parameter)
        {
            try
            {
                if (IsStop)
                {
                    return;
                }

                if (!IsStop)
                {
                    Thread.CurrentThread.Name = "StatusImageShareThread";
                    lstThreadForStatusImage.Add(Thread.CurrentThread);
                    lstThreadForStatusImage.Distinct().ToList();
                    Thread.CurrentThread.IsBackground = true;
                }
            }
            catch
            {
            }

            string account = string.Empty;
            try
            {
                string post = string.Empty;
                Array paramsArray = new object[1];

                paramsArray = (Array)Parameter;

                KeyValuePair<string, LinkedInMaster> item = (KeyValuePair<string, LinkedInMaster>)paramsArray.GetValue(0);
                account = item.Key;
                GlobusHttpHelper HttpHelper = new GlobusHttpHelper();
                LinkedinLogin Login = new LinkedinLogin();

                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;

                Others.StatusUpdate obj_StatusUpdate = new Others.StatusUpdate(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword);

                Login.logger.addToLogger += new EventHandler(logger_LinkedInStatusImageToLogger);
                obj_StatusUpdate.logger.addToLogger += new EventHandler(logger_LinkedInStatusImageToLogger);

                if (!Login.IsLoggedIn)
                {
                    Login.LoginHttpHelper(ref HttpHelper);
                }

                if (!Login.IsLoggedIn)
                {
                    AddToLogStatusImage("[ " + DateTime.Now + " ] => [ Couldn't Login With Username >>> " + Login.accountUser + " ]");
                    return;
                }

                if (Login.IsLoggedIn)
                {
                    lock (LinkedinLogin.Locker_Message_Post)
                    {
                        if (ClsStatusImageShare.lstpicfile.Count > 1)
                        {
                            if (Others.StatusUpdate.Que_Message_Post.Count > 0)
                            {
                                obj_StatusUpdate.Post = Others.StatusUpdate.Que_Message_Post.Dequeue();
                            }
                            else
                            {
                                AddToLogStatusImage("[ " + DateTime.Now + " ] => [ All Loaded Post Updates ]");
                                return;
                            }
                        }
                        else
                        {
                            obj_StatusUpdate.Post = ClsStatusImageShare.lstpicfile[0];
                        }
                    }

                    int minDelay = 20;
                    int maxDelay = 25;
                    if (!string.IsNullOrEmpty(txtStatusUpdateMinDelay.Text) && NumberHelper.ValidateNumber(txtStatusUpdateMinDelay.Text))
                    {
                        minDelay = Convert.ToInt32(txtStatusUpdateMinDelay.Text);
                    }
                    if (!string.IsNullOrEmpty(txtStatusUpdateMaxDelay.Text) && NumberHelper.ValidateNumber(txtStatusUpdateMaxDelay.Text))
                    {
                        maxDelay = Convert.ToInt32(txtStatusUpdateMaxDelay.Text);
                    }

                        try
                        {
                            obj_StatusUpdate.UpdateStatusUsingAllurl(ref HttpHelper, minDelay, maxDelay);
                        }
                        catch
                        {
                        }

                }

                Login.logger.addToLogger -= new EventHandler(logger_LinkedInStatusImageToLogger);
                obj_StatusUpdate.logger.addToLogger -= new EventHandler(logger_LinkedInStatusImageToLogger);
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> LinkdinStatusImageShare --> PostStatusImageShare() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> LinkdinStatusImageShare --> PostStatusImageShare() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinStatusImageUpdateErrorLogs);
            }
            finally
            {
                counter_status_posting--;

                if (counter_status_posting == 0)
                {
                    if (btnAddStatusImage.InvokeRequired)
                    {
                        btnAddStatusImage.Invoke(new MethodInvoker(delegate
                        {
                            AddToLogStatusImage("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                            AddToLogStatusImage("-------------------------------------------------------------------------------------------------------------------------------");
                            //btnStatusPost.Cursor = Cursors.Default;
                        }));
                    }
                }
            }
        }
コード例 #3
0
        public void PostStatusImageShare(object Parameter)
        {
            try
            {
                if (IsStop)
                {
                    return;
                }

                if (!IsStop)
                {
                    Thread.CurrentThread.Name = "StatusImageShareThread";
                    lstThreadForStatusImage.Add(Thread.CurrentThread);
                    lstThreadForStatusImage.Distinct().ToList();
                    Thread.CurrentThread.IsBackground = true;
                }
            }
            catch
            {
            }

            string account = string.Empty;

            try
            {
                string post        = string.Empty;
                Array  paramsArray = new object[1];

                paramsArray = (Array)Parameter;

                KeyValuePair <string, LinkedInMaster> item = (KeyValuePair <string, LinkedInMaster>)paramsArray.GetValue(0);
                account = item.Key;
                GlobusHttpHelper HttpHelper = new GlobusHttpHelper();
                LinkedinLogin    Login      = new LinkedinLogin();

                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;

                Others.StatusUpdate obj_StatusUpdate = new Others.StatusUpdate(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword);

                Login.logger.addToLogger            += new EventHandler(logger_LinkedInStatusImageToLogger);
                obj_StatusUpdate.logger.addToLogger += new EventHandler(logger_LinkedInStatusImageToLogger);

                if (!Login.IsLoggedIn)
                {
                    Login.LoginHttpHelper(ref HttpHelper);
                }


                if (!Login.IsLoggedIn)
                {
                    AddToLogStatusImage("[ " + DateTime.Now + " ] => [ Couldn't Login With Username >>> " + Login.accountUser + " ]");
                    return;
                }

                if (Login.IsLoggedIn)
                {
                    lock (LinkedinLogin.Locker_Message_Post)
                    {
                        if (ClsStatusImageShare.lstpicfile.Count > 1)
                        {
                            if (Others.StatusUpdate.Que_Message_Post.Count > 0)
                            {
                                obj_StatusUpdate.Post = Others.StatusUpdate.Que_Message_Post.Dequeue();
                            }
                            else
                            {
                                AddToLogStatusImage("[ " + DateTime.Now + " ] => [ All Loaded Post Updates ]");
                                return;
                            }
                        }
                        else
                        {
                            obj_StatusUpdate.Post = ClsStatusImageShare.lstpicfile[0];
                        }
                    }

                    int minDelay = 20;
                    int maxDelay = 25;
                    if (!string.IsNullOrEmpty(txtStatusUpdateMinDelay.Text) && NumberHelper.ValidateNumber(txtStatusUpdateMinDelay.Text))
                    {
                        minDelay = Convert.ToInt32(txtStatusUpdateMinDelay.Text);
                    }
                    if (!string.IsNullOrEmpty(txtStatusUpdateMaxDelay.Text) && NumberHelper.ValidateNumber(txtStatusUpdateMaxDelay.Text))
                    {
                        maxDelay = Convert.ToInt32(txtStatusUpdateMaxDelay.Text);
                    }

                    try
                    {
                        obj_StatusUpdate.UpdateStatusUsingAllurl(ref HttpHelper, minDelay, maxDelay);
                    }
                    catch
                    {
                    }
                }

                Login.logger.addToLogger            -= new EventHandler(logger_LinkedInStatusImageToLogger);
                obj_StatusUpdate.logger.addToLogger -= new EventHandler(logger_LinkedInStatusImageToLogger);
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> LinkdinStatusImageShare --> PostStatusImageShare() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> LinkdinStatusImageShare --> PostStatusImageShare() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinStatusImageUpdateErrorLogs);
            }
            finally
            {
                counter_status_posting--;

                if (counter_status_posting == 0)
                {
                    if (btnAddStatusImage.InvokeRequired)
                    {
                        btnAddStatusImage.Invoke(new MethodInvoker(delegate
                        {
                            AddToLogStatusImage("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                            AddToLogStatusImage("-------------------------------------------------------------------------------------------------------------------------------");
                            //btnStatusPost.Cursor = Cursors.Default;
                        }));
                    }
                }
            }
        }