mirror of
https://github.com/cyanfish/naps2.git
synced 2024-11-11 02:45:19 +03:00
Add factory methods for UserConfig and AppConfig
This commit is contained in:
parent
e3a7d16002
commit
646edc205a
@ -17,8 +17,8 @@ namespace NAPS2.DI
|
||||
Log.EventLogger = new WindowsEventLogger();
|
||||
}
|
||||
|
||||
UserConfig.Manager = new ConfigManager<UserConfig>("config.xml", Paths.AppData, Paths.Executable, () => new UserConfig { Version = UserConfig.CURRENT_VERSION });
|
||||
AppConfig.Manager = new ConfigManager<AppConfig>("appsettings.xml", Paths.Executable, null, () => new AppConfig { Version = AppConfig.CURRENT_VERSION });
|
||||
UserConfig.Manager = new ConfigManager<UserConfig>("config.xml", Paths.AppData, Paths.Executable, UserConfig.Create);
|
||||
AppConfig.Manager = new ConfigManager<AppConfig>("appsettings.xml", Paths.Executable, null, AppConfig.Create);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace NAPS2.Config
|
||||
{
|
||||
public const int CURRENT_VERSION = 2;
|
||||
|
||||
private static IConfigManager<AppConfig> _manager = new StubConfigManager<AppConfig>(new AppConfig { Version = CURRENT_VERSION });
|
||||
private static IConfigManager<AppConfig> _manager = new StubConfigManager<AppConfig>(Create());
|
||||
|
||||
public static IConfigManager<AppConfig> Manager
|
||||
{
|
||||
@ -23,6 +23,8 @@ namespace NAPS2.Config
|
||||
|
||||
public static AppConfig Current => Manager.Config;
|
||||
|
||||
public static AppConfig Create() => new AppConfig { Version = CURRENT_VERSION };
|
||||
|
||||
public int Version { get; set; }
|
||||
|
||||
public string DefaultCulture { get; set; }
|
||||
|
@ -16,7 +16,7 @@ namespace NAPS2.Config
|
||||
{
|
||||
public const int CURRENT_VERSION = 2;
|
||||
|
||||
private static IConfigManager<UserConfig> _manager = new StubConfigManager<UserConfig>(new UserConfig { Version = CURRENT_VERSION });
|
||||
private static IConfigManager<UserConfig> _manager = new StubConfigManager<UserConfig>(Create());
|
||||
|
||||
public static IConfigManager<UserConfig> Manager
|
||||
{
|
||||
@ -26,6 +26,8 @@ namespace NAPS2.Config
|
||||
|
||||
public static UserConfig Current => Manager.Config;
|
||||
|
||||
public static UserConfig Create() => new UserConfig { Version = CURRENT_VERSION };
|
||||
|
||||
public int Version { get; set; }
|
||||
|
||||
public string Culture { get; set; }
|
||||
|
Loading…
Reference in New Issue
Block a user