2023-10-08 00:10:21 +00:00
using System ;
2023-10-08 00:25:08 +00:00
using System.IO ;
2023-10-08 00:10:21 +00:00
using System.Reflection ;
using System.Windows.Forms ;
namespace SoFii {
public static class Program {
public static readonly Assembly CurrentAssembly = Assembly . GetExecutingAssembly ( ) ;
public static readonly AssemblyName CurrentAssemblyName = CurrentAssembly . GetName ( ) ;
[STAThread]
public static void Main ( ) {
Application . EnableVisualStyles ( ) ;
Application . SetCompatibleTextRenderingDefault ( false ) ;
int version = GetSemVerInt ( ) ;
int lastVersion = Settings . LastVersion ;
if ( version < lastVersion ) {
DialogResult result = MessageBox . Show ( "You're opening an older version of SoFii after already having used a newer version.\r\nThis could corrupt your settings. Are you sure you want to continue?" , "SoFii :: Old version warning" , MessageBoxButtons . YesNo ) ;
if ( result ! = DialogResult . Yes )
return ;
Settings . LastVersion = version ;
} else if ( version > lastVersion )
Settings . LastVersion = version ;
2023-10-08 00:25:08 +00:00
if ( ! File . Exists ( Settings . GamePath ) & & File . Exists ( Constants . MP_EXE ) )
Settings . GamePath = Path . GetFullPath ( Constants . MP_EXE ) ;
2023-10-08 00:10:21 +00:00
Application . Run ( new MainWindow ( ) ) ;
}
public static string GetSemVerString ( ) {
Version version = CurrentAssemblyName . Version ;
return $"{version.Major}.{version.Minor}.{version.Build}" ;
}
public static int GetSemVerInt ( ) {
Version version = CurrentAssemblyName . Version ;
return ( version . Major < < 20 ) | ( version . Minor < < 10 ) | version . Build ;
}
}
}