private void LoadAccounts() { //Globals.IsFreeVersion = true; try { DataSet ds; DataTable dt = new DataTable(); Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.DefaultExt = ".txt"; dlg.Filter = "Text documents (.txt)|*.txt"; Nullable <bool> result = dlg.ShowDialog(); if (result == true) { DateTime sTime = DateTime.Now; #region MyRegion //if (lblAccounts_ManageAccounts_LoadsAccountsPath.InvokeRequired) //{ // lblAccounts_ManageAccounts_LoadsAccountsPath.Invoke(new MethodInvoker(delegate // { // lblAccounts_ManageAccounts_LoadsAccountsPath.Text = ofd.FileName; // })); //} //else //{ // lblAccounts_ManageAccounts_LoadsAccountsPath.Text = ofd.FileName; //} #endregion dt.Columns.Add("UserName"); dt.Columns.Add("Password"); dt.Columns.Add("proxyAddress"); dt.Columns.Add("proxyPort"); dt.Columns.Add("ProxyUserName"); dt.Columns.Add("ProxyPassword"); ds = new DataSet(); ds.Tables.Add(dt); #region MyRegion //if (grvAccounts_ManageAccounts_ManageAccountsDetails.InvokeRequired) //{ // grvAccounts_ManageAccounts_ManageAccountsDetails.Invoke(new MethodInvoker(delegate // { // grvAccounts_ManageAccounts_ManageAccountsDetails.DataSource = null; // })); //} //else //{ // grvAccounts_ManageAccounts_ManageAccountsDetails.DataSource = null; //} #endregion List <string> templist = GlobusFileHelper.ReadFile(dlg.FileName); //if (templist.Count > 0) //{ // LDGlobals.loadedAccountsDictionary.Clear(); // LDGlobals.listAccounts.Clear(); //} int counter = 0; foreach (string item in templist) { if (Globals.CheckLicenseManager == "fdfreetrial" && counter == 5) { break; } counter = counter + 1; try { string account = item; string[] AccArr = account.Split(':'); if (AccArr.Count() > 1) { string accountUser = account.Split(':')[0]; string accountPass = account.Split(':')[1]; string proxyAddress = string.Empty; string proxyPort = string.Empty; string proxyUserName = string.Empty; string proxyPassword = string.Empty; int DataCount = account.Split(':').Length; if (DataCount == 2) { //Globals.accountMode = AccountMode.NoProxy; } else if (DataCount == 4) { proxyAddress = account.Split(':')[2]; proxyPort = account.Split(':')[3]; } else if (DataCount > 5 && DataCount < 7) { proxyAddress = account.Split(':')[2]; proxyPort = account.Split(':')[3]; proxyUserName = account.Split(':')[4]; proxyPassword = account.Split(':')[5]; } else if (DataCount == 7) { proxyAddress = account.Split(':')[5]; proxyPort = account.Split(':')[6]; proxyUserName = account.Split(':')[7]; proxyPassword = account.Split(':')[8]; } //dt.Rows.Add(accountUser, accountPass, ScreenName, FollowerCount, FollwingCount, proxyAddress, proxyPort, proxyUserName, proxyPassword, GroupName, AccountStatus); dt.Rows.Add(accountUser, accountPass, proxyAddress, proxyPort, proxyUserName, proxyPassword); // dt.Rows.Add(accountUser, accountPass, proxyAddress, proxyPort, proxyUserName, proxyPassword); Qm.AddAccountInDataBase(accountUser, accountPass, proxyAddress, proxyPort, proxyUserName, proxyPassword); try { // loadedAccountsDictionary.Clear(); LinkedinUser objLinkedinUser = new LinkedinUser(); objLinkedinUser.username = accountUser; objLinkedinUser.password = accountPass; objLinkedinUser.proxyip = proxyAddress; objLinkedinUser.proxyport = proxyPort; objLinkedinUser.proxyusername = proxyUserName; objLinkedinUser.proxypassword = proxyPassword; LDGlobals.loadedAccountsDictionary.Add(objLinkedinUser.username, objLinkedinUser); LDGlobals.listAccounts.Add(objLinkedinUser.username + ":" + objLinkedinUser.password + ":" + objLinkedinUser.proxyip + ":" + objLinkedinUser.proxyport + ":" + objLinkedinUser.proxyusername + ":" + objLinkedinUser.proxypassword); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } ///Set this to "0" if loading unprofiled accounts /// string profileStatus = "0"; } else { GlobusLogHelper.log.Info("Account has some problem : " + item); GlobusLogHelper.log.Debug("Account has some problem : " + item); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } DataSet objDataSet = Qm.SelectAccounts(); dt = objDataSet.Tables["tb_LinkedInAccount"]; DataView dv = dt.DefaultView; dv.AllowNew = false; this.Dispatcher.Invoke(new Action(delegate { grvAccounts_AccountCreator_AccountDetails.ItemsSource = dv; })); try { DateTime eTime = DateTime.Now; string timeSpan = (eTime - sTime).TotalSeconds.ToString(); Application.Current.Dispatcher.Invoke(new Action(() => { lblaccounts_ManageAccounts_LoadsAccountsCount.Content = dt.Rows.Count.ToString(); })); GlobusLogHelper.log.Debug("Accounts Loaded : " + dt.Rows.Count.ToString() + " In " + timeSpan + " Seconds"); GlobusLogHelper.log.Info("Accounts Loaded : " + dt.Rows.Count.ToString() + " In " + timeSpan + " Seconds"); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } Application.Current.Dispatcher.Invoke((Action)(() => { LoadAccountProgressBar.IsIndeterminate = false; })); }
public void LoadAccounts() { try { DataSet ds; DataTable dt = new DataTable(); Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.DefaultExt = ".txt"; dlg.Filter = "Text documents (.txt)|*.txt"; Nullable <bool> result = dlg.ShowDialog(); string Path = dlg.ToString().Replace("Microsoft.Win32.OpenFileDialog: Title: , FileName", ""); if (result == true) { DateTime sTime = DateTime.Now; dt.Columns.Add("UserName"); dt.Columns.Add("Password"); dt.Columns.Add("Niches"); dt.Columns.Add("ProxyAddress"); dt.Columns.Add("ProxyPort"); dt.Columns.Add("ProxyUserName"); dt.Columns.Add("ProxyPassword"); //dt.Columns.Add("Useragent"); // dt.Columns.Add("BoardsName"); dt.Columns.Add("ScreenName"); dt.Columns.Add("LoginStatus"); ds = new DataSet(); ds.Tables.Add(dt); List <string> templist = GlobusFileHelper.ReadFile(dlg.FileName); if (templist.Count > 0) { PDGlobals.loadedAccountsDictionary.Clear(); PDGlobals.listAccounts.Clear(); } if (Globals.IsBasicVersion) { try { string selectQuery = "select count(UserName) from tb_emails"; DataSet DS = DataBaseHandler.SelectQuery(selectQuery, "tb_emails"); int countLoadedAccounts = Convert.ToInt32(DS.Tables[0].Rows[0].ItemArray[0].ToString()); if (countLoadedAccounts >= 5) { AccounLoad(); MessageBox.Show("You Are Using PD Basic Version 5 Accounts allready loaded.."); return; } else { int RemainingAccount = 5 - countLoadedAccounts; templist.RemoveRange(RemainingAccount, templist.Count - RemainingAccount); } } catch { } } if (Globals.IsProVersion) { try { string selectQuery = "select count(UserName) from tb_emails"; DataSet DS = DataBaseHandler.SelectQuery(selectQuery, "tb_emails"); int countLoadedAccounts = Convert.ToInt32(DS.Tables[0].Rows[0].ItemArray[0].ToString()); if (countLoadedAccounts >= 15) { AccounLoad(); MessageBox.Show("You Are Using PD Pro Version 15 Accounts allready loaded.."); return; } else { int RemainingAccount = 15 - countLoadedAccounts; templist.RemoveRange(RemainingAccount, templist.Count - RemainingAccount); } } catch { } } int counter = 0; foreach (string item in templist) { //if (Globals.CheckLicenseManager == "fdfreetrial" && counter == 5) //{ // break; //} counter = counter + 1; try { string account = item; string[] AccArr = account.Split(':'); if (AccArr.Count() > 1) { string accountUser = account.Split(':')[0]; string accountPass = account.Split(':')[1]; string niches = string.Empty; string proxyAddress = string.Empty; string proxyPort = string.Empty; string proxyUserName = string.Empty; string proxyPassword = string.Empty; //string Useragent = string.Empty; string Followers = string.Empty; string Following = string.Empty; // string Boards = string.Empty; string BoardsName = string.Empty; string ScreenName = string.Empty; string LoginStatus = string.Empty; int DataCount = account.Split(':').Length; if (DataCount == 3) { niches = account.Split(':')[2]; } else if (DataCount == 5) { niches = account.Split(':')[2]; proxyAddress = account.Split(':')[3]; proxyPort = account.Split(':')[4]; } else if (DataCount == 7) { niches = account.Split(':')[2]; proxyAddress = account.Split(':')[3]; proxyPort = account.Split(':')[4]; proxyUserName = account.Split(':')[5]; proxyPassword = account.Split(':')[6]; //BoardsName = account.Split(':')[7]; } dt.Rows.Add(accountUser, accountPass, proxyAddress, proxyPort, proxyUserName, proxyPassword); //Qm.DeleteAccounts(accountUser); LoginStatus = "NotChecked"; Qm.AddAccountInDataBase(accountUser, accountPass, niches, proxyAddress, proxyPort, proxyUserName, proxyPassword, ScreenName, LoginStatus); try { AccountNotifyPropertyChanged objAccountNotifyPropertyChanged = new AccountNotifyPropertyChanged(); objAccountNotifyPropertyChanged.Username = accountUser; objAccountNotifyPropertyChanged.Password = accountPass; objAccountNotifyPropertyChanged.Niche = niches; objAccountNotifyPropertyChanged.ScreenName = ScreenName; objAccountNotifyPropertyChanged.FollowerCount = Followers; objAccountNotifyPropertyChanged.FollowingCount = Following; objAccountNotifyPropertyChanged.ProxyAddress = proxyAddress; objAccountNotifyPropertyChanged.ProxyPassword = proxyPassword; objAccountNotifyPropertyChanged.ProxyPort = proxyPort; objAccountNotifyPropertyChanged.ProxyUserName = proxyUserName; if (LoginStatus.Contains("Success")) { objAccountNotifyPropertyChanged.LoginStatus = "Success"; objAccountNotifyPropertyChanged.BackgroundColor = "Green"; this.Dispatcher.Invoke(new Action(delegate { AccountViewModel._listOfAccount.Add(objAccountNotifyPropertyChanged); })); } else if (LoginStatus.Contains("Fail")) { objAccountNotifyPropertyChanged.LoginStatus = "Fail"; objAccountNotifyPropertyChanged.BackgroundColor = "Red"; this.Dispatcher.Invoke(new Action(delegate { AccountViewModel._listOfAccount.Add(objAccountNotifyPropertyChanged); })); } else if (LoginStatus.Contains("Not")) { objAccountNotifyPropertyChanged.LoginStatus = "Not Checked"; objAccountNotifyPropertyChanged.BackgroundColor = ""; this.Dispatcher.Invoke(new Action(delegate { AccountViewModel._listOfAccount.Add(objAccountNotifyPropertyChanged); })); } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } try { PinInterestUser objPinInterestUser = new PinInterestUser(); objPinInterestUser.Username = accountUser; objPinInterestUser.Password = accountPass; objPinInterestUser.Niches = niches; objPinInterestUser.ProxyAddress = proxyAddress; objPinInterestUser.ProxyPort = proxyPort; objPinInterestUser.ProxyUsername = proxyUserName; objPinInterestUser.ProxyPassword = proxyPassword; //objPinInterestUser.UserAgent = Useragent; objPinInterestUser.BoardsName = BoardsName; objPinInterestUser.ScreenName = ScreenName; objPinInterestUser.LoginStatus = LoginStatus; PDGlobals.loadedAccountsDictionary.Add(objPinInterestUser.Username, objPinInterestUser); PDGlobals.listAccounts.Add(objPinInterestUser.Username + ":" + objPinInterestUser.Password + ":" + objPinInterestUser.Niches + ":" + objPinInterestUser.ProxyAddress + ":" + objPinInterestUser.ProxyPort + ":" + objPinInterestUser.ProxyUsername + ":" + objPinInterestUser.ProxyPassword); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } // Set this to "0" if loading unprofiled accounts; string profileStatus = "0"; } else { GlobusLogHelper.log.Info("Account has some problem : " + item); GlobusLogHelper.log.Debug("Account has some problem : " + item); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } DataView dv = dt.DefaultView; dv.AllowNew = false; try { AccounLoad(); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { DateTime eTime = DateTime.Now; string timeSpan = (eTime - sTime).TotalSeconds.ToString(); Application.Current.Dispatcher.Invoke(new Action(() => { lblaccounts_ManageAccounts_LoadsAccountsCount.Content = dt.Rows.Count.ToString(); })); GlobusLogHelper.log.Debug("Accounts Loaded : " + dt.Rows.Count.ToString() + " In " + timeSpan + " Seconds"); //GlobusLogHelper.log.Info("Accounts Loaded : " + dt.Rows.Count.ToString() + " In " + timeSpan + " Seconds"); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } Application.Current.Dispatcher.Invoke((Action)(() => { LoadAccountProgressBar.IsIndeterminate = false; })); }
private void Button_Click(object sender, RoutedEventArgs e) { try { MessageBoxButton btnC = MessageBoxButton.OK; ManageAccounts obj_Manage_Accounts = new ManageAccounts(); string singleUsername = string.Empty; string siglePassword = string.Empty; string singleproxy = string.Empty; string path = string.Empty; string proxyAddress = string.Empty; string proxyPort = string.Empty; string proxyUserName = string.Empty; string proxyPassword = string.Empty; singleUsername = txt_AddSingleAccount_Account.Text; siglePassword = txt_AddSingleAccount_Password.Password; if (string.IsNullOrEmpty(singleUsername)) { ModernDialog.ShowMessage("Please Enter Account !", "Message Box ", btnC); txt_AddSingleAccount_Account.Focus(); return; } if (string.IsNullOrEmpty(siglePassword)) { ModernDialog.ShowMessage("Please Enter Password !", "Message Box ", btnC); txt_AddSingleAccount_Password.Focus(); return; } try { proxyAddress = txt_AddSingleAccount_ProxyAddress.Text; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { proxyPort = txt_AddSingleAccount_ProxyPort.Text; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { proxyUserName = txt_AddSingleAccount_ProxyUsername.Text; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } try { proxyPassword = txt_AddSingleAccount_ProxyPassword.Password; } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } Qm.AddAccountInDataBase(singleUsername, siglePassword, proxyAddress, proxyPort, proxyUserName, proxyPassword, path); obj_Manage_Accounts.LoadAccountsFromDataBase(); Window parentWindow = (Window)this.Parent; parentWindow.Close(); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } }
public void AddSingleAccountUploadAcc() { try { QueryManager QM = new QueryManager(); string accountUser = string.Empty; string accountPass = string.Empty; string niches = string.Empty; string proxyAddress = string.Empty; string proxyPort = string.Empty; string proxyUserName = string.Empty; string proxyPassword = string.Empty; //string Useragent = string.Empty; string BoardsName = string.Empty; string ScreenName = string.Empty; string LoginStatus = string.Empty; if (string.IsNullOrEmpty(obj_AddSingleAccount_UploadAccount.txtEmail_AddSingleAcc.Text)) { try { GlobusLogHelper.log.Info("Please Enter Account"); ModernDialog.ShowMessage("Please Enter Account", "Enter Account", MessageBoxButton.OK); return; } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } else { accountUser = (obj_AddSingleAccount_UploadAccount.txtEmail_AddSingleAcc.Text).ToString(); } if (string.IsNullOrEmpty(obj_AddSingleAccount_UploadAccount.txtPassword_AddSingleAcc.Text)) { try { GlobusLogHelper.log.Info("Please Enter Account"); ModernDialog.ShowMessage("Please Enter Account", "Enter Account", MessageBoxButton.OK); return; } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } else { accountPass = (obj_AddSingleAccount_UploadAccount.txtPassword_AddSingleAcc.Text).ToString(); } try { niches = (obj_AddSingleAccount_UploadAccount.txtNiche_AddSinleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } try { proxyAddress = (obj_AddSingleAccount_UploadAccount.txtProxyAddress_AddSingleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } try { proxyPort = (obj_AddSingleAccount_UploadAccount.txtProxyPort_AddSingleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } try { proxyUserName = (obj_AddSingleAccount_UploadAccount.txtProxyUsername_AddSingleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } try { proxyPassword = (obj_AddSingleAccount_UploadAccount.txtProxyPassword_AddSingleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } if (Globals.IsBasicVersion) { try { string selectQuery = "select count(UserName) from tb_emails"; DataSet DS = DataBaseHandler.SelectQuery(selectQuery, "tb_emails"); int countLoadedAccounts = Convert.ToInt32(DS.Tables[0].Rows[0].ItemArray[0].ToString()); if (countLoadedAccounts >= 5) { AccounLoad(); MessageBox.Show("You Are Using PD Basic Version 5 Accounts allready loaded.."); return; } else { // int RemainingAccount = 5 - countLoadedAccounts; //templist.RemoveRange(RemainingAccount, templist.Count - RemainingAccount); } } catch { } } if (Globals.IsProVersion) { try { string selectQuery = "select count(UserName) from tb_emails"; DataSet DS = DataBaseHandler.SelectQuery(selectQuery, "tb_emails"); int countLoadedAccounts = Convert.ToInt32(DS.Tables[0].Rows[0].ItemArray[0].ToString()); if (countLoadedAccounts >= 15) { AccounLoad(); MessageBox.Show("You Are Using PD Pro Version 15 Accounts allready loaded.."); return; } else { // int RemainingAccount = 15 - countLoadedAccounts; // templist.RemoveRange(RemainingAccount, templist.Count - RemainingAccount); } } catch { } } LoginStatus = "NotChecked"; QM.AddAccountInDataBase(accountUser, accountPass, niches, proxyAddress, proxyPort, proxyUserName, proxyPassword, ScreenName, LoginStatus); UploadAccount objUploadAccount = new UploadAccount(); objUploadAccount.AccounLoad(); //Window parentWindow = (Window)this.Parent; //parentWindow.Close(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } }
private void btnSave_AddSingleAcc_Click(object sender, RoutedEventArgs e) { try { QueryManager QM = new QueryManager(); string accountUser = string.Empty; string accountPass = string.Empty; string niches = string.Empty; string proxyAddress = string.Empty; string proxyPort = string.Empty; string proxyUserName = string.Empty; string proxyPassword = string.Empty; //string Useragent = string.Empty; string BoardsName = string.Empty; string ScreenName = string.Empty; string LoginStatus = string.Empty; if (string.IsNullOrEmpty(txtEmail_AddSingleAcc.Text)) { try { GlobusLogHelper.log.Info("Please Enter Account"); ModernDialog.ShowMessage("Please Enter Account", "Enter Account", MessageBoxButton.OK); return; } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } else { accountUser = (txtEmail_AddSingleAcc.Text).ToString(); } if (string.IsNullOrEmpty(txtPassword_AddSingleAcc.Text)) { try { GlobusLogHelper.log.Info("Please Enter Account"); ModernDialog.ShowMessage("Please Enter Account", "Enter Account", MessageBoxButton.OK); return; } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } else { accountPass = (txtPassword_AddSingleAcc.Text).ToString(); } try { niches = (txtNiche_AddSinleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } try { proxyAddress = (txtProxyAddress_AddSingleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } try { proxyPort = (txtProxyPort_AddSingleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } try { proxyUserName = (txtProxyUsername_AddSingleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } try { proxyPassword = (txtProxyPassword_AddSingleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } LoginStatus = "NotChecked"; QM.AddAccountInDataBase(accountUser, accountPass, niches, proxyAddress, proxyPort, proxyUserName, proxyPassword, ScreenName, LoginStatus); UploadAccount objUploadAccount = new UploadAccount(); objUploadAccount.AccounLoad(); Window parentWindow = (Window)this.Parent; parentWindow.Close(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } }