private void MainForm_Load(object sender, EventArgs e) { Version version = Assembly.GetExecutingAssembly().GetName().Version; // Finds the path where program is executing PATH = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); // Add version to title this.Text += " v" + version.Major + '.' + version.Minor + '.' + version.Build; tskIcon.Text += " v" + version.Major + '.' + version.Minor + '.' + version.Build; // Check for settings file or create default settings if (File.Exists(PATH + @"\settings.xml")) { LoadSettings(); } else { SETTINGS = new Settings(); } // Check for updates CheckUpdate(version); options = new Options(); crypto = new Crypto(); ACCOUNTS = new List<Account>(); // If data file exists load it if (File.Exists(PATH + @"\data.al")) { data = File.ReadAllText(PATH + @"\data.al"); } // Look for wow.exe if (!File.Exists(SETTINGS.WowPath + @"\Wow.exe")) { MessageBox.Show("Could not find Wow.exe." + Environment.NewLine + "Please browse to your World of Warcraft folder."); new SettingsForm().ShowDialog(this); } LoadData(); }
private void LoadSettings() { try { // Load the XML settings file XmlSerializer reader = new XmlSerializer(typeof(Settings)); StreamReader file = new StreamReader(PATH + @"\settings.xml"); SETTINGS = (Settings)reader.Deserialize(file); file.Close(); if (SETTINGS.HasPassword) { new PasswordForm().GetPassword(this); } } catch (Exception) { } }