Skip to content

Commit

Permalink
Don't prompt user if we already know the game
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Dec 30, 2021
1 parent a6e0bec commit 90be65d
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions GUI/Dialogs/CloneFakeGameDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 90be65d

Please sign in to comment.