Fix configs after the big refactor
This commit is contained in:
parent
bba0e96007
commit
1c8893c197
@ -32,36 +32,6 @@ namespace lib
|
|||||||
public interface ConfigBase
|
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<ConfigCfg>( filename );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#region SaveLoad
|
#region SaveLoad
|
||||||
|
|
||||||
static public T res_load<T>( string filename ) where T : Config
|
static public T res_load<T>( string filename ) where T : Config
|
||||||
@ -130,7 +100,7 @@ namespace lib
|
|||||||
|
|
||||||
//cfg.SetFilename( filename );
|
//cfg.SetFilename( filename );
|
||||||
|
|
||||||
if( s_cfg.writeOutTemplateFiles )
|
if( ConfigCfg.s_cfg.writeOutTemplateFiles )
|
||||||
{
|
{
|
||||||
var templateFile = $"templates/{filename}";
|
var templateFile = $"templates/{filename}";
|
||||||
|
|
||||||
@ -148,7 +118,7 @@ namespace lib
|
|||||||
|
|
||||||
static public void save( Config cfg )
|
static public void save( Config cfg )
|
||||||
{
|
{
|
||||||
save( cfg, cfg._filename );
|
save( cfg, cfg.Filename );
|
||||||
}
|
}
|
||||||
|
|
||||||
static public void save( Config cfg, String filename )
|
static public void save( Config cfg, String filename )
|
||||||
@ -163,7 +133,45 @@ namespace lib
|
|||||||
}
|
}
|
||||||
#endregion
|
#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<ConfigCfg>( filename );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Config()
|
public Config()
|
||||||
{
|
{
|
||||||
@ -174,9 +182,13 @@ namespace lib
|
|||||||
_filename = filename;
|
_filename = filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string _filename = "{unknown}";
|
||||||
|
|
||||||
|
|
||||||
public String Filename { get { return _filename; } }
|
public String Filename { get { return _filename; } }
|
||||||
|
|
||||||
protected void SetFilename( String filename ) { _filename = filename; }
|
internal void SetFilename( String filename ) { _filename = filename; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user