private void ButtonGoAuto_Click(object sender, RoutedEventArgs e) { Credentials credentials; WowExe activeExe = ((WowExe)comboBoxWoWs.SelectedItem); if (activeExe != null && autologinIsPossible && activeExe.characterName == "") { if (!Directory.Exists(configPath)) { Directory.CreateDirectory(configPath); } string path = configPath + textboxCharactername.Text.ToLower() + extension; credentials.charname = textboxCharactername.Text; credentials.username = textboxUsername.Text; credentials.password = textboxPassword.Password; credentials.charSlot = Convert.ToInt32(textboxCharSlot.Text); if (checkboxSave.IsChecked == true) { File.WriteAllText(path, Newtonsoft.Json.JsonConvert.SerializeObject(credentials)); } string charname = textboxCharactername.Text; LoginAutomator.DoLogin(((WowExe)comboBoxWoWs.SelectedItem).process.Id, credentials.charSlot, credentials.username, credentials.password); ((WowExe)comboBoxWoWs.SelectedItem).characterName = charname; ButtonGo_Click(this, null); } }
private void ButtonGoAuto_Click(object sender, RoutedEventArgs e) { Credentials credentials; WowExe activeExe = ((WowExe)comboBoxWoWs.SelectedItem); if (textboxUsername.Text.Length == 0 || textboxPassword.Password.Length == 0) { MessageBox.Show("Please select an account or enter credentials to use auto-login", "Error"); return; } if (activeExe == null) { // launch new wow ButtonLaunchWow_Click(null, null); } if (activeExe != null && autologinIsPossible && activeExe.characterName == "not logged in") { if (!Directory.Exists(configPath)) { Directory.CreateDirectory(configPath); } string path = configPath + textboxCharactername.Text.ToLower() + extension; credentials.charname = textboxCharactername.Text; credentials.username = textboxUsername.Text; credentials.password = textboxPassword.Password; credentials.charSlot = Convert.ToInt32(textboxCharSlot.Text); if (checkboxSave.IsChecked == true) { File.WriteAllText(path, Newtonsoft.Json.JsonConvert.SerializeObject(credentials)); } string charname = textboxCharactername.Text; LoginAutomator.DoLogin(((WowExe)comboBoxWoWs.SelectedItem).process.Id, credentials.charSlot, credentials.username, credentials.password); ((WowExe)comboBoxWoWs.SelectedItem).characterName = charname; ButtonGo_Click(this, null); } else { MessageBox.Show("Please select a wow process or set the executeable path to auto-start it", "Error"); } }