From 44347836b4338b0351161191eb18ed44fcdd1c88 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Sun, 24 Sep 2017 09:48:29 -0400 Subject: [PATCH] Fixes installer not calling PrepareForUpdate on versions < 3.1 --- TGInstallerWrapper/Main.cs | 39 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/TGInstallerWrapper/Main.cs b/TGInstallerWrapper/Main.cs index 62b52e94a7..2ad47e5411 100644 --- a/TGInstallerWrapper/Main.cs +++ b/TGInstallerWrapper/Main.cs @@ -21,15 +21,16 @@ namespace TGInstallerWrapper InitializeComponent(); FormClosing += Main_FormClosing; PathTextBox.Text = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + Path.DirectorySeparatorChar + InstallDir; - if (Server.VerifyConnection() == null) - try - { - VersionLabel.Text = Server.GetComponent().Version(); - } - catch - { + var verifiedConnection = Server.VerifyConnection() == null; + try + { + VersionLabel.Text = Server.GetComponent().Version(); + } + catch + { + if(verifiedConnection) VersionLabel.Text = "< v3.0.85.0 (Missing ITGService.Version())"; - } + } TargetVersionLabel.Text += " v" + FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion; } @@ -110,17 +111,17 @@ namespace TGInstallerWrapper ProgressBar.Style = ProgressBarStyle.Marquee; - if (Server.VerifyConnection() == null) - try - { - Server.GetComponent().PrepareForUpdate(); - Thread.Sleep(3000); //chat messages - } - catch - { - if (MessageBox.Show("ITGSService.PrepareForUpdate() threw an exception! Existing DreamDaemon instances will be terminated. Continue?", "Warning", MessageBoxButtons.YesNo) != DialogResult.Yes) - return; - } + var connectionVerified = Server.VerifyConnection() == null; + try + { + Server.GetComponent().PrepareForUpdate(); + Thread.Sleep(3000); //chat messages + } + catch + { + if (connectionVerified && MessageBox.Show("ITGSService.PrepareForUpdate() threw an exception! Existing DreamDaemon instances will be terminated. Continue?", "Warning", MessageBoxButtons.YesNo) != DialogResult.Yes) + return; + } InstallCancelButton.Enabled = true;