private void createProfile() { createMode = true; if (tanksModsPath == null) { MessageBox.Show("you must have your tanks folder selected\nbefore you can create a profile"); return; } pInfo = new ProfileInfo(); pInfo.ShowDialog(); if (!pInfo.cont) { return; } profileName = pInfo.textBox1.Text; profileDesc = pInfo.textBox2.Text; WotResModsBrowser.ShowNewFolderButton = true; WotResModsBrowser.Description = "Select where you would like to save your profile"; if (WotResModsBrowser.ShowDialog() == DialogResult.Cancel) { statusInfoLabel.Text = "cancled"; return; } statusInfoLabel.Text = "Creating Profile..."; profilePath = WotResModsBrowser.SelectedPath; profileFile = profilePath + "\\profileInfo.wotprofile"; this.copy(tanksModsPath, profilePath); }
private void detectedTanksFolderButton_Click(object sender, EventArgs e) { WotResModsBrowser.ShowNewFolderButton = false; WotResModsBrowser.Description = "Please find the 'res_mods' forlder for your world of tanks"; if (WotResModsBrowser.ShowDialog() == DialogResult.Cancel) { return; } //verify it's the res_mods folder string temp = WotResModsBrowser.SelectedPath; temp = temp.Substring(temp.Length - 9); if (temp.Equals("\\res_mods")) { tanksModsPath = WotResModsBrowser.SelectedPath; detectedTanksFolderLabel.ForeColor = Color.DarkGreen; detectedTanksFolderPath.Text = WotResModsBrowser.SelectedPath; } else { MessageBox.Show("that doesn't seem like the res_mods folder..."); tanksModsPath = "invalid"; detectedTanksFolderLabel.ForeColor = Color.Red; detectedTanksFolderPath.Text = tanksModsPath; } }
private void openProfile(bool fromLoad) { if (!fromLoad) { if (profilePath != null) { WotResModsBrowser.RootFolder = Environment.SpecialFolder.Desktop; WotResModsBrowser.SelectedPath = profilePath; } WotResModsBrowser.ShowNewFolderButton = false; WotResModsBrowser.Description = "Select profile to open"; if (WotResModsBrowser.ShowDialog() == DialogResult.Cancel) { return; } profilePath = WotResModsBrowser.SelectedPath; profileFile = profilePath + "\\profileInfo.wotprofile"; } if (!File.Exists(profileFile)) { if (!fromLoad) { MessageBox.Show("Selected folder is not a profile"); } if (fromLoad) { resetSettings.Checked = true; Application.Restart(); } return; } string temp = File.ReadAllText(profileFile); string[] stringArray = temp.Split('\n'); foreach (string s in stringArray) { string[] anotherArray = s.Split('='); switch (anotherArray[0]) { case "profileName": profileName = anotherArray[1]; selectedProfileNameLabel.Text = anotherArray[1]; break; case "profileDesc": profileDesc = anotherArray[1]; selectedProfileDescLabel.Text = anotherArray[1]; break; default: break; } } selectedProfilePathLabel.Text = profilePath; selectedProfileLabel.ForeColor = Color.DarkGreen; }
private void updateOtherProfileButton_Click(object sender, EventArgs e) { string tempProfileName = ""; string tempProfileDesc = ""; string tempPath = ""; string tempFile = ""; WotResModsBrowser.ShowNewFolderButton = false; WotResModsBrowser.Description = "Select Profile to update"; if (WotResModsBrowser.ShowDialog() == DialogResult.Cancel) { statusInfoLabel.Text = "cancled"; return; } statusInfoLabel.Text = "Updating Profile..."; tempPath = WotResModsBrowser.SelectedPath; if (tanksModsPath == null) { MessageBox.Show("you must have your tanks folder selected\nbefore you can create a profile"); return; } tempFile = tempPath + "\\profileInfo.wotprofile"; string temp = File.ReadAllText(tempFile); string[] stringArray = temp.Split('\n'); foreach (string s in stringArray) { string[] anotherArray = s.Split('='); switch (anotherArray[0]) { case "profileName": tempProfileName = anotherArray[1]; break; case "profileDesc": tempProfileDesc = anotherArray[1]; break; default: break; } } temp = File.ReadAllText(tanksModsPath + "\\profileInfo.wotprofile"); stringArray = temp.Split('\n'); foreach (string s in stringArray) { string[] anotherArray = s.Split('='); switch (anotherArray[0]) { case "profileName": if (tempProfileName != anotherArray[1]) { MessageBox.Show("Selected Profile is not the same as active profile\nupdate aborted"); statusInfoLabel.Text = "Idle"; return; } break; case "profileDesc": if (tempProfileDesc != anotherArray[1]) { MessageBox.Show("Selected Profile is not the same as active profile\nupdate aborted"); statusInfoLabel.Text = "Idle"; return; } break; default: break; } } tempFile = tempPath + "\\profileInfo.wotprofile"; Directory.Delete(tempPath, true); if (!Directory.Exists(tempPath)) { Directory.CreateDirectory(tempPath); } this.copy(tanksModsPath, tempPath); }