@@ -11,41 +11,51 @@ namespace ERPLoader
1111{
1212 class Program
1313 {
14- public static Settings EasyModSettings { get ; private set ; } = new ( ) ;
14+ public static Settings EasyModSettings { get ; private set ; }
1515 public static string ModsFolderPath { get ; private set ; }
1616
1717 private static readonly List < ModModel > ModsList = new ( ) ;
1818
1919 static void Main ( string [ ] args )
2020 {
21- Cleanup ( ) ;
22- PrintIntro ( ) ;
2321 InitSettings ( ) ;
22+
23+ PrintIntro ( ) ;
24+ Cleanup ( ) ;
2425 LoadMods ( ) ;
2526 StartMods ( ) ;
2627
27- var gameProcess = StartGame ( ) ;
28-
29- if ( gameProcess != null )
28+ if ( EasyModSettings . LaunchGame )
3029 {
31- Logger . Log ( "Waiting for game exit..." ) ;
32- Logger . Warning ( "Do not close this window if you want me to cleanup after you finish playing!" ) ;
30+ var gameProcess = StartGame ( ) ;
3331
34- gameProcess . WaitForExit ( ) ;
32+ if ( gameProcess != null )
33+ {
34+ Logger . Log ( "Waiting for game exit..." ) ;
35+ Logger . Warning ( "Do not close this window if you want me to cleanup after you finish playing!" ) ;
3536
36- Logger . Log ( "Game exited! Start restoring files...\n " ) ;
37- Cleanup ( ) ;
37+ gameProcess . WaitForExit ( ) ;
3838
39- Logger . Log ( "Done! Thanks for using EasyERPMod :D" ) ;
40- System . Threading . Thread . Sleep ( 3000 ) ;
39+ Logger . Log ( "Game exited! Start restoring files...\n " ) ;
40+ Cleanup ( ) ;
41+ }
4142 }
43+
44+ Logger . Log ( "Done! Thanks for using EasyERPMod :D" ) ;
45+ System . Threading . Thread . Sleep ( 3000 ) ;
4246 }
4347
4448 private static void PrintIntro ( )
4549 {
46- Console . WriteLine ( "[ ]----------------------[ ]" ) ;
47- Console . WriteLine ( "[ ] EasyERPMod by Maxhyt [ ]" ) ;
48- Console . WriteLine ( "[ ]----------------------[ ]" ) ;
50+ var version = System . Reflection . Assembly . GetEntryAssembly ( ) . GetName ( ) . Version . ToString ( 2 ) ;
51+ var versionStrLen = $ "v{ version } ". Length ;
52+
53+ Console . Title = "EasyERPMod v" + version ;
54+
55+ Console . Write ( "[ ]----------------------" + "-" . Multiply ( versionStrLen ) + "[ ]" ) ;
56+ Console . WriteLine ( $ "[ ] EasyERPMod by Maxhyt v{ version } [ ]") ;
57+ Console . Write ( "[ ]----------------------" + "-" . Multiply ( versionStrLen ) + "[ ]" ) ;
58+
4959 Console . WriteLine ( @"
5060 -_______----.._pBQ;
5161 ,^~|?|v^` .!|JWRd9NRNND00R0dJ1lllt
@@ -68,6 +78,11 @@ private static void InitSettings()
6878 {
6979 EasyModSettings = JsonSerializer . Deserialize < Settings > ( File . ReadAllText ( settingsFile ) ) ;
7080 }
81+ else
82+ {
83+ EasyModSettings = new ( ) ;
84+ Logger . Warning ( $ "A new { settingsFile } file has been created, please update your F1 game path in the file.") ;
85+ }
7186
7287 File . WriteAllText ( settingsFile , JsonSerializer . Serialize ( EasyModSettings , new JsonSerializerOptions ( ) { WriteIndented = true } ) ) ;
7388 }
@@ -97,10 +112,7 @@ private static void LoadMods()
97112
98113 private static void StartMods ( )
99114 {
100- foreach ( var mod in ModsList )
101- {
102- mod . Process ( ) ;
103- }
115+ ModsList . ForEach ( mod => mod . Process ( ) ) ;
104116 }
105117
106118 private static Process StartGame ( )
@@ -131,6 +143,7 @@ private static Process StartGame()
131143 }
132144
133145 Logger . Log ( "Cannot find game's window" ) ;
146+ break ;
134147 }
135148 }
136149
0 commit comments