File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 11using System . Reflection ;
2+ using System . Text . Json ;
23using BepInEx ;
34using BepInEx . Configuration ;
45using BepInEx . Logging ;
@@ -10,17 +11,33 @@ namespace PolyMod
1011 [ BepInPlugin ( "com.polymod" , "PolyMod" , VERSION ) ]
1112 public class Plugin : BepInEx . Unity . IL2CPP . BasePlugin
1213 {
14+ internal record PolyConfig (
15+ bool debug = false
16+ ) ;
17+
1318 internal const string VERSION = "0.0.0" ;
1419 internal const int AUTOIDX_STARTS_FROM = 1000 ;
1520 internal static readonly string BASE_PATH = Path . Combine ( BepInEx . Paths . BepInExRootPath , ".." ) ;
1621 internal static readonly string MODS_PATH = Path . Combine ( BASE_PATH , "Mods" ) ;
22+ internal static readonly string CONFIG_PATH = Path . Combine ( BASE_PATH , "PolyMod.json" ) ;
1723
1824#pragma warning disable CS8618
25+ internal static PolyConfig config ;
1926 internal static ManualLogSource logger ;
2027#pragma warning restore CS8618
2128
2229 public override void Load ( )
2330 {
31+ try
32+ {
33+ config = JsonSerializer . Deserialize < PolyConfig > ( File . ReadAllText ( CONFIG_PATH ) ) ! ;
34+ }
35+ catch
36+ {
37+ config = new ( ) ;
38+ File . WriteAllText ( CONFIG_PATH , JsonSerializer . Serialize ( config ) ) ;
39+ }
40+
2441 logger = Log ;
2542 ConfigFile . CoreConfig [ new ( "Logging.Disk" , "WriteUnityLog" ) ] . BoxedValue = true ;
2643 AudioClipLoader . Init ( ) ;
You can’t perform that action at this time.
0 commit comments