public MainForm() { InstallActions.InitConfig(); InitializeComponent(); CheckForIllegalCrossThreadCalls = false; _MainForm = this; }
private void LoadConfig() { try { if (!File.Exists(InstallActions.AppData + "\\data.xml")) { InstallActions.InitConfig(); } System.Xml.XmlDocument xmlConfigDoc = new System.Xml.XmlDocument(); xmlConfigDoc.PreserveWhitespace = true; xmlConfigDoc.Load(AppData + "\\data.xml"); xplaneDirTextBox.Text = xmlConfigDoc.SelectSingleNode("installer/configuration/xplanePath").InnerText; //audioBirdCheck.Checked = Convert.ToBoolean(xmlConfigDoc.SelectSingleNode("installer/configuration/audiobirdxp").InnerText); //RGModCheckbox.Checked = Convert.ToBoolean(xmlConfigDoc.SelectSingleNode("installer/configuration/texturemod").InnerText); installedZibo = xmlConfigDoc.SelectSingleNode("installer/data/ziboVer").InnerText; //installedAudioB = xmlConfigDoc.SelectSingleNode("installer/data/fmodVer").InnerText; dropdownbox.SelectedIndex = Convert.ToInt32(xmlConfigDoc.SelectSingleNode("installer/configuration/textureres").InnerText); //texturemodInstalled = Convert.ToBoolean(xmlConfigDoc.SelectSingleNode("installer/data/texturemodinstalled").InnerText); xmlConfigDoc.Save(AppData + "\\data.xml"); } catch (Exception ex) { if (ex is NullReferenceException || ex is System.Xml.XmlException || ex is System.ArgumentOutOfRangeException) { InstallActions.ResetConfig(); LoadConfig(); MessageBox.Show("Corrupt or old configuration detected. Configuration reset to default values."); InstallActions.AppendLogText("Couldn't load configuration! Corrupt or old configuration detected. Configuration reset to default values."); return; } if (ex is FileNotFoundException || ex is DirectoryNotFoundException) { InstallActions.AppendLogText("The configuration or configuration folder couldn't be found."); return; } throw ex; } }