private void removeAccount(object sender, RoutedEventArgs e) { //Some error checking for retards if (ACCOUNT_LIST_BOX.SelectedIndex == -1) { classLabel.Text = "No account selected, select an account before attemping to delete it!"; ((Storyboard)FindResource("animate")).Begin(ErrorPromptGrid); return; } List <ACCOUNT_CONFIG.BNS_SAVED_ACCOUNTS_STRUCT> SAVED_ACCOUNTS = ACCOUNT_CONFIG.ACCOUNTS.Saved; int HAS_INDEX = SAVED_ACCOUNTS.FindIndex(x => x.EMAIL == ACCOUNT_LIST_BOX.Text); if (HAS_INDEX == -1) { return; } SAVED_ACCOUNTS.RemoveAt(HAS_INDEX); ACCOUNT_CONFIG.ACCOUNTS.Saved = SAVED_ACCOUNTS; ACCOUNT_CONFIG.appendChangesToConfig(); ACCOUNT_LIST_BOX.Items.Clear(); foreach (var account in ACCOUNT_CONFIG.ACCOUNTS.Saved) { ACCOUNT_LIST_BOX.Items.Add(account.EMAIL); } }
//This is so bad on so many levels but i don't care, it works as is. Maybe one day i'll use a viewmodel which is the proper way to handle this. private void LaunchOptionsClose(object sender, RoutedEventArgs e) { ((Storyboard)FindResource("FadeOut")).Begin(LaunchOptions); try { ACCOUNT_CONFIG.ACCOUNTS.ADDITIONAL_PARAMS = cmdParams.Text; ACCOUNT_CONFIG.appendChangesToConfig(); var dataList = SkillDataGrid.Items.OfType <SkillData>().ToList(); var nodes = MainWindow.qol_xml.XPathSelectElement("config/gcd/skill"); XDocument tempdoc = MainWindow.qol_xml; tempdoc.Descendants("skill").Where(x => true).Remove(); var elements = tempdoc.Descendants("gcd").Last(); foreach (SkillData skill in dataList) { elements.Add(new XElement("skill", new XAttribute("id", skill.skillID.ToString()), new XAttribute("value", skill.skillvalue), new XAttribute("mode", skill.mode.ToString()))); } //tempdoc.XPathSelectElement("config/gcd").Attribute("enable").Value = ((bool)enableGCD.IsChecked) ? "1" : "0"; MainWindow.qol_xml.Save(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "BnS", "multitool_qol.xml")); } catch (Exception ex) { var dialog = new ErrorPrompt(String.Format("Error saving to multitool_qol.xml, make sure everything is filled out correctly in the skill section and the file exists in documents.\r\rAddition Info:\n{0}", ex.Message)); dialog.ShowDialog(); } }
private void saveAccount(object sender, RoutedEventArgs e) { if (BNS_USERNAME_BOX.Text == "") { classLabel.Text = "Email field cannot be left blank"; ((Storyboard)FindResource("animate")).Begin(ErrorPromptGrid); return; } else if (BNS_PASSWORD_BOX.Password == "") { classLabel.Text = "Password field cannot be left blank"; ((Storyboard)FindResource("animate")).Begin(ErrorPromptGrid); return; } List <ACCOUNT_CONFIG.BNS_SAVED_ACCOUNTS_STRUCT> SAVED_ACCOUNTS = ACCOUNT_CONFIG.ACCOUNTS.Saved; int HAS_INDEX = SAVED_ACCOUNTS.FindIndex(x => x.EMAIL == BNS_USERNAME_BOX.Text); if (HAS_INDEX == -1) { SAVED_ACCOUNTS.Add(new ACCOUNT_CONFIG.BNS_SAVED_ACCOUNTS_STRUCT() { EMAIL = BNS_USERNAME_BOX.Text, PASSWORD = BNS_PASSWORD_BOX.Password, PINCODE = BNS_PINCODE_BOX.Text }); } else { if (BNS_PASSWORD_BOX.Password != "") { SAVED_ACCOUNTS[HAS_INDEX].PASSWORD = BNS_PASSWORD_BOX.Password; } if (BNS_PINCODE_BOX.Text != "") { SAVED_ACCOUNTS[HAS_INDEX].PINCODE = BNS_PINCODE_BOX.Text; } } ACCOUNT_CONFIG.ACCOUNTS.Saved = SAVED_ACCOUNTS; ACCOUNT_CONFIG.appendChangesToConfig(); ACCOUNT_LIST_BOX.Items.Clear(); //Flush the list foreach (var account in ACCOUNT_CONFIG.ACCOUNTS.Saved) { ACCOUNT_LIST_BOX.Items.Add(account.EMAIL); } }
private void launchInfoCheckStateChanged(object sender, RoutedEventArgs e) { CheckBox currentCheckBox = (CheckBox)sender; int currentState = ((bool)currentCheckBox.IsChecked) ? 1 : 0; if (currentCheckBox.Name == "NOTEXTURE_STREAMING") { ACCOUNT_CONFIG.ACCOUNTS.USE_TEXTURE_STREAMING = currentState; ACCOUNT_CONFIG.appendChangesToConfig(); } else if (currentCheckBox.Name == "USE_ALL_CORES") { ACCOUNT_CONFIG.ACCOUNTS.USE_ALL_CORES = currentState; ACCOUNT_CONFIG.appendChangesToConfig(); } else if (currentCheckBox.Name == "useLastChar") { ACCOUNT_CONFIG.ACCOUNTS.SELECT_LAST_CHAR = currentState; ACCOUNT_CONFIG.appendChangesToConfig(); } else if (currentCheckBox.Name == "enableGCD") { var gcd_node = MainWindow.qol_xml.XPathSelectElement("/config/gcd"); gcd_node.Attribute("enable").Value = currentState.ToString(); MainWindow.qol_xml.Save(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "BnS", "multitool_qol.xml")); } else { string optionName = currentCheckBox.Name; if (currentCheckBox.Name == "autocombatrangeTOS") { optionName = "AutoCombat"; } var option_node = MainWindow.qol_xml.XPathSelectElement("/config/options/option[@name='" + optionName + "']"); if (currentCheckBox.Name == "autocombatrangeTOS") { option_node.Attribute("useRange").Value = currentState.ToString(); } else { option_node.Attribute("enable").Value = currentState.ToString(); } MainWindow.qol_xml.Save(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "BnS", "multitool_qol.xml")); } }
private void launchInfoCheckStateChanged(object sender, RoutedEventArgs e) { CheckBox currentCheckBox = (CheckBox)sender; int currentState = ((bool)currentCheckBox.IsChecked) ? 1 : 0; Debug.WriteLine(String.Format("Check State: {0}", currentState)); if (currentCheckBox.Name == "NOTEXTURE_STREAMING") { ACCOUNT_CONFIG.ACCOUNTS.USE_TEXTURE_STREAMING = currentState; } else { ACCOUNT_CONFIG.ACCOUNTS.USE_ALL_CORES = currentState; } ACCOUNT_CONFIG.appendChangesToConfig(); }
private void launchInfoSelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBox currentComboBox = (ComboBox)sender; int currentIndex = currentComboBox.SelectedIndex; if (currentComboBox.Name == "BIT_BOX") { ACCOUNT_CONFIG.ACCOUNTS.CLIENT_BIT = currentIndex; } else if (currentComboBox.Name == "REGION_BOX") { ACCOUNT_CONFIG.ACCOUNTS.REGION = currentIndex; } else { ACCOUNT_CONFIG.ACCOUNTS.LANGUAGE = currentIndex; } ACCOUNT_CONFIG.appendChangesToConfig(); }
private void launchInfoSelectionChanged(object sender, SelectionChangedEventArgs e) { modPath = SystemConfig.SYS.BNS_DIR + @"\contents\Local\NCWEST\" + languageFromSelection() + @"\CookedPC_Mod"; modDestination = SystemConfig.SYS.BNS_DIR + @"\contents\Local\NCWEST\" + languageFromSelection() + @"\CookedPC\mod"; if (!Directory.Exists(modPath)) { Directory.CreateDirectory(modPath); } if (!Directory.Exists(modDestination)) { Directory.CreateDirectory(modDestination); } ComboBox currentComboBox = (ComboBox)sender; int currentIndex = currentComboBox.SelectedIndex; ACCOUNT_CONFIG.ACCOUNTS.LANGUAGE = currentIndex; ACCOUNT_CONFIG.appendChangesToConfig(); }
private void MemoryCleanerBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ACCOUNT_CONFIG.ACCOUNTS.MEMORY_CLEANER = ((ComboBox)sender).SelectedIndex; ACCOUNT_CONFIG.appendChangesToConfig(); if (((ComboBox)sender).SelectedIndex == 0) { if (memoryTimer.IsEnabled) { memoryTimer.IsEnabled = false; memoryTimer.Stop(); } return; } if (memoryTimer.IsEnabled) { memoryTimer.Stop(); } memoryTimer.Interval = TimeSpan.FromMinutes(timerFromSelection()); memoryTimer.IsEnabled = true; memoryTimer.Start(); }