private void addProfileToolStripMenuItem_Click(object sender, EventArgs e) { AddProfileDialog diag = new AddProfileDialog(); diag.ShowDialog(); ReloadProfiles(); }
private void propertiesToolStripMenuItem_Click(object sender, EventArgs e) { if (Profiles.SelectedItems[0].Group == Profiles.Groups[0]) { AddProfileDialog diag = new AddProfileDialog(true); diag.ShowDialog(); } else { AddProfileDialog diag = new AddProfileDialog(new StarterProfile(Profiles.SelectedItems[0].Text)); diag.ShowDialog(); ReloadProfiles(); } }
private void duplicateMenuItem_Click(object sender, EventArgs e) { if (Profiles.SelectedItems.Count == 1) { StarterProfile oldProfile; String oldFolder; String newProfileAddOn = ""; if (Profiles.SelectedItems[0] == DefaultProfileItem) { oldProfile = null; var directory = new DirectoryInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Electronic Arts")); var root = FindSimsRoot(directory, 6); oldFolder = root.FullName; newProfileAddOn = Path.Combine(root.Parent.Parent.Name, Path.Combine(root.Parent.Name, root.Name)); } else { oldProfile = new StarterProfile(Profiles.SelectedItems[0].Text); oldFolder = oldProfile.VirtualAppDataFolder; } var diag = new AddProfileDialog(oldProfile, true); diag.ShowDialog(); var newProfile = diag.Profile; if (newProfile == null) { return; } var newFolder = newProfile.VirtualAppDataFolder; if (newProfileAddOn != null) { newFolder = Path.Combine(newFolder, newProfileAddOn); new DirectoryInfo(newFolder).Create(); } try { new Computer().FileSystem.CopyDirectory(oldFolder, newFolder, Microsoft.VisualBasic.FileIO.UIOption.AllDialogs, Microsoft.VisualBasic.FileIO.UICancelOption.ThrowException); } catch (Exception ex) { MessageBox.Show(ex.Message); newProfile.Delete(); } ReloadProfiles(); } }