/* * Class SettingsManager * This is used to load the settings file and set the initial settings values. * This is also used to set/write the individual settings. */ public SettingsManager(MainWindow window) { this.window = window; XDocument xdoc = XDocument.Load("Settings.xml"); foreach (var setting in xdoc.Descendants("Settings")) { try { this.Arma2Path = setting.Element("Arma2Path").Value; window.Arma2Path_Box.Text = this.Arma2Path; this.Arma2OAPath = setting.Element("Arma2OAPath").Value; window.Arma2OAPath_Box.Text = this.Arma2OAPath; this.Arma3Path = setting.Element("Arma3Path").Value; window.Arma3Path_Box.Text = this.Arma3Path; this.Arma2_Options = setting.Element("Arma2_Options").Value; window.Settings_Arma2Options.Text = this.Arma2_Options; this.Arma3_Options = setting.Element("Arma3_Options").Value; window.Settings_Arma3Options.Text = this.Arma3_Options; this.Direct3D_9 = setting.Element("Direct3D9").Value; if (this.Direct3D_9 == "true") { window.Setting_ForceD3D.IsChecked = true; } this.Windowed = setting.Element("Windowed").Value; if (this.Windowed == "true") { window.Setting_Windowed.IsChecked = true; } } catch (NullReferenceException except) { Console.WriteLine("Error Exception: {0}", except); } } }
public serverListCreator(MainWindow window) { this.window = window; // Creates the XML Server List Path ComboBoxItem _gameType = (ComboBoxItem)window.ServerList_GameType.SelectedValue; //.ToString().Replace("System.Windows.Controls.ComboBoxItem: ", ""); string Path = "http://arma3.swec.se/server/list.xml?country=&mquery=" + _gameType.Name.ToString().Replace("_", " ") +"&nquery=&state_playing=1"; Console.WriteLine("Mission Path: " + Path); XDocument xdoc = XDocument.Load(Path); foreach (var server in xdoc.Descendants("server")) { try { this.window.ServerListMW.AddItem(new serverListItem { Favorite = new CheckBox(), ServerName = server.Element("name").Value, Version = server.Element("version").Value, Players = server.Element("players").Value, Ping = "000", GameType = server.Element("mission").Value, Country = server.Element("country").Value, IP = server.Element("host").Value, Port = server.Element("port").Value, Mods = server.Element("mod").Value, Locked = server.Element("passworded").Value, Mission = server.Element("mission").Value, }); } catch (NullReferenceException except) { Console.WriteLine("Error Exception: {0}", except); } } }