From 90be65d73e83c9a6d8ece87dc9fa1c1ec9fc970f Mon Sep 17 00:00:00 2001 From: Paul Hebble Date: Thu, 30 Dec 2021 00:01:08 +0000 Subject: [PATCH] Don't prompt user if we already know the game --- GUI/Dialogs/CloneFakeGameDialog.cs | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/GUI/Dialogs/CloneFakeGameDialog.cs b/GUI/Dialogs/CloneFakeGameDialog.cs index e6bf3006cf..6ac1e00140 100644 --- a/GUI/Dialogs/CloneFakeGameDialog.cs +++ b/GUI/Dialogs/CloneFakeGameDialog.cs @@ -145,22 +145,26 @@ private async void buttonOK_Click(object sender, EventArgs e) try { - IGame guessedGame = manager.DetermineGame(new DirectoryInfo(existingPath), user); - if (guessedGame == null) + GameInstance instanceToClone = null; + if (!manager.Instances.TryGetValue(comboBoxKnownInstance.SelectedItem as string, out instanceToClone) + || existingPath != instanceToClone.GameDir().Replace('/', Path.DirectorySeparatorChar)) { - // User cancelled, let them try again - reactivateDialog(); - return; - } - await Task.Run(() => - { - GameInstance instanceToClone = new GameInstance( - guessedGame, + 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);