@@ -40,7 +40,7 @@ namespace Sonic_06_Mod_Manager
4040{
4141 public partial class ModManager : Form
4242 {
43- public static string versionNumber = "Version 1.04 " ;
43+ public static string versionNumber = "Version 1.05 " ;
4444 public static string updateState ;
4545 public static string serverStatus ;
4646 public static string installState ;
@@ -88,24 +88,29 @@ public static void CheckForUpdates(string currentVersion, string newVersionDownl
8888 switch ( confirmUpdate )
8989 {
9090 case DialogResult . Yes :
91- try
91+ var exists = System . Diagnostics . Process . GetProcessesByName ( System . IO . Path . GetFileNameWithoutExtension ( System . Reflection . Assembly . GetEntryAssembly ( ) . Location ) ) . Count ( ) > 1 ;
92+ if ( exists ) { MessageBox . Show ( "Please close any other instances of Sonic '06 Mod Manager and try again." , "Stupid Error" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ; }
93+ else
9294 {
93- if ( File . Exists ( Application . ExecutablePath ) )
95+ try
9496 {
95- var clientApplication = new WebClient ( ) ;
96- clientApplication . DownloadFileAsync ( new Uri ( newVersionDownloadLink ) , Application . ExecutablePath + ".pak" ) ;
97- clientApplication . DownloadFileCompleted += ( s , e ) =>
97+ if ( File . Exists ( Application . ExecutablePath ) )
9898 {
99- File . Replace ( Application . ExecutablePath + ".pak" , Application . ExecutablePath , Application . ExecutablePath + ".bak" ) ;
100- Process . Start ( Application . ExecutablePath ) ;
101- Application . Exit ( ) ;
102- } ;
99+ var clientApplication = new WebClient ( ) ;
100+ clientApplication . DownloadFileAsync ( new Uri ( newVersionDownloadLink ) , Application . ExecutablePath + ".pak" ) ;
101+ clientApplication . DownloadFileCompleted += ( s , e ) =>
102+ {
103+ File . Replace ( Application . ExecutablePath + ".pak" , Application . ExecutablePath , Application . ExecutablePath + ".bak" ) ;
104+ Process . Start ( Application . ExecutablePath ) ;
105+ Application . Exit ( ) ;
106+ } ;
107+ }
108+ else { MessageBox . Show ( "Sonic '06 Mod Manager doesn't exist... What?!" , "Stupid Error" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ; }
109+ }
110+ catch
111+ {
112+ MessageBox . Show ( "An error occurred when updating Sonic '06 Mod Manager." , "Fatal Error" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
103113 }
104- else { MessageBox . Show ( "Sonic '06 Mod Manager doesn't exist... What?!" , "Stupid Error" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ; }
105- }
106- catch
107- {
108- MessageBox . Show ( "An error occurred when updating Sonic '06 Mod Manager." , "Fatal Error" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
109114 }
110115 break ;
111116 }
0 commit comments