From 39c492a7590c0d5fd37a4a9b1d45db0c1d1f9aed Mon Sep 17 00:00:00 2001 From: coldino Date: Fri, 2 Nov 2018 18:53:15 +0000 Subject: [PATCH] Launch updater when update is found (#799) Still required user confirmation, as before. --- ARKBreedingStats/Form1.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ARKBreedingStats/Form1.cs b/ARKBreedingStats/Form1.cs index 0ec40243..e72335db 100644 --- a/ARKBreedingStats/Form1.cs +++ b/ARKBreedingStats/Form1.cs @@ -2206,9 +2206,21 @@ private void checkForUpdates(bool silentCheck = false) if (localVersion.CompareTo(remoteVersion) < 0) { - if (MessageBox.Show("A new version of ARK Smart Breeding is available.\nYou have " + localVersion.ToString() + ", available is " + remoteVersion.ToString() + ".\n\nDo you want to visit the homepage to check it out?", "New version available", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) + if (MessageBox.Show($"A new version of ARK Smart Breeding is available.\nYou have {localVersion}, available is {remoteVersion}." + + "\n\nDo you want to download and install the update now?", "New version available", + MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { - System.Diagnostics.Process.Start("https://github.com/cadon/ARKStatsExtractor/releases/latest"); + // Ensure there are no unsaved changes + if (collectionDirty) + { + MessageBox.Show("Your Creature Collection has been modified since it was last saved. Please either save or discard your changes to proceed with the update.", + "Unsaved Changes", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + + // Launch the updater and exit the app + Process.Start(Path.Combine(Directory.GetCurrentDirectory(), "asb-updater.exe")); + Close(); return; } newToolVersionAvailable = true;