diff --git a/GUI/CKAN-GUI.csproj b/GUI/CKAN-GUI.csproj index 5aeb0486bb..dd7b10a388 100644 --- a/GUI/CKAN-GUI.csproj +++ b/GUI/CKAN-GUI.csproj @@ -70,11 +70,11 @@ ManageGameInstancesDialog.cs - + Form - - CloneFakeGameDialog.cs + + CloneGameInstanceDialog.cs Form @@ -459,35 +459,35 @@ ..\..\Dialogs\AskUserForAutoUpdatesDialog.cs - - CloneFakeGameDialog.cs + + CloneGameInstanceDialog.cs - - ..\..\Dialogs\CloneFakeGameDialog.cs + + ..\..\Dialogs\CloneGameInstanceDialog.cs - - ..\..\Dialogs\CloneFakeGameDialog.cs + + ..\..\Dialogs\CloneGameInstanceDialog.cs - - ..\..\Dialogs\CloneFakeGameDialog.cs + + ..\..\Dialogs\CloneGameInstanceDialog.cs - - ..\..\Dialogs\CloneFakeGameDialog.cs + + ..\..\Dialogs\CloneGameInstanceDialog.cs - - ..\..\Dialogs\CloneFakeGameDialog.cs + + ..\..\Dialogs\CloneGameInstanceDialog.cs - - ..\..\Dialogs\CloneFakeGameDialog.cs + + ..\..\Dialogs\CloneGameInstanceDialog.cs - - ..\..\Dialogs\CloneFakeGameDialog.cs + + ..\..\Dialogs\CloneGameInstanceDialog.cs - - ..\..\Dialogs\CloneFakeGameDialog.cs + + ..\..\Dialogs\CloneGameInstanceDialog.cs - - ..\..\Dialogs\CloneFakeGameDialog.cs + + ..\..\Dialogs\CloneGameInstanceDialog.cs CompatibleGameVersionsDialog.cs diff --git a/GUI/Dialogs/CloneFakeGameDialog.cs b/GUI/Dialogs/CloneFakeGameDialog.cs deleted file mode 100644 index c40115183a..0000000000 --- a/GUI/Dialogs/CloneFakeGameDialog.cs +++ /dev/null @@ -1,354 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using System.ComponentModel; -using System.Windows.Forms; -using Autofac; -using CKAN.Versioning; -using CKAN.Games; - -namespace CKAN.GUI -{ - /// - /// The GUI implementation of clone and fake. - /// It's a separate window, handling the whole process. - /// - public partial class CloneFakeGameDialog : Form - { - private GameInstanceManager manager; - private IUser user; - - public CloneFakeGameDialog(GameInstanceManager manager, IUser user) - : base() - { - this.manager = manager; - this.user = user; - - InitializeComponent(); - - // Populate the version combobox for fake instance. - List knownVersions = new KerbalSpaceProgram().KnownVersions; - knownVersions.Reverse(); - comboBoxGameVersion.DataSource = knownVersions; - - // Populate the instances combobox with names of known instances - comboBoxKnownInstance.DataSource = new string[] { "" } - .Concat(manager.Instances.Values - .Where(i => i.Valid) - .OrderBy(i => i.Version()) - .Reverse() - .Select(i => i.Name)) - .ToList(); - comboBoxKnownInstance.Text = manager.CurrentInstance?.Name - ?? manager.AutoStartInstance - ?? ""; - this.radioButtonClone.Checked = true; - } - - #region clone - - private void comboBoxKnownInstance_SelectedIndexChanged(object sender, EventArgs e) - { - string sel = comboBoxKnownInstance.SelectedItem as string; - textBoxClonePath.Text = string.IsNullOrEmpty(sel) - ? "" - : manager.Instances[sel].GameDir().Replace('/', Path.DirectorySeparatorChar); - } - - /// - /// Open an file dialog to search for a game instance, like in ManageGameInstancesDialog. - /// - private void buttonInstancePathSelection_Click(object sender, EventArgs e) - { - // Create a new FileDialog object - OpenFileDialog instanceDialog = new OpenFileDialog() - { - AddExtension = false, - CheckFileExists = false, - CheckPathExists = false, - InitialDirectory = Environment.CurrentDirectory, - Filter = ManageGameInstancesDialog.GameFolderFilter(manager), - Multiselect = false - }; - - // Show the FileDialog and let the user search for the game directory. - if (instanceDialog.ShowDialog(this) != DialogResult.OK || !File.Exists(instanceDialog.FileName)) - return; - - // Write the path to the textbox - textBoxClonePath.Text = Path.GetDirectoryName(instanceDialog.FileName); - } - - #endregion - #region radio buttons - - /// - /// The radio buttons are in different GroupBoxes, so they need to be unset manually. - /// - private void radioButton_CheckedChanged(object sender, EventArgs e) - { - RadioButton clickedRadioButton = (RadioButton)sender; - - if (clickedRadioButton.Checked) - { - if (clickedRadioButton == radioButtonClone) - { - radioButtonFake.Checked = false; - cloneGroupBox.Enabled = !(fakeGroupBox.Enabled = false); - } - else - { - radioButtonClone.Checked = false; - fakeGroupBox.Enabled = !(cloneGroupBox.Enabled = false); - } - } - } - - #endregion - - /// - /// User is done. Start cloning or faking, depending on the clicked radio button. - /// Close the window if everything went right. - /// - private async void buttonOK_Click(object sender, EventArgs e) - { - string existingPath = textBoxClonePath.Text; - string newName = textBoxNewName.Text; - string newPath = textBoxNewPath.Text; - - // Do some basic checks. - if (String.IsNullOrWhiteSpace(newName)) - { - user.RaiseError(Properties.Resources.CloneFakeKspDialogEnterName); - return; - } - if (String.IsNullOrWhiteSpace(newPath)) - { - user.RaiseError(Properties.Resources.CloneFakeKspDialogEnterPath); - return; - } - - // Show progress bar and deactivate controls. - progressBar.Style = ProgressBarStyle.Marquee; - progressBar.Show(); - foreach (Control ctrl in this.Controls) - { - ctrl.Enabled = false; - } - - // Clone the specified instance. - // Done in a new task to not block the GUI thread. - if (radioButtonClone.Checked) - { - user.RaiseMessage(Properties.Resources.CloneFakeKspDialogCloningInstance); - - try - { - GameInstance instanceToClone = null; - if (!manager.Instances.TryGetValue(comboBoxKnownInstance.SelectedItem as string, out instanceToClone) - || existingPath != instanceToClone.GameDir().Replace('/', Path.DirectorySeparatorChar)) - { - IGame sourceGame = manager.DetermineGame(new DirectoryInfo(existingPath), user); - if (sourceGame == null) - { - // User cancelled, let them try again - reactivateDialog(); - return; - } - instanceToClone = new GameInstance( - sourceGame, - existingPath, - "irrelevant", - user - ); - } - await Task.Run(() => - { - if (instanceToClone.Valid) - { - manager.CloneInstance(instanceToClone, newName, newPath); - } - else - { - throw new NotKSPDirKraken(instanceToClone.GameDir()); - } - }); - } - catch (InstanceNameTakenKraken) - { - user.RaiseError(Properties.Resources.CloneFakeKspDialogNameAlreadyUsed); - reactivateDialog(); - return; - } - catch (NotKSPDirKraken kraken) - { - user.RaiseError(string.Format(Properties.Resources.CloneFakeKspDialogInstanceNotValid, kraken.path.Replace('/', Path.DirectorySeparatorChar))); - reactivateDialog(); - return; - } - catch (PathErrorKraken kraken) - { - user.RaiseError(string.Format(Properties.Resources.CloneFakeKspDialogDestinationNotEmpty, kraken.path.Replace('/', Path.DirectorySeparatorChar))); - reactivateDialog(); - return; - } - catch (IOException ex) - { - user.RaiseError(string.Format(Properties.Resources.CloneFakeKspDialogCloneFailed, ex.Message)); - reactivateDialog(); - return; - } - catch (Exception ex) - { - user.RaiseError(string.Format(Properties.Resources.CloneFakeKspDialogCloneFailed, ex.Message)); - reactivateDialog(); - return; - } - - if (checkBoxSetAsDefault.Checked) - { - manager.SetAutoStart(newName); - } - - if (checkBoxSwitchInstance.Checked) - { - manager.SetCurrentInstance(newName); - } - - user.RaiseMessage(Properties.Resources.CloneFakeKspDialogSuccessfulClone); - - DialogResult = DialogResult.OK; - this.Close(); - } - - // Create a new dummy instance. - // Also in a separate task. - else if (radioButtonFake.Checked) - { - GameVersion GameVersion = GameVersion.Parse(comboBoxGameVersion.Text); - - Dictionary dlcs = new Dictionary(); - if (!String.IsNullOrWhiteSpace(textBoxMHDlcVersion.Text) && textBoxMHDlcVersion.Text.ToLower() != "none") - { - if (GameVersion.TryParse(textBoxMHDlcVersion.Text, out GameVersion ver)) - { - dlcs.Add(new DLC.MakingHistoryDlcDetector(), ver); - } - else - { - user.RaiseError(Properties.Resources.CloneFakeKspDialogDlcVersionMalformatted, "Making History"); - reactivateDialog(); - return; - } - } - if (!String.IsNullOrWhiteSpace(textBoxBGDlcVersion.Text) && textBoxBGDlcVersion.Text.ToLower() != "none") - { - if (GameVersion.TryParse(textBoxBGDlcVersion.Text, out GameVersion ver)) - { - dlcs.Add(new DLC.BreakingGroundDlcDetector(), ver); - } - else - { - user.RaiseError(Properties.Resources.CloneFakeKspDialogDlcVersionMalformatted, "Breaking Ground"); - reactivateDialog(); - return; - } - } - - user.RaiseMessage(Properties.Resources.CloneFakeKspDialogCreatingInstance); - - try - { - await Task.Run(() => - { - manager.FakeInstance(new KerbalSpaceProgram(), newName, newPath, GameVersion, dlcs); - }); - } - catch (InstanceNameTakenKraken) - { - user.RaiseError(Properties.Resources.CloneFakeKspDialogNameAlreadyUsed); - reactivateDialog(); - return; - } - catch (BadInstallLocationKraken) - { - user.RaiseError(Properties.Resources.CloneFakeKspDialogDestinationNotEmpty, newPath); - reactivateDialog(); - return; - } - catch (Exception ex) - { - user.RaiseError(string.Format(Properties.Resources.CloneFakeKspDialogFakeFailed, ex.Message)); - reactivateDialog(); - return; - } - - if (checkBoxSetAsDefault.Checked) - { - manager.SetAutoStart(newName); - } - - if (checkBoxSwitchInstance.Checked) - { - manager.SetCurrentInstance(newName); - } - - user.RaiseMessage(Properties.Resources.CloneFakeKspDialogSuccessfulCreate); - - DialogResult = DialogResult.OK; - this.Close(); - } - } - - private void buttonCancel_Click(object sender, EventArgs e) - { - DialogResult = DialogResult.Cancel; - this.Close(); - } - - /// - /// Activate all controls, shrink window and hide progress bar. - /// - private void reactivateDialog() - { - foreach (Control ctrl in this.Controls) - { - ctrl.Enabled = true; - } - // Conditionally enable/disable the fake/clone fields - radioButton_CheckedChanged(radioButtonClone, null); - radioButton_CheckedChanged(radioButtonFake, null); - progressBar.Style = ProgressBarStyle.Continuous; - progressBar.Value = 0; - progressBar.Hide(); - } - - private void buttonPathBrowser_Click(object sender, EventArgs e) - { - if (folderBrowserDialogNewPath.ShowDialog(this).Equals(DialogResult.OK)) - { - textBoxNewPath.Text = folderBrowserDialogNewPath.SelectedPath; - } - - } - - /// - /// Open the user guide when the user presses F1 - /// - protected override void OnHelpRequested(HelpEventArgs evt) - { - evt.Handled = Util.TryOpenWebPage(HelpURLs.CloneFakeInstances); - } - - /// - /// Open the user guide when the user clicks the help button - /// - protected override void OnHelpButtonClicked(CancelEventArgs evt) - { - evt.Cancel = Util.TryOpenWebPage(HelpURLs.CloneFakeInstances); - } - - } -} diff --git a/GUI/Dialogs/CloneFakeGameDialog.Designer.cs b/GUI/Dialogs/CloneGameInstanceDialog.Designer.cs similarity index 58% rename from GUI/Dialogs/CloneFakeGameDialog.Designer.cs rename to GUI/Dialogs/CloneGameInstanceDialog.Designer.cs index 29c46fd177..602a66649d 100644 --- a/GUI/Dialogs/CloneFakeGameDialog.Designer.cs +++ b/GUI/Dialogs/CloneGameInstanceDialog.Designer.cs @@ -1,6 +1,6 @@ namespace CKAN.GUI { - partial class CloneFakeGameDialog + partial class CloneGameInstanceDialog { /// /// Required designer variable. @@ -29,23 +29,12 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new SingleAssemblyComponentResourceManager(typeof(CloneFakeGameDialog)); - this.radioButtonClone = new System.Windows.Forms.RadioButton(); - this.cloneGroupBox = new System.Windows.Forms.GroupBox(); + System.ComponentModel.ComponentResourceManager resources = new SingleAssemblyComponentResourceManager(typeof(CloneGameInstanceDialog)); this.labelOldInstance = new System.Windows.Forms.Label(); this.comboBoxKnownInstance = new System.Windows.Forms.ComboBox(); this.labelOldPath = new System.Windows.Forms.Label(); this.textBoxClonePath = new System.Windows.Forms.TextBox(); this.buttonInstancePathSelection = new System.Windows.Forms.Button(); - this.radioButtonFake = new System.Windows.Forms.RadioButton(); - this.fakeGroupBox = new System.Windows.Forms.GroupBox(); - this.labelVersion = new System.Windows.Forms.Label(); - this.comboBoxGameVersion = new System.Windows.Forms.ComboBox(); - this.labelDlcVersions = new System.Windows.Forms.Label(); - this.textBoxMHDlcVersion = new System.Windows.Forms.TextBox(); - this.labelMakingHistory = new System.Windows.Forms.Label(); - this.textBoxBGDlcVersion = new System.Windows.Forms.TextBox(); - this.labelBreakingGround = new System.Windows.Forms.Label(); this.labelNewName = new System.Windows.Forms.Label(); this.textBoxNewName = new System.Windows.Forms.TextBox(); this.labelNewPath = new System.Windows.Forms.Label(); @@ -57,37 +46,8 @@ private void InitializeComponent() this.buttonCancel = new System.Windows.Forms.Button(); this.progressBar = new System.Windows.Forms.ProgressBar(); this.folderBrowserDialogNewPath = new System.Windows.Forms.FolderBrowserDialog(); - this.cloneGroupBox.SuspendLayout(); - this.fakeGroupBox.SuspendLayout(); this.SuspendLayout(); // - // radioButtonClone - // - this.radioButtonClone.AutoSize = true; - this.radioButtonClone.Location = new System.Drawing.Point(20, 8); - this.radioButtonClone.Name = "radioButtonClone"; - this.radioButtonClone.Size = new System.Drawing.Size(157, 17); - this.radioButtonClone.TabIndex = 99; - this.radioButtonClone.TabStop = true; - this.radioButtonClone.UseVisualStyleBackColor = true; - this.radioButtonClone.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged); - resources.ApplyResources(this.radioButtonClone, "radioButtonClone"); - // - // cloneGroupBox - // - this.cloneGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.cloneGroupBox.Controls.Add(this.labelOldInstance); - this.cloneGroupBox.Controls.Add(this.comboBoxKnownInstance); - this.cloneGroupBox.Controls.Add(this.labelOldPath); - this.cloneGroupBox.Controls.Add(this.textBoxClonePath); - this.cloneGroupBox.Controls.Add(this.buttonInstancePathSelection); - this.cloneGroupBox.Location = new System.Drawing.Point(13, 13); - this.cloneGroupBox.Name = "cloneGroupBox"; - this.cloneGroupBox.Size = new System.Drawing.Size(399, 100); - this.cloneGroupBox.TabIndex = 1; - this.cloneGroupBox.TabStop = false; - // // labelOldInstance // this.labelOldInstance.AutoSize = true; @@ -103,7 +63,7 @@ private void InitializeComponent() this.comboBoxKnownInstance.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource; this.comboBoxKnownInstance.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxKnownInstance.FormattingEnabled = true; - this.comboBoxKnownInstance.Location = new System.Drawing.Point(168, 19); + this.comboBoxKnownInstance.Location = new System.Drawing.Point(181, 19); this.comboBoxKnownInstance.MaxDropDownItems = 10; this.comboBoxKnownInstance.Name = "comboBoxKnownInstance"; this.comboBoxKnownInstance.Size = new System.Drawing.Size(218, 20); @@ -122,7 +82,7 @@ private void InitializeComponent() // textBoxClonePath // this.textBoxClonePath.AllowDrop = true; - this.textBoxClonePath.Location = new System.Drawing.Point(168, 49); + this.textBoxClonePath.Location = new System.Drawing.Point(181, 49); this.textBoxClonePath.Name = "textBoxClonePath"; this.textBoxClonePath.Size = new System.Drawing.Size(158, 20); this.textBoxClonePath.TabIndex = 5; @@ -131,7 +91,7 @@ private void InitializeComponent() // buttonInstancePathSelection // this.buttonInstancePathSelection.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.buttonInstancePathSelection.Location = new System.Drawing.Point(326, 48); + this.buttonInstancePathSelection.Location = new System.Drawing.Point(339, 48); this.buttonInstancePathSelection.Name = "buttonInstancePathSelection"; this.buttonInstancePathSelection.Size = new System.Drawing.Size(60, 22); this.buttonInstancePathSelection.TabIndex = 6; @@ -139,102 +99,10 @@ private void InitializeComponent() this.buttonInstancePathSelection.Click += new System.EventHandler(this.buttonInstancePathSelection_Click); resources.ApplyResources(this.buttonInstancePathSelection, "buttonInstancePathSelection"); // - // fakeGroupBox - // - this.fakeGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.fakeGroupBox.Controls.Add(this.labelDlcVersions); - this.fakeGroupBox.Controls.Add(this.textBoxMHDlcVersion); - this.fakeGroupBox.Controls.Add(this.labelMakingHistory); - this.fakeGroupBox.Controls.Add(this.textBoxBGDlcVersion); - this.fakeGroupBox.Controls.Add(this.labelBreakingGround); - this.fakeGroupBox.Controls.Add(this.labelVersion); - this.fakeGroupBox.Controls.Add(this.comboBoxGameVersion); - this.fakeGroupBox.Location = new System.Drawing.Point(13, 130); - this.fakeGroupBox.Name = "fakeGroupBox"; - this.fakeGroupBox.Size = new System.Drawing.Size(400, 104); - this.fakeGroupBox.TabIndex = 7; - this.fakeGroupBox.TabStop = false; - // - // radioButtonFake - // - this.radioButtonFake.AutoSize = true; - this.radioButtonFake.Location = new System.Drawing.Point(20, 125); - this.radioButtonFake.Name = "radioButtonFake"; - this.radioButtonFake.Size = new System.Drawing.Size(139, 17); - this.radioButtonFake.TabIndex = 8; - this.radioButtonFake.TabStop = true; - this.radioButtonFake.UseVisualStyleBackColor = true; - this.radioButtonFake.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged); - resources.ApplyResources(this.radioButtonFake, "radioButtonFake"); - // - // labelVersion - // - this.labelVersion.AutoSize = true; - this.labelVersion.Location = new System.Drawing.Point(12, 23); - this.labelVersion.Name = "labelVersion"; - this.labelVersion.Size = new System.Drawing.Size(174, 26); - this.labelVersion.TabIndex = 9; - this.labelVersion.Text = "Version:"; - resources.ApplyResources(this.labelVersion, "labelVersion"); - // - // comboBoxGameVersion - // - this.comboBoxGameVersion.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; - this.comboBoxGameVersion.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource; - this.comboBoxGameVersion.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBoxGameVersion.FormattingEnabled = true; - this.comboBoxGameVersion.Location = new System.Drawing.Point(168, 20); - this.comboBoxGameVersion.MaxDropDownItems = 6; - this.comboBoxGameVersion.Name = "comboBoxGameVersion"; - this.comboBoxGameVersion.Size = new System.Drawing.Size(83, 21); - this.comboBoxGameVersion.TabIndex = 10; - // - // labelDlcVersions - // - this.labelDlcVersions.AutoSize = true; - this.labelDlcVersions.Location = new System.Drawing.Point(12, 52); - this.labelDlcVersions.Name = "labelDlcVersion"; - this.labelDlcVersions.Size = new System.Drawing.Size(174, 26); - this.labelDlcVersions.TabIndex = 11; - resources.ApplyResources(this.labelDlcVersions, "labelDlcVersions"); - // - // textBoxMHDlcVersion - // - this.textBoxMHDlcVersion.Location = new System.Drawing.Point(170, 49); - this.textBoxMHDlcVersion.Name = "textBoxDlcVersion"; - this.textBoxMHDlcVersion.Size = new System.Drawing.Size(83, 20); - this.textBoxMHDlcVersion.TabIndex = 12; - // - // labelMakingHistory - // - this.labelMakingHistory.AutoSize = true; - this.labelMakingHistory.Location = new System.Drawing.Point(257, 52); - this.labelMakingHistory.Name = "labelMakingHistory"; - this.labelMakingHistory.Size = new System.Drawing.Size(174, 26); - this.labelMakingHistory.TabStop = false; - resources.ApplyResources(this.labelMakingHistory, "labelMakingHistory"); - // - // textBoxBGDlcVersion - // - this.textBoxBGDlcVersion.Location = new System.Drawing.Point(170, 71); - this.textBoxBGDlcVersion.Name = "textBoxDlcVersion"; - this.textBoxBGDlcVersion.Size = new System.Drawing.Size(83, 20); - this.textBoxBGDlcVersion.TabIndex = 13; - // - // labelBreakingGround - // - this.labelBreakingGround.AutoSize = true; - this.labelBreakingGround.Location = new System.Drawing.Point(257, 74); - this.labelBreakingGround.Name = "labelBreakingGround"; - this.labelBreakingGround.Size = new System.Drawing.Size(174, 26); - this.labelBreakingGround.TabStop = false; - resources.ApplyResources(this.labelBreakingGround, "labelBreakingGround"); - // // labelNewName // this.labelNewName.AutoSize = true; - this.labelNewName.Location = new System.Drawing.Point(12, 251); + this.labelNewName.Location = new System.Drawing.Point(12, 82); this.labelNewName.Name = "labelNewName"; this.labelNewName.Size = new System.Drawing.Size(137, 13); this.labelNewName.TabIndex = 14; @@ -242,7 +110,7 @@ private void InitializeComponent() // // textBoxNewName // - this.textBoxNewName.Location = new System.Drawing.Point(181, 248); + this.textBoxNewName.Location = new System.Drawing.Point(181, 79); this.textBoxNewName.Name = "textBoxNewName"; this.textBoxNewName.Size = new System.Drawing.Size(218, 20); this.textBoxNewName.TabIndex = 15; @@ -250,7 +118,7 @@ private void InitializeComponent() // labelNewPath // this.labelNewPath.AutoSize = true; - this.labelNewPath.Location = new System.Drawing.Point(12, 278); + this.labelNewPath.Location = new System.Drawing.Point(12, 112); this.labelNewPath.Name = "labelNewPath"; this.labelNewPath.Size = new System.Drawing.Size(131, 13); this.labelNewPath.TabIndex = 16; @@ -258,7 +126,7 @@ private void InitializeComponent() // // textBoxNewPath // - this.textBoxNewPath.Location = new System.Drawing.Point(181, 275); + this.textBoxNewPath.Location = new System.Drawing.Point(181, 109); this.textBoxNewPath.Name = "textBoxNewPath"; this.textBoxNewPath.Size = new System.Drawing.Size(158, 20); this.textBoxNewPath.TabIndex = 17; @@ -266,7 +134,7 @@ private void InitializeComponent() // buttonPathBrowser // this.buttonPathBrowser.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.buttonPathBrowser.Location = new System.Drawing.Point(339, 274); + this.buttonPathBrowser.Location = new System.Drawing.Point(339, 108); this.buttonPathBrowser.Name = "buttonPathBrowser"; this.buttonPathBrowser.Size = new System.Drawing.Size(60, 22); this.buttonPathBrowser.TabIndex = 18; @@ -278,7 +146,7 @@ private void InitializeComponent() // this.checkBoxSetAsDefault.AutoSize = true; this.checkBoxSetAsDefault.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.checkBoxSetAsDefault.Location = new System.Drawing.Point(12, 310); + this.checkBoxSetAsDefault.Location = new System.Drawing.Point(12, 144); this.checkBoxSetAsDefault.Name = "checkBoxSetAsDefault"; this.checkBoxSetAsDefault.Size = new System.Drawing.Size(157, 17); this.checkBoxSetAsDefault.TabIndex = 19; @@ -291,7 +159,7 @@ private void InitializeComponent() this.checkBoxSwitchInstance.Checked = true; this.checkBoxSwitchInstance.CheckState = System.Windows.Forms.CheckState.Checked; this.checkBoxSwitchInstance.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.checkBoxSwitchInstance.Location = new System.Drawing.Point(181, 310); + this.checkBoxSwitchInstance.Location = new System.Drawing.Point(181, 144); this.checkBoxSwitchInstance.Name = "checkBoxSwitchInstance"; this.checkBoxSwitchInstance.Size = new System.Drawing.Size(136, 17); this.checkBoxSwitchInstance.TabIndex = 20; @@ -301,7 +169,7 @@ private void InitializeComponent() // buttonOK // this.buttonOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.buttonOK.Location = new System.Drawing.Point(256, 336); + this.buttonOK.Location = new System.Drawing.Point(256, 170); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(75, 23); this.buttonOK.TabIndex = 21; @@ -312,7 +180,7 @@ private void InitializeComponent() // buttonCancel // this.buttonCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.buttonCancel.Location = new System.Drawing.Point(337, 336); + this.buttonCancel.Location = new System.Drawing.Point(337, 170); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(75, 23); this.buttonCancel.TabIndex = 22; @@ -324,22 +192,25 @@ private void InitializeComponent() // this.progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.progressBar.Location = new System.Drawing.Point(13, 336); + this.progressBar.Location = new System.Drawing.Point(13, 170); this.progressBar.Name = "progressBar"; this.progressBar.Size = new System.Drawing.Size(230, 23); this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Marquee; this.progressBar.TabIndex = 23; this.progressBar.Visible = false; // - // CloneFakeKspDialog + // CloneGameInstanceDialog // this.AccessibleRole = System.Windows.Forms.AccessibleRole.Dialog; this.AllowDrop = true; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(424, 371); - this.Controls.Add(this.radioButtonClone); - this.Controls.Add(this.radioButtonFake); + this.ClientSize = new System.Drawing.Size(424, 205); + this.Controls.Add(this.labelOldInstance); + this.Controls.Add(this.comboBoxKnownInstance); + this.Controls.Add(this.labelOldPath); + this.Controls.Add(this.textBoxClonePath); + this.Controls.Add(this.buttonInstancePathSelection); this.Controls.Add(this.progressBar); this.Controls.Add(this.buttonPathBrowser); this.Controls.Add(this.checkBoxSwitchInstance); @@ -350,8 +221,6 @@ private void InitializeComponent() this.Controls.Add(this.labelNewName); this.Controls.Add(this.buttonOK); this.Controls.Add(this.buttonCancel); - this.Controls.Add(this.fakeGroupBox); - this.Controls.Add(this.cloneGroupBox); this.AcceptButton = this.buttonOK; this.CancelButton = this.buttonCancel; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; @@ -359,14 +228,10 @@ private void InitializeComponent() this.MaximizeBox = false; this.MinimizeBox = false; this.HelpButton = true; - this.Name = "CloneFakeKspDialog"; + this.Name = "CloneGameInstanceDialog"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; resources.ApplyResources(this, "$this"); - this.cloneGroupBox.ResumeLayout(false); - this.cloneGroupBox.PerformLayout(); - this.fakeGroupBox.ResumeLayout(false); - this.fakeGroupBox.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -374,22 +239,11 @@ private void InitializeComponent() #endregion - private System.Windows.Forms.RadioButton radioButtonClone; - private System.Windows.Forms.GroupBox cloneGroupBox; private System.Windows.Forms.Label labelOldInstance; private System.Windows.Forms.ComboBox comboBoxKnownInstance; private System.Windows.Forms.Label labelOldPath; private System.Windows.Forms.TextBox textBoxClonePath; private System.Windows.Forms.Button buttonInstancePathSelection; - private System.Windows.Forms.RadioButton radioButtonFake; - private System.Windows.Forms.GroupBox fakeGroupBox; - private System.Windows.Forms.Label labelVersion; - private System.Windows.Forms.ComboBox comboBoxGameVersion; - private System.Windows.Forms.Label labelDlcVersions; - private System.Windows.Forms.TextBox textBoxMHDlcVersion; - private System.Windows.Forms.Label labelMakingHistory; - private System.Windows.Forms.TextBox textBoxBGDlcVersion; - private System.Windows.Forms.Label labelBreakingGround; private System.Windows.Forms.Label labelNewName; private System.Windows.Forms.TextBox textBoxNewName; private System.Windows.Forms.Label labelNewPath; diff --git a/GUI/Dialogs/CloneGameInstanceDialog.cs b/GUI/Dialogs/CloneGameInstanceDialog.cs new file mode 100644 index 0000000000..7bdd104155 --- /dev/null +++ b/GUI/Dialogs/CloneGameInstanceDialog.cs @@ -0,0 +1,239 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.ComponentModel; +using System.Windows.Forms; +using Autofac; +using CKAN.Versioning; +using CKAN.Games; + +namespace CKAN.GUI +{ + /// + /// The GUI implementation of clone and fake. + /// It's a separate window, handling the whole process. + /// + public partial class CloneGameInstanceDialog : Form + { + private GameInstanceManager manager; + private IUser user; + + public CloneGameInstanceDialog(GameInstanceManager manager, IUser user, string selectedInstanceName = null) + : base() + { + this.manager = manager; + this.user = user; + + InitializeComponent(); + + // Populate the instances combobox with names of known instances + comboBoxKnownInstance.DataSource = new string[] { "" } + .Concat(manager.Instances.Values + .Where(i => i.Valid) + .OrderBy(i => i.game.ShortName) + .OrderByDescending(i => i.Version()) + .ThenBy(i => i.Name) + .Select(i => i.Name)) + .ToList(); + comboBoxKnownInstance.Text = selectedInstanceName + ?? manager.CurrentInstance?.Name + ?? manager.AutoStartInstance + ?? ""; + } + + #region clone + + private void comboBoxKnownInstance_SelectedIndexChanged(object sender, EventArgs e) + { + string sel = comboBoxKnownInstance.SelectedItem as string; + textBoxClonePath.Text = string.IsNullOrEmpty(sel) + ? "" + : manager.Instances[sel].GameDir().Replace('/', Path.DirectorySeparatorChar); + } + + /// + /// Open an file dialog to search for a game instance, like in ManageGameInstancesDialog. + /// + private void buttonInstancePathSelection_Click(object sender, EventArgs e) + { + // Create a new FileDialog object + OpenFileDialog instanceDialog = new OpenFileDialog() + { + AddExtension = false, + CheckFileExists = false, + CheckPathExists = false, + InitialDirectory = Environment.CurrentDirectory, + Filter = ManageGameInstancesDialog.GameFolderFilter(manager), + Multiselect = false + }; + + // Show the FileDialog and let the user search for the game directory. + if (instanceDialog.ShowDialog(this) != DialogResult.OK || !File.Exists(instanceDialog.FileName)) + return; + + // Write the path to the textbox + textBoxClonePath.Text = Path.GetDirectoryName(instanceDialog.FileName); + } + + #endregion + + /// + /// User is done. Start cloning or faking, depending on the clicked radio button. + /// Close the window if everything went right. + /// + private async void buttonOK_Click(object sender, EventArgs e) + { + string existingPath = textBoxClonePath.Text; + string newName = textBoxNewName.Text; + string newPath = textBoxNewPath.Text; + + // Do some basic checks. + if (String.IsNullOrWhiteSpace(newName)) + { + user.RaiseError(Properties.Resources.CloneFakeKspDialogEnterName); + return; + } + if (String.IsNullOrWhiteSpace(newPath)) + { + user.RaiseError(Properties.Resources.CloneFakeKspDialogEnterPath); + return; + } + + // Show progress bar and deactivate controls. + progressBar.Style = ProgressBarStyle.Marquee; + progressBar.Show(); + foreach (Control ctrl in Controls) + { + ctrl.Enabled = false; + } + + user.RaiseMessage(Properties.Resources.CloneFakeKspDialogCloningInstance); + + try + { + GameInstance instanceToClone = null; + if (!manager.Instances.TryGetValue(comboBoxKnownInstance.SelectedItem as string, out instanceToClone) + || existingPath != instanceToClone.GameDir().Replace('/', Path.DirectorySeparatorChar)) + { + IGame sourceGame = manager.DetermineGame(new DirectoryInfo(existingPath), user); + if (sourceGame == null) + { + // User cancelled, let them try again + reactivateDialog(); + return; + } + instanceToClone = new GameInstance( + sourceGame, + existingPath, + "irrelevant", + user + ); + } + await Task.Run(() => + { + if (instanceToClone.Valid) + { + manager.CloneInstance(instanceToClone, newName, newPath); + } + else + { + throw new NotKSPDirKraken(instanceToClone.GameDir()); + } + }); + } + catch (InstanceNameTakenKraken) + { + user.RaiseError(Properties.Resources.CloneFakeKspDialogNameAlreadyUsed); + reactivateDialog(); + return; + } + catch (NotKSPDirKraken kraken) + { + user.RaiseError(string.Format(Properties.Resources.CloneFakeKspDialogInstanceNotValid, kraken.path.Replace('/', Path.DirectorySeparatorChar))); + reactivateDialog(); + return; + } + catch (PathErrorKraken kraken) + { + user.RaiseError(string.Format(Properties.Resources.CloneFakeKspDialogDestinationNotEmpty, kraken.path.Replace('/', Path.DirectorySeparatorChar))); + reactivateDialog(); + return; + } + catch (IOException ex) + { + user.RaiseError(string.Format(Properties.Resources.CloneFakeKspDialogCloneFailed, ex.Message)); + reactivateDialog(); + return; + } + catch (Exception ex) + { + user.RaiseError(string.Format(Properties.Resources.CloneFakeKspDialogCloneFailed, ex.Message)); + reactivateDialog(); + return; + } + + if (checkBoxSetAsDefault.Checked) + { + manager.SetAutoStart(newName); + } + + if (checkBoxSwitchInstance.Checked) + { + manager.SetCurrentInstance(newName); + } + + user.RaiseMessage(Properties.Resources.CloneFakeKspDialogSuccessfulClone); + + DialogResult = DialogResult.OK; + Close(); + } + + private void buttonCancel_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + Close(); + } + + /// + /// Activate all controls and hide progress bar. + /// + private void reactivateDialog() + { + foreach (Control ctrl in Controls) + { + ctrl.Enabled = true; + } + progressBar.Style = ProgressBarStyle.Continuous; + progressBar.Value = 0; + progressBar.Hide(); + } + + private void buttonPathBrowser_Click(object sender, EventArgs e) + { + if (folderBrowserDialogNewPath.ShowDialog(this).Equals(DialogResult.OK)) + { + textBoxNewPath.Text = folderBrowserDialogNewPath.SelectedPath; + } + + } + + /// + /// Open the user guide when the user presses F1 + /// + protected override void OnHelpRequested(HelpEventArgs evt) + { + evt.Handled = Util.TryOpenWebPage(HelpURLs.CloneFakeInstances); + } + + /// + /// Open the user guide when the user clicks the help button + /// + protected override void OnHelpButtonClicked(CancelEventArgs evt) + { + evt.Cancel = Util.TryOpenWebPage(HelpURLs.CloneFakeInstances); + } + + } +} diff --git a/GUI/Dialogs/CloneFakeGameDialog.resx b/GUI/Dialogs/CloneGameInstanceDialog.resx similarity index 90% rename from GUI/Dialogs/CloneFakeGameDialog.resx rename to GUI/Dialogs/CloneGameInstanceDialog.resx index 8d7588bfa7..98e913dfd0 100644 --- a/GUI/Dialogs/CloneFakeGameDialog.resx +++ b/GUI/Dialogs/CloneGameInstanceDialog.resx @@ -117,15 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Clone existing KSP instance Instance to clone: Path to clone: Select... - Fake new KSP instance - Version: - DLC versions (empty for none): - Making History - Breaking Ground Name for the new instance: Path for the new instance: Select... @@ -133,5 +127,5 @@ Switch to new instance Create Cancel - Clone or Fake KSP Instance + Clone Game Instance diff --git a/GUI/Dialogs/ManageGameInstancesDialog.Designer.cs b/GUI/Dialogs/ManageGameInstancesDialog.Designer.cs index 200e76101b..dae879410a 100644 --- a/GUI/Dialogs/ManageGameInstancesDialog.Designer.cs +++ b/GUI/Dialogs/ManageGameInstancesDialog.Designer.cs @@ -46,7 +46,7 @@ private void InitializeComponent() this.InstanceListContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); this.openDirectoryMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.AddToCKANMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.CloneFakeInstanceMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.CloneGameInstanceMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.RenameButton = new System.Windows.Forms.Button(); this.SetAsDefaultCheckbox = new System.Windows.Forms.CheckBox(); this.ForgetButton = new System.Windows.Forms.Button(); @@ -149,7 +149,7 @@ private void InitializeComponent() // this.AddNewMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.AddToCKANMenuItem, - this.CloneFakeInstanceMenuItem}); + this.CloneGameInstanceMenuItem}); this.AddNewMenu.Name = "AddNewMenu"; this.AddNewMenu.Size = new System.Drawing.Size(222, 48); // @@ -160,12 +160,12 @@ private void InitializeComponent() this.AddToCKANMenuItem.Click += new System.EventHandler(this.AddToCKANMenuItem_Click); resources.ApplyResources(this.AddToCKANMenuItem, "AddToCKANMenuItem"); // - // CloneFakeInstanceMenuItem + // CloneGameInstanceMenuItem // - this.CloneFakeInstanceMenuItem.Name = "CloneFakeInstanceMenuItem"; - this.CloneFakeInstanceMenuItem.Size = new System.Drawing.Size(216, 22); - this.CloneFakeInstanceMenuItem.Click += new System.EventHandler(this.CloneFakeInstanceMenuItem_Click); - resources.ApplyResources(this.CloneFakeInstanceMenuItem, "CloneFakeInstanceMenuItem"); + this.CloneGameInstanceMenuItem.Name = "CloneGameInstanceMenuItem"; + this.CloneGameInstanceMenuItem.Size = new System.Drawing.Size(216, 22); + this.CloneGameInstanceMenuItem.Click += new System.EventHandler(this.CloneGameInstanceMenuItem_Click); + resources.ApplyResources(this.CloneGameInstanceMenuItem, "CloneGameInstanceMenuItem"); // // RenameButton // @@ -246,7 +246,7 @@ private void InitializeComponent() private System.Windows.Forms.ContextMenuStrip InstanceListContextMenuStrip; private System.Windows.Forms.ToolStripMenuItem openDirectoryMenuItem; private System.Windows.Forms.ToolStripMenuItem AddToCKANMenuItem; - private System.Windows.Forms.ToolStripMenuItem CloneFakeInstanceMenuItem; + private System.Windows.Forms.ToolStripMenuItem CloneGameInstanceMenuItem; private System.Windows.Forms.Button RenameButton; private System.Windows.Forms.CheckBox SetAsDefaultCheckbox; private System.Windows.Forms.Button ForgetButton; diff --git a/GUI/Dialogs/ManageGameInstancesDialog.cs b/GUI/Dialogs/ManageGameInstancesDialog.cs index 1045106b61..ec3adb4258 100644 --- a/GUI/Dialogs/ManageGameInstancesDialog.cs +++ b/GUI/Dialogs/ManageGameInstancesDialog.cs @@ -63,8 +63,8 @@ public ManageGameInstancesDialog(bool centerScreen, IUser user) // Set the renderer for the AddNewMenu if (Platform.IsMono) { - this.AddNewMenu.Renderer = new FlatToolStripRenderer(); - this.InstanceListContextMenuStrip.Renderer = new FlatToolStripRenderer(); + AddNewMenu.Renderer = new FlatToolStripRenderer(); + InstanceListContextMenuStrip.Renderer = new FlatToolStripRenderer(); } UpdateInstancesList(); @@ -183,15 +183,15 @@ private void AddToCKANMenuItem_Click(object sender, EventArgs e) } } - private void CloneFakeInstanceMenuItem_Click(object sender, EventArgs e) + private void CloneGameInstanceMenuItem_Click(object sender, EventArgs e) { var old_instance = Main.Instance.CurrentInstance; - var result = new CloneFakeGameDialog(_manager, _user).ShowDialog(this); + var result = new CloneGameInstanceDialog(_manager, _user, (string)GameInstancesListView.SelectedItems[0].Tag).ShowDialog(this); if (result == DialogResult.OK && !Equals(old_instance, Main.Instance.CurrentInstance)) { DialogResult = DialogResult.OK; - this.Close(); + Close(); } UpdateInstancesList(); @@ -331,7 +331,7 @@ private void Forget_Click(object sender, EventArgs e) private void UpdateButtonState() { - RenameButton.Enabled = SelectButton.Enabled = SetAsDefaultCheckbox.Enabled = HasSelections; + RenameButton.Enabled = SelectButton.Enabled = SetAsDefaultCheckbox.Enabled = CloneGameInstanceMenuItem.Enabled = HasSelections; ForgetButton.Enabled = HasSelections && (string)GameInstancesListView.SelectedItems[0].Tag != _manager.CurrentInstance?.Name; } } diff --git a/GUI/Dialogs/ManageGameInstancesDialog.resx b/GUI/Dialogs/ManageGameInstancesDialog.resx index 9b2f5a3117..dce76c9b0c 100644 --- a/GUI/Dialogs/ManageGameInstancesDialog.resx +++ b/GUI/Dialogs/ManageGameInstancesDialog.resx @@ -115,7 +115,7 @@ Select New game instance Add instance to CKAN - Clone or fake new instance + Clone instance Rename Set as default Forget diff --git a/GUI/Localization/de-DE/CloneFakeGameDialog.de-DE.resx b/GUI/Localization/de-DE/CloneGameInstanceDialog.de-DE.resx similarity index 94% rename from GUI/Localization/de-DE/CloneFakeGameDialog.de-DE.resx rename to GUI/Localization/de-DE/CloneGameInstanceDialog.de-DE.resx index a9ac3bd091..abe465447e 100644 --- a/GUI/Localization/de-DE/CloneFakeGameDialog.de-DE.resx +++ b/GUI/Localization/de-DE/CloneGameInstanceDialog.de-DE.resx @@ -117,12 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Vorhandene KSP-Instanz klonen Zu klonende Instanz: Pfad zur zu klonenden Instanz: Suchen - Neue Instanz fälschen: - DLC-Versionen (leer für keinen): Name der neuen Instanz: Pfad für die neue Instanz: Suchen @@ -130,5 +127,5 @@ Zur neuen Instanz wechseln Erstellen Abbrechen - Neue KSP-Instanz + Neue Instanz diff --git a/GUI/Localization/de-DE/ManageGameInstancesDialog.de-DE.resx b/GUI/Localization/de-DE/ManageGameInstancesDialog.de-DE.resx index 7c63be0d14..3ab342cae7 100644 --- a/GUI/Localization/de-DE/ManageGameInstancesDialog.de-DE.resx +++ b/GUI/Localization/de-DE/ManageGameInstancesDialog.de-DE.resx @@ -125,7 +125,7 @@ Wählen Neue Spielinstanz Instanz hinzufügen - Instanz klonen oder fälschen + Instanz klonen Umbenennen Als Standardinstanz setzen Vergessen diff --git a/GUI/Localization/fr-FR/CloneFakeGameDialog.fr-FR.resx b/GUI/Localization/fr-FR/CloneGameInstanceDialog.fr-FR.resx similarity index 90% rename from GUI/Localization/fr-FR/CloneFakeGameDialog.fr-FR.resx rename to GUI/Localization/fr-FR/CloneGameInstanceDialog.fr-FR.resx index 2dde3cde4c..fc231b44cc 100644 --- a/GUI/Localization/fr-FR/CloneFakeGameDialog.fr-FR.resx +++ b/GUI/Localization/fr-FR/CloneGameInstanceDialog.fr-FR.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Cloner une instance existante de KSP - Instance à cloner : @@ -129,21 +126,6 @@ Parcourir - - Falsifier une nouvelle instance de KSP - - - Version : - - - Versions DLC (vide si absent) : - - - Making History - - - Breaking Ground - Nom de la nouvelle instance : @@ -166,6 +148,6 @@ Annuler - Cloner ou Falsifier une Instance KSP + Cloner une Instance diff --git a/GUI/Localization/fr-FR/ManageGameInstancesDialog.fr-FR.resx b/GUI/Localization/fr-FR/ManageGameInstancesDialog.fr-FR.resx index 29d6f8672f..2b4377a3d4 100644 --- a/GUI/Localization/fr-FR/ManageGameInstancesDialog.fr-FR.resx +++ b/GUI/Localization/fr-FR/ManageGameInstancesDialog.fr-FR.resx @@ -133,8 +133,8 @@ Ajouter une instance à CKAN - - Cloner ou falsifier une nouvelle instance + + Cloner une nouvelle instance Renommer diff --git a/GUI/Localization/it-IT/CloneFakeGameDialog.it-IT.resx b/GUI/Localization/it-IT/CloneGameInstanceDialog.it-IT.resx similarity index 90% rename from GUI/Localization/it-IT/CloneFakeGameDialog.it-IT.resx rename to GUI/Localization/it-IT/CloneGameInstanceDialog.it-IT.resx index a935350780..4cf5444a8a 100644 --- a/GUI/Localization/it-IT/CloneFakeGameDialog.it-IT.resx +++ b/GUI/Localization/it-IT/CloneGameInstanceDialog.it-IT.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Clona istanza KSP esistente - Istanza da clonare: @@ -129,21 +126,6 @@ Seleziona... - - Falsificare una nuova istanza di KSP - - - Versione: - - - Versione DLC (vuota per nessuna): - - - Making History - - - Breaking Ground - Nome per la nuova istanza: @@ -166,6 +148,6 @@ Annulla - Clonare o falsificare un'istanza di KSP + Clonare un'istanza diff --git a/GUI/Localization/ja-JP/CloneFakeGameDialog.ja-JP.resx b/GUI/Localization/ja-JP/CloneGameInstanceDialog.ja-JP.resx similarity index 91% rename from GUI/Localization/ja-JP/CloneFakeGameDialog.ja-JP.resx rename to GUI/Localization/ja-JP/CloneGameInstanceDialog.ja-JP.resx index 69ca48129d..95df2b0cd9 100644 --- a/GUI/Localization/ja-JP/CloneFakeGameDialog.ja-JP.resx +++ b/GUI/Localization/ja-JP/CloneGameInstanceDialog.ja-JP.resx @@ -117,15 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 既存のKSPインスタンスを複製する 複製するインスタンス: 複製の保存先: 選択... - 新しいKSPインスタンスを作成する - バージョン: - DLCのバージョン(ない場合は空): - Making History - Breaking Ground 新しいインスタンスの名前: 新しいインスタンスの保存先: 選択... diff --git a/GUI/Localization/ja-JP/ManageGameInstancesDialog.ja-JP.resx b/GUI/Localization/ja-JP/ManageGameInstancesDialog.ja-JP.resx index 6f0d635e8c..86991b05ef 100644 --- a/GUI/Localization/ja-JP/ManageGameInstancesDialog.ja-JP.resx +++ b/GUI/Localization/ja-JP/ManageGameInstancesDialog.ja-JP.resx @@ -114,7 +114,7 @@ 選択 新規インスタンス CKANにインスタンスを追加 - 新規インスタンスを複製または作成 + クローンインスタンス 名前変更 デフォルトに設定 除去 diff --git a/GUI/Localization/ko-KR/CloneFakeGameDialog.ko-KR.resx b/GUI/Localization/ko-KR/CloneGameInstanceDialog.ko-KR.resx similarity index 90% rename from GUI/Localization/ko-KR/CloneFakeGameDialog.ko-KR.resx rename to GUI/Localization/ko-KR/CloneGameInstanceDialog.ko-KR.resx index a1c97b50f0..f0074d0e79 100644 --- a/GUI/Localization/ko-KR/CloneFakeGameDialog.ko-KR.resx +++ b/GUI/Localization/ko-KR/CloneGameInstanceDialog.ko-KR.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 존재하는 KSP 인스턴스를 복사 - 복사할 인스턴스: @@ -129,21 +126,6 @@ 선택하기 - - 위조 KSP 인스턴스 만들기 - - - 버전: - - - DLC 버전 (비워둘 경우 없음): - - - Making History - - - Breaking Ground - 새로운 인스턴스의 이름: diff --git a/GUI/Localization/ko-KR/ManageGameInstancesDialog.ko-KR.resx b/GUI/Localization/ko-KR/ManageGameInstancesDialog.ko-KR.resx index f3e3b6dc38..d10f9683e1 100644 --- a/GUI/Localization/ko-KR/ManageGameInstancesDialog.ko-KR.resx +++ b/GUI/Localization/ko-KR/ManageGameInstancesDialog.ko-KR.resx @@ -133,8 +133,8 @@ CKAN에 인스턴스 추가 - - 인스턴스 복사 혹은 위조 + + 복제 인스턴스 이름 변경 diff --git a/GUI/Localization/pl-PL/CloneFakeGameDialog.pl-PL.resx b/GUI/Localization/pl-PL/CloneGameInstanceDialog.pl-PL.resx similarity index 90% rename from GUI/Localization/pl-PL/CloneFakeGameDialog.pl-PL.resx rename to GUI/Localization/pl-PL/CloneGameInstanceDialog.pl-PL.resx index 1a6629a24f..27b75c1828 100644 --- a/GUI/Localization/pl-PL/CloneFakeGameDialog.pl-PL.resx +++ b/GUI/Localization/pl-PL/CloneGameInstanceDialog.pl-PL.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Sklonuj istniejącą instalacje KSP - Instalacja do klonowania: @@ -129,21 +126,6 @@ Wybierz... - - Stwórz udawaną instalacje KSP - - - Wersja: - - - Wersje DLC (puste = brak DLC): - - - Making History - - - Breaking Ground - Nazwa nowej instalacji: @@ -166,6 +148,6 @@ Anuluj - Sklonuj lub utwórz udawaną instalację KSP + Sklonuj lub utwórz udawaną instalację diff --git a/GUI/Localization/pl-PL/ManageGameInstancesDialog.pl-PL.resx b/GUI/Localization/pl-PL/ManageGameInstancesDialog.pl-PL.resx index 341529f752..3342698b0c 100644 --- a/GUI/Localization/pl-PL/ManageGameInstancesDialog.pl-PL.resx +++ b/GUI/Localization/pl-PL/ManageGameInstancesDialog.pl-PL.resx @@ -133,8 +133,8 @@ Dodaj instalacje do CKAN - - Sklonuj lub utwórz udawaną instalację KSP + + Sklonuj instancję Zmień nazwę diff --git a/GUI/Localization/pt-BR/CloneFakeGameDialog.pt-BR.resx b/GUI/Localization/pt-BR/CloneGameInstanceDialog.pt-BR.resx similarity index 90% rename from GUI/Localization/pt-BR/CloneFakeGameDialog.pt-BR.resx rename to GUI/Localization/pt-BR/CloneGameInstanceDialog.pt-BR.resx index 9b658f7f00..d2615cfc21 100644 --- a/GUI/Localization/pt-BR/CloneFakeGameDialog.pt-BR.resx +++ b/GUI/Localization/pt-BR/CloneGameInstanceDialog.pt-BR.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Clonar instância existente do KSP - Instância para clonar: @@ -129,21 +126,6 @@ Selecionar... - - Falsificar nova instância do KSP - - - Versão: - - - Versões das DLC (vazio para nenhuma): - - - DLC Making History - - - DLC Breaking Ground - Nome da nova instância: @@ -166,6 +148,6 @@ Cancelar - Clonar ou Falsificar instância do KSP + Clonar instância diff --git a/GUI/Localization/pt-BR/ManageGameInstancesDialog.pt-BR.resx b/GUI/Localization/pt-BR/ManageGameInstancesDialog.pt-BR.resx index d67c782e88..db5323f0c4 100644 --- a/GUI/Localization/pt-BR/ManageGameInstancesDialog.pt-BR.resx +++ b/GUI/Localization/pt-BR/ManageGameInstancesDialog.pt-BR.resx @@ -133,8 +133,8 @@ Adicionar instância no CKAN - - Clonar ou falsificar nova instância + + Clonar instância Renomear diff --git a/GUI/Localization/ru-RU/CloneFakeGameDialog.ru-RU.resx b/GUI/Localization/ru-RU/CloneGameInstanceDialog.ru-RU.resx similarity index 90% rename from GUI/Localization/ru-RU/CloneFakeGameDialog.ru-RU.resx rename to GUI/Localization/ru-RU/CloneGameInstanceDialog.ru-RU.resx index 366dbd10f3..d477502a6e 100644 --- a/GUI/Localization/ru-RU/CloneFakeGameDialog.ru-RU.resx +++ b/GUI/Localization/ru-RU/CloneGameInstanceDialog.ru-RU.resx @@ -117,15 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Клонировать существующую сборку KSP Исходная сборка: Путь к папке сборки: Выбрать... - Создать псевдо-сборку KSP - Версия: - Версии DLC (если нужно): - Making History - Breaking Ground Название новой сборки: Путь к новой сборке: Выбрать... @@ -133,5 +127,5 @@ Переключиться на новую сборку Создать Отмена - Клонировать или имитировать сборку KSP + Клонировать сборку diff --git a/GUI/Localization/ru-RU/ManageGameInstancesDialog.ru-RU.resx b/GUI/Localization/ru-RU/ManageGameInstancesDialog.ru-RU.resx index eaf4fe66b2..9d3002e7b3 100644 --- a/GUI/Localization/ru-RU/ManageGameInstancesDialog.ru-RU.resx +++ b/GUI/Localization/ru-RU/ManageGameInstancesDialog.ru-RU.resx @@ -114,7 +114,7 @@ Выбрать Добавить Добавить папку сборки в CKAN - Клонировать или имитировать сборку + Клонировать экземпляр Переименовать По умолчанию Забыть diff --git a/GUI/Localization/zh-CN/CloneFakeGameDialog.zh-CN.resx b/GUI/Localization/zh-CN/CloneGameInstanceDialog.zh-CN.resx similarity index 91% rename from GUI/Localization/zh-CN/CloneFakeGameDialog.zh-CN.resx rename to GUI/Localization/zh-CN/CloneGameInstanceDialog.zh-CN.resx index b794bd736c..a24c40916f 100644 --- a/GUI/Localization/zh-CN/CloneFakeGameDialog.zh-CN.resx +++ b/GUI/Localization/zh-CN/CloneGameInstanceDialog.zh-CN.resx @@ -117,15 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 克隆现存的KSP实例 克隆的实例 克隆的路径 选择... - 伪装新的KSP实例 - 版本: - DLC版本(留空以忽略): - Making History - Breaking Ground 新实例名称: 新实例路径: 选择... diff --git a/GUI/Localization/zh-CN/ManageGameInstancesDialog.zh-CN.resx b/GUI/Localization/zh-CN/ManageGameInstancesDialog.zh-CN.resx index 86ca94bbf8..fa3d9c6056 100644 --- a/GUI/Localization/zh-CN/ManageGameInstancesDialog.zh-CN.resx +++ b/GUI/Localization/zh-CN/ManageGameInstancesDialog.zh-CN.resx @@ -114,7 +114,7 @@ 选择 新游戏实例 添加实例到CKAN - 克隆或伪装新实例 + 克隆实例 重命名 设为默认 忽略 diff --git a/GUI/Properties/Resources.Designer.cs b/GUI/Properties/Resources.Designer.cs index a08845ca26..5e2c779699 100644 --- a/GUI/Properties/Resources.Designer.cs +++ b/GUI/Properties/Resources.Designer.cs @@ -371,9 +371,6 @@ public class Resources { internal static string CloneFakeKspDialogInstanceNotValid { get { return (string)(ResourceManager.GetObject("CloneFakeKspDialogInstanceNotValid", resourceCulture)); } } - internal static string CloneFakeKspDialogDlcVersionMalformatted { - get { return (string)(ResourceManager.GetObject("CloneFakeKspDialogDlcVersionMalformatted", resourceCulture)); } - } internal static string CloneFakeKspDialogDestinationNotEmpty { get { return (string)(ResourceManager.GetObject("CloneFakeKspDialogDestinationNotEmpty", resourceCulture)); } } @@ -389,9 +386,6 @@ public class Resources { internal static string CloneFakeKspDialogNameAlreadyUsed { get { return (string)(ResourceManager.GetObject("CloneFakeKspDialogNameAlreadyUsed", resourceCulture)); } } - internal static string CloneFakeKspDialogFakeFailed { - get { return (string)(ResourceManager.GetObject("CloneFakeKspDialogFakeFailed", resourceCulture)); } - } internal static string CloneFakeKspDialogSuccessfulCreate { get { return (string)(ResourceManager.GetObject("CloneFakeKspDialogSuccessfulCreate", resourceCulture)); } } diff --git a/GUI/Properties/Resources.de-DE.resx b/GUI/Properties/Resources.de-DE.resx index 7fb6f736be..f795661ea6 100644 --- a/GUI/Properties/Resources.de-DE.resx +++ b/GUI/Properties/Resources.de-DE.resx @@ -115,14 +115,12 @@ Bitte gib einen Namen für die neue Instanz an. Bitte gib einen Pfad für die neue Instanz an. Klone Instanz... - Die Version für den {0} DLC ist falsch formatiert. Versuche z.B. "1.0.0". Die zu klonende Instanz ist ungültig: {0} Der Zielordner ist nicht leer: {0} Klonen fehlgeschlagen: {0} Instanz erfolgreich geklont. Erstelle neue Instanz... Dieser Name wird bereits verwendet. - Die Erstellung einer gefälschten Instanz ist fehlgeschlagen: {0} Instanz erfolgreich erstellt. Das Spiel wurde aktualisiert, seit du zuletzt deine kompatiblen Spielversionen überprüft hast. Bitte stelle sicher, dass die Einstellungen noch korrekt sind. {0} (vorherige Version: {1}) diff --git a/GUI/Properties/Resources.fr-FR.resx b/GUI/Properties/Resources.fr-FR.resx index 46b649b2a5..2c9d4611a6 100644 --- a/GUI/Properties/Resources.fr-FR.resx +++ b/GUI/Properties/Resources.fr-FR.resx @@ -212,9 +212,6 @@ "Clonage de l'instance..." - - La version pour le DLC {0} est mal formatée. Essayez "1.0.0" par exemple. - L'instance que vous voulez cloner n'est pas valide : {0} @@ -233,9 +230,6 @@ Ce nom est déjà utilisé. - - Échec de la création d'une instance artificielle : {0} - Instance créée avec succès. diff --git a/GUI/Properties/Resources.it-IT.resx b/GUI/Properties/Resources.it-IT.resx index caa94b40e6..8f97824438 100644 --- a/GUI/Properties/Resources.it-IT.resx +++ b/GUI/Properties/Resources.it-IT.resx @@ -212,9 +212,6 @@ " Clonazione dell'istanza..." - - La versione per il DLC {0} è malformattata. Prova ad esempio "1.0.0". - L'istanza che volevi clonare non è valida: {0} @@ -233,9 +230,6 @@ Questo nome è già utilizzato. - - Creazione di un'istanza fittizia fallita: {0} - Istanza creata con successo. diff --git a/GUI/Properties/Resources.ja-JP.resx b/GUI/Properties/Resources.ja-JP.resx index 26844c11ad..eefd964986 100644 --- a/GUI/Properties/Resources.ja-JP.resx +++ b/GUI/Properties/Resources.ja-JP.resx @@ -124,14 +124,12 @@ 新しいインスタンスの名前を入力してください。 新しいインスタンスの場所を入力してください。 "インスタンスを複製中..." - {0} DLCのバージョンが正しくフォーマットされていません。次のようにお試しください。例:"1.0.0" 複製しようとしているインスタンスが正常ではありません。: {0} 複製先のフォルダが空ではありません: {0} インスタンスの複製に失敗しました。: {0} インスタンスの複製に成功しました。 新規インスタンスを作成中... この名前は既に使われています。 - インスタンスの作成に失敗しました。: {0} インスタンスの作成に成功しました。 <NONE> 最新の対応するゲームバージョンを確認したため、ゲームはアップデートされました。設定が正しいか確認してください。 diff --git a/GUI/Properties/Resources.ko-KR.resx b/GUI/Properties/Resources.ko-KR.resx index a36d5b2ed2..216ab1804b 100644 --- a/GUI/Properties/Resources.ko-KR.resx +++ b/GUI/Properties/Resources.ko-KR.resx @@ -124,14 +124,12 @@ 새로운 인스턴스의 이름을 입력해주세요. 새로운 인스턴스의 경로를 입력해주세요. "인스턴스 복제 중..." - {0} DLC의 버전이 올바르지 않아요. 예를 들어 "1.0.0"를 시도해보세요. 복사할 인스턴스가 유효하지 않아요. {0} 설정한 폴더가 비어있지 않아요. {0} 복사 실패. {0} 성공적으로 인스턴스를 복사했어요. 새로운 인스턴스 생성중... 그 이름은 이미 사용 중이에요. - 인스턴스 위조 실패. {0} 성공적으로 인스턴스를 생성했어요. <NONE> 마지막으로 호환되는 버전을 검토한 뒤로 게임이 업데이트 되었어요. 설정이 정확한지 확인해주세요. diff --git a/GUI/Properties/Resources.pl-PL.resx b/GUI/Properties/Resources.pl-PL.resx index 3cdfb64bae..677ebb08b8 100644 --- a/GUI/Properties/Resources.pl-PL.resx +++ b/GUI/Properties/Resources.pl-PL.resx @@ -212,9 +212,6 @@ "Klonowanie instalacji..." - - Wersja dla DLC {0} jest nieprawidłowa. Spróbuj na przykład "1.0.0". - Instalacja, którą chcesz sklonować jest nieprawidłowa: {0} @@ -233,9 +230,6 @@ Ta nazwa jest już w użyciu. - - Nie udało się utworzyć udawanej instalacji: {0} - Pomyślnie utworzono instalacje. diff --git a/GUI/Properties/Resources.pt-BR.resx b/GUI/Properties/Resources.pt-BR.resx index 2c24e7a972..c1bdcc73c4 100644 --- a/GUI/Properties/Resources.pt-BR.resx +++ b/GUI/Properties/Resources.pt-BR.resx @@ -122,14 +122,12 @@ Por favor informe o nome da nova instância. Por favor informe o caminho da nova instância. "Clonando instância..." - A versão para a DLC {0} está malformatada. Tente "1.0.0" como exemplo. A instância que você queria clonar não é válida: {0} O diretório de destino não está vazio: {0} A clonagem falhou: {0} Instância clonada com sucesso. Criando nova instância... Este nome já está sendo usado. - A criação da instância falsificada falhou: {0} Instância criada com sucesso. <NONE> O jogo foi atualizado desde que você revisou as versões compatíveis do jogo. Por favor, garanta que estas configurações estejam corretas. diff --git a/GUI/Properties/Resources.resx b/GUI/Properties/Resources.resx index 7eb696222b..cd7daed8d8 100644 --- a/GUI/Properties/Resources.resx +++ b/GUI/Properties/Resources.resx @@ -154,14 +154,12 @@ Please enter a name for the new instance. Please enter a path for the new instance. "Cloning instance..." - The version for the {0} DLC is malformatted. Try "1.0.0" for example. The instance you wanted to clone is not valid: {0} The destination folder is not empty: {0} Clone failed: {0} Successfully cloned instance. Creating new instance... This name is already used. - Fake instance creation failed: {0} Successfully created instance. <NONE> The game has been updated since you last reviewed your compatible game versions. Please make sure that settings are correct. diff --git a/GUI/Properties/Resources.ru-RU.resx b/GUI/Properties/Resources.ru-RU.resx index 115cf1646b..9aea5e4bf6 100644 --- a/GUI/Properties/Resources.ru-RU.resx +++ b/GUI/Properties/Resources.ru-RU.resx @@ -122,14 +122,12 @@ Введите название новой сборки. Введите путь к папке новой сборки. «Клонирование...» - Неверный формат версии DLC {0}. Пример оформления версии: «1.0.0». Сборка, которую вы пытаетесь клонировать, не является пригодной сборкой игры: {0} Конечная папка не пуста: {0} Клонирование не удалось: {0} Клонирование успешно завершено. Создание новой сборки... Это название уже используется. - Не удалось создать псевдо-сборку: {0} Создание успешно завершено. <НЕТ> Игра была обновлена с последнего изменения данных настроек. Убедитесь в их правильности. diff --git a/GUI/Properties/Resources.zh-CN.resx b/GUI/Properties/Resources.zh-CN.resx index 105e8d3f5d..19b9a04726 100644 --- a/GUI/Properties/Resources.zh-CN.resx +++ b/GUI/Properties/Resources.zh-CN.resx @@ -124,14 +124,12 @@ 请输入新实例名称. 请输入新实例路径. "正在克隆实例..." - {0} DLC版本格式错误. 尝试例如 "1.0.0". 您想要克隆的实例不可用: {0} 目标文件夹并非空文件夹: {0} 克隆失败: {0} 成功克隆实例. 正在创建新实例... 该名称已被占用. - 伪装实例创建失败: {0} 成功创建实例. <NONE> 游戏已经在您上次确认您的兼容游戏版本后更新. 请确认设置是否正确. diff --git a/Tests/GUI/ResourcesTests.cs b/Tests/GUI/ResourcesTests.cs index 6c554f291a..b37c476484 100644 --- a/Tests/GUI/ResourcesTests.cs +++ b/Tests/GUI/ResourcesTests.cs @@ -56,7 +56,7 @@ public void PropertiesResources_LanguageResource_NotSet() TestCase(typeof(CKAN.GUI.Main)), TestCase(typeof(CKAN.GUI.AboutDialog)), TestCase(typeof(CKAN.GUI.AskUserForAutoUpdatesDialog)), - TestCase(typeof(CKAN.GUI.CloneFakeGameDialog)), + TestCase(typeof(CKAN.GUI.CloneGameInstanceDialog)), TestCase(typeof(CKAN.GUI.CompatibleGameVersionsDialog)), TestCase(typeof(CKAN.GUI.EditLabelsDialog)), TestCase(typeof(CKAN.GUI.ErrorDialog)),