From 1c8893c19726663f38ab8b2f55165098b5e63090 Mon Sep 17 00:00:00 2001 From: Marc Hernandez Date: Tue, 19 Aug 2025 21:57:20 -0700 Subject: [PATCH] Fix configs after the big refactor --- cfg/Config.cs | 80 +++++++++++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 34 deletions(-) diff --git a/cfg/Config.cs b/cfg/Config.cs index 7ca7fdc..30117c5 100644 --- a/cfg/Config.cs +++ b/cfg/Config.cs @@ -32,36 +32,6 @@ namespace lib public interface ConfigBase { - } - - public record class ConfigRec : ConfigBase - { - - } - - public class Config : ConfigBase - { - - //private int _test = 0; - - private static lib.XmlFormatter2Cfg s_templateCfg = new() { - datastructure = Datastructure.Tree, - POD = POD.Elements, - }; - - - private static ConfigCfg s_cfg = new(); - - static public void startup( string filename ) - { - res.Mgr.Register( load ); - res.Mgr.RegisterSub( typeof( ConfigBase ) ); - - s_cfg = load( filename ); - - } - - #region SaveLoad static public T res_load( string filename ) where T : Config @@ -130,7 +100,7 @@ namespace lib //cfg.SetFilename( filename ); - if( s_cfg.writeOutTemplateFiles ) + if( ConfigCfg.s_cfg.writeOutTemplateFiles ) { var templateFile = $"templates/{filename}"; @@ -148,7 +118,7 @@ namespace lib static public void save( Config cfg ) { - save( cfg, cfg._filename ); + save( cfg, cfg.Filename ); } static public void save( Config cfg, String filename ) @@ -163,7 +133,45 @@ namespace lib } #endregion - private string _filename = "{unknown}"; + + public String Filename { get; } + + //internal void SetFilename( String filename ); + + + } + + /* UNUSED + public record class ConfigRec : ConfigBase + { + + } + */ + + public class Config : ConfigBase + { + + //private int _test = 0; + + private static lib.XmlFormatter2Cfg s_templateCfg = new() + { + datastructure = Datastructure.Tree, + POD = POD.Elements, + }; + + + internal static ConfigCfg s_cfg = new(); + + static public void startup( string filename ) + { + res.Mgr.Register( ConfigBase.load ); + res.Mgr.RegisterSub( typeof( ConfigBase ) ); + + s_cfg = ConfigBase.load( filename ); + + } + + public Config() { @@ -174,9 +182,13 @@ namespace lib _filename = filename; } + private string _filename = "{unknown}"; + + public String Filename { get { return _filename; } } - protected void SetFilename( String filename ) { _filename = filename; } + internal void SetFilename( String filename ) { _filename = filename; } + } }