private void btn_login2selected_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(SelectedUser)) { InfoForm.InfoHelper.CustomMessageBox.Show("Info", "Please select an account!"); return; } var list = JsonConvert.DeserializeObject <RootObject>(File.ReadAllText(Program.AccountsJsonFile)); foreach (var a in list.Accounts) { if (a.username == SelectedUser) { if (string.IsNullOrEmpty(a.password)) { InfoForm.InfoHelper.CustomMessageBox.Show("Info", "Please add password to: " + a.username); return; } usernameJSON = a.username; passwordJSON = a.password; } } // Start Login Thread doLogin = new Thread(() => AccountLogin.UserSettingsGather(usernameJSON, passwordJSON)); doLogin.Start(); btn_login2selected.Enabled = false; }
private void Main_FormClosed(object sender, FormClosedEventArgs e) { if (AccountLogin.IsLoggedIn == true) { AccountLogin.Logout(); } notifyIcon_ChatLogger.Icon = null; Environment.Exit(1); }
private void btn_logout_Click(object sender, EventArgs e) { if (AccountLogin.IsLoggedIn == true) { AccountLogin.Logout(); } else { InfoForm.InfoHelper.CustomMessageBox.Show("Error", "Not logged!"); } }
private void btn_logout_Click(object sender, EventArgs e) { if (AccountLogin.IsLoggedIn == true) { AccountLogin.Logout(); richtxtbox_HistoryLogs.Clear(); richtxtbox_HistoryLogs.Text = "Waiting for loggin..."; richtxtbox_HistoryLogs.ForeColor = SystemColors.GrayText; } else { InfoForm.InfoHelper.CustomMessageBox.Show("Error", "Not logged!"); } }
private void btn_cancel_Click(object sender, EventArgs e) { AccountLogin.Logout(); this.Close(); }
private void Trolha_Tick(object sender, EventArgs e) { try { if (AccountLogin.IsLoggedIn == true) { btn_login2selected.Enabled = false; // se timer estiver desligado e combo estiver fora do 0 iniciar if ((!TrolhaHistory.Enabled) && combox_historysettings.SelectedIndex != 0) { TrolhaHistory.Start(); richtxtbox_HistoryLogs.Clear(); richtxtbox_HistoryLogs.Text = "Waiting for new messages..."; richtxtbox_HistoryLogs.ForeColor = SystemColors.GrayText; } lbl_connecting.Visible = true; lbl_currentUsername.Visible = true; btnLabel_PersonaAndFlag.Visible = true; btn_logout.Visible = true; panel_steamStates.Visible = true; picBox_SteamAvatar.Visible = true; if (picBox_SteamAvatar.Image == null && btnLabel_PersonaAndFlag.Image == null) { picBox_SteamAvatar.ImageLocation = AccountLogin.GetAvatarLink(AccountLogin.CurrentSteamID); // byte[] data = new WebClient().DownloadData("https://www.countryflags.io/" + AccountLogin.UserCountry + "/flat/16.png"); byte[] data = new WebClient().DownloadData("https://flagcdn.com/16x12/" + AccountLogin.UserCountry.ToLower() + ".png"); MemoryStream ms = new MemoryStream(data); btnLabel_PersonaAndFlag.Image = Image.FromStream(ms); } btnLabel_PersonaAndFlag.Invoke(new Action(() => btnLabel_PersonaAndFlag.Text = AccountLogin.UserPersonaName)); panel_steamStates.BackColor = Color.LightSkyBlue; lbl_currentUsername.Invoke(new Action(() => lbl_currentUsername.Text = AccountLogin.CurrentUsername)); progressRecord.Visible = true; lbl_recording.Visible = true; } else { TrolhaHistory.Stop(); richtxtbox_HistoryLogs.Clear(); richtxtbox_HistoryLogs.Text = "Waiting for loggin..."; richtxtbox_HistoryLogs.ForeColor = SystemColors.GrayText; lbl_recording.Visible = false; progressRecord.Visible = false; lbl_connecting.Visible = false; lbl_currentUsername.Visible = false; btnLabel_PersonaAndFlag.Visible = false; btn_logout.Visible = false; panel_steamStates.Visible = false; picBox_SteamAvatar.Visible = false; btn_login2selected.Enabled = true; btnLabel_PersonaAndFlag.Invoke(new Action(() => btnLabel_PersonaAndFlag.Text = "None")); panel_steamStates.BackColor = Color.Gray; picBox_SteamAvatar.BackColor = Color.FromArgb(255, 25, 25, 25); lbl_currentUsername.Invoke(new Action(() => lbl_currentUsername.Text = "None")); } } catch (Exception ewe) { InfoForm.InfoHelper.CustomMessageBox.Show("Error", e.ToString()); Console.WriteLine(ewe); } }
private void Main_Shown(object sender, EventArgs e) { var Settingslist = JsonConvert.DeserializeObject <ChatLoggerSettings>(File.ReadAllText(Program.SettingsJsonFile)); DateTime now = DateTime.Now; if (Settingslist.LastTimeCheckedUpdate == null || Settingslist.LastTimeCheckedUpdate.Length == 0) { Settingslist.LastTimeCheckedUpdate = now.ToString(); } DateTime old = DateTime.Parse(Settingslist.LastTimeCheckedUpdate); if (Settingslist.LastTimeCheckedUpdate.Length > 0 && (now - old).TotalDays > 30) //check for update 30 days later { RafadexAutoUpdate600IQ(); } File.WriteAllText(Program.SettingsJsonFile, JsonConvert.SerializeObject(Settingslist, Formatting.Indented)); if (Settingslist.startupAcc != 0) { var list = JsonConvert.DeserializeObject <RootObject>(File.ReadAllText(Program.AccountsJsonFile)); foreach (var a in list.Accounts) { if (a.SteamID == Settingslist.startupAcc) { usernameJSON = a.username; passwordJSON = a.password; } } // Start Login Thread doLogin = new Thread(() => AccountLogin.UserSettingsGather(usernameJSON, passwordJSON)); doLogin.Start(); } System.Windows.Forms.Timer t = new System.Windows.Forms.Timer(); t.Tick += new EventHandler(Trolha_Tick); t.Interval = 2000; t.Start(); combox_Colors.SelectedIndex = Settingslist.startupColor; // if (Settingslist.Separator.Length > 0) { txtBox_saveSeparator.Text = Settingslist.Separator; } if (Settingslist.PathLogs.Length > 0) { // txtBox_logDir.Text = Settingslist.PathLogs.Replace(@"\\", @"\"); txtBox_logDir.Text = Settingslist.PathLogs; } else { Settingslist.PathLogs = Program.ChatLogsFolder; txtBox_logDir.Text = Program.ChatLogsFolder; var convertedJson = JsonConvert.SerializeObject(Settingslist, new JsonSerializerSettings { Formatting = Formatting.Indented }); File.WriteAllText(Program.SettingsJsonFile, convertedJson); } //Settings LOAD to Main Form toggle_startWindows.Checked = Settingslist.startup; combox_historysettings.SelectedIndex = Settingslist.HistorySettings; if (Settingslist.hideInTaskBar) { toggle_hideInTask.Checked = true; this.ShowInTaskbar = false; } else { this.ShowInTaskbar = true; toggle_hideInTask.Checked = false; } if (Settingslist.startMinimized) { chck_Minimized.Checked = true; this.WindowState = FormWindowState.Minimized; } else { chck_Minimized.Checked = false; this.WindowState = FormWindowState.Normal; } if (Settingslist.playsound) { toggle_playSound.Checked = true; Stream str = Properties.Resources.ChatLogger_Success; SoundPlayer snd = new SoundPlayer(str); snd.Play(); } else { toggle_playSound.Checked = false; } }
private void Trolha_Tick(object sender, EventArgs e) { try { if (AccountLogin.IsLoggedIn == true) { btn_login2selected.Enabled = false; lbl_connecting.Visible = true; lbl_currentUsername.Visible = true; btnLabel_PersonaAndFlag.Visible = true; btn_logout.Visible = true; panel_steamStates.Visible = true; picBox_SteamAvatar.Visible = true; if (picBox_SteamAvatar.Image == null && btnLabel_PersonaAndFlag.Image == null) { picBox_SteamAvatar.ImageLocation = AccountLogin.GetAvatarLink(AccountLogin.CurrentSteamID); byte[] data = new WebClient().DownloadData("https://www.countryflags.io/" + AccountLogin.UserCountry + "/flat/16.png"); MemoryStream ms = new MemoryStream(data); btnLabel_PersonaAndFlag.Image = Image.FromStream(ms); } btnLabel_PersonaAndFlag.Invoke(new Action(() => btnLabel_PersonaAndFlag.Text = AccountLogin.UserPersonaName)); panel_steamStates.BackColor = Color.LightSkyBlue; lbl_currentUsername.Invoke(new Action(() => lbl_currentUsername.Text = AccountLogin.CurrentUsername)); progressRecord.Visible = true; lbl_recording.Visible = true; } else { lbl_recording.Visible = false; progressRecord.Visible = false; lbl_connecting.Visible = false; lbl_currentUsername.Visible = false; btnLabel_PersonaAndFlag.Visible = false; btn_logout.Visible = false; panel_steamStates.Visible = false; picBox_SteamAvatar.Visible = false; btn_login2selected.Enabled = true; btnLabel_PersonaAndFlag.Invoke(new Action(() => btnLabel_PersonaAndFlag.Text = "None")); panel_steamStates.BackColor = Color.Gray; picBox_SteamAvatar.BackColor = Color.FromArgb(255, 25, 25, 25); lbl_currentUsername.Invoke(new Action(() => lbl_currentUsername.Text = "None")); } } catch (Exception ewe) { InfoForm.InfoHelper.CustomMessageBox.Show("Error", e.ToString()); Console.WriteLine(ewe); } }