11using Rampastring . Tools ;
22using System ;
3+ using System . IO ;
34using System . Threading . Tasks ;
45
56namespace TSMapEditor . Settings
@@ -17,7 +18,16 @@ public UserSettings()
1718
1819 Instance = this ;
1920
20- UserSettingsIni = new IniFile ( Environment . CurrentDirectory + "/MapEditorSettings.ini" ) ;
21+ string path = Path . Combine ( Environment . CurrentDirectory , "MapEditorSettings.ini" ) ;
22+ if ( File . Exists ( path ) )
23+ {
24+ UserSettingsIni = new IniFile ( path ) ;
25+ }
26+ else
27+ {
28+ UserSettingsIni = new IniFile ( Path . Combine ( Environment . CurrentDirectory , "Config" , "DefaultSettings.ini" ) ) ;
29+ UserSettingsIni . FileName = path ;
30+ }
2131
2232 settings = new IINILoadable [ ]
2333 {
@@ -40,6 +50,7 @@ public UserSettings()
4050 SidebarWidth ,
4151
4252 MultithreadedTextureLoading ,
53+ LogFileLoading ,
4354
4455 GameDirectory ,
4556 LastScenarioPath ,
@@ -78,30 +89,31 @@ public async Task SaveSettingsAsync()
7889
7990 private readonly IINILoadable [ ] settings ;
8091
81- public IntSetting TargetFPS = new IntSetting ( Display , " TargetFPS" , 240 ) ;
92+ public IntSetting TargetFPS = new IntSetting ( Display , nameof ( TargetFPS ) , 240 ) ;
8293 public IntSetting GraphicsLevel = new IntSetting ( Display , nameof ( GraphicsLevel ) , 1 ) ;
83- public IntSetting ResolutionWidth = new IntSetting ( Display , " ResolutionWidth" , - 1 ) ;
84- public IntSetting ResolutionHeight = new IntSetting ( Display , " ResolutionHeight" , - 1 ) ;
85- public DoubleSetting RenderScale = new DoubleSetting ( Display , " RenderScale" , 1.0 ) ;
86- public BoolSetting Borderless = new BoolSetting ( Display , " Borderless" , false ) ;
87- public BoolSetting FullscreenWindowed = new BoolSetting ( Display , " FullscreenWindowed" , false ) ;
88- public BoolSetting ConserveVRAM = new BoolSetting ( Display , " ConserveVRAM" , false ) ;
94+ public IntSetting ResolutionWidth = new IntSetting ( Display , nameof ( ResolutionWidth ) , - 1 ) ;
95+ public IntSetting ResolutionHeight = new IntSetting ( Display , nameof ( ResolutionHeight ) , - 1 ) ;
96+ public DoubleSetting RenderScale = new DoubleSetting ( Display , nameof ( RenderScale ) , 1.0 ) ;
97+ public BoolSetting Borderless = new BoolSetting ( Display , nameof ( Borderless ) , false ) ;
98+ public BoolSetting FullscreenWindowed = new BoolSetting ( Display , nameof ( FullscreenWindowed ) , false ) ;
99+ public BoolSetting ConserveVRAM = new BoolSetting ( Display , nameof ( ConserveVRAM ) , false ) ;
89100
90101 public IntSetting ScrollRate = new IntSetting ( MapView , nameof ( ScrollRate ) , 15 ) ;
91- public IntSetting MapWideOverlayOpacity = new IntSetting ( MapView , " MapWideOverlayOpacity" , 50 ) ;
102+ public IntSetting MapWideOverlayOpacity = new IntSetting ( MapView , nameof ( MapWideOverlayOpacity ) , 50 ) ;
92103
93- public StringSetting Theme = new StringSetting ( General , " Theme" , "Default" ) ;
94- public BoolSetting UseBoldFont = new BoolSetting ( General , " UseBoldFont" , false ) ;
95- public BoolSetting SmartScriptActionCloning = new BoolSetting ( General , " SmartScriptActionCloning" , true ) ;
96- public IntSetting AutoSaveInterval = new IntSetting ( General , " AutoSaveInterval" , 300 ) ;
97- public IntSetting SidebarWidth = new IntSetting ( General , " SidebarWidth" , 350 ) ;
104+ public StringSetting Theme = new StringSetting ( General , nameof ( Theme ) , "Default" ) ;
105+ public BoolSetting UseBoldFont = new BoolSetting ( General , nameof ( UseBoldFont ) , false ) ;
106+ public BoolSetting SmartScriptActionCloning = new BoolSetting ( General , nameof ( SmartScriptActionCloning ) , true ) ;
107+ public IntSetting AutoSaveInterval = new IntSetting ( General , nameof ( AutoSaveInterval ) , 300 ) ;
108+ public IntSetting SidebarWidth = new IntSetting ( General , nameof ( SidebarWidth ) , 350 ) ;
98109
99- public BoolSetting MultithreadedTextureLoading = new BoolSetting ( General , "MultithreadedTextureLoading" , true ) ;
110+ public BoolSetting MultithreadedTextureLoading = new BoolSetting ( General , nameof ( MultithreadedTextureLoading ) , true ) ;
111+ public BoolSetting LogFileLoading = new BoolSetting ( General , nameof ( LogFileLoading ) , false ) ;
100112
101- public StringSetting GameDirectory = new StringSetting ( General , " GameDirectory" , string . Empty ) ;
113+ public StringSetting GameDirectory = new StringSetting ( General , nameof ( GameDirectory ) , string . Empty ) ;
102114 public StringSetting LastScenarioPath = new StringSetting ( General , nameof ( LastScenarioPath ) , "Maps/Custom/" ) ;
103115
104- public StringSetting TextEditorPath = new StringSetting ( General , " TextEditorPath" , string . Empty ) ;
116+ public StringSetting TextEditorPath = new StringSetting ( General , nameof ( TextEditorPath ) , string . Empty ) ;
105117
106118 public StringSetting Language = new StringSetting ( General , nameof ( Language ) , string . Empty ) ;
107119
0 commit comments