feat: load legacy Cuts and Res runtime assets
This commit is contained in:
@@ -30,6 +30,43 @@ public sealed class DatabaseRuntime
|
||||
return Create(options);
|
||||
}
|
||||
|
||||
public static DatabaseRuntime CreateLegacyExecutableDefault(
|
||||
string baseDirectory,
|
||||
string? fallbackConfigurationPath = null,
|
||||
string? legacyOverridePath = null)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(baseDirectory);
|
||||
var legacyIniPath = Path.Combine(
|
||||
Path.GetFullPath(baseDirectory),
|
||||
"Res",
|
||||
"MmoneyCoder.ini");
|
||||
if (File.Exists(legacyIniPath))
|
||||
{
|
||||
return Create(new LegacyIniDatabaseOptionsLoader().Load(legacyIniPath));
|
||||
}
|
||||
|
||||
var localOverride = legacyOverridePath ?? ResolveLegacyOverridePath();
|
||||
if (!string.IsNullOrWhiteSpace(localOverride) && File.Exists(localOverride))
|
||||
{
|
||||
return Create(new LegacyIniDatabaseOptionsLoader().Load(localOverride));
|
||||
}
|
||||
|
||||
return CreateDefault(fallbackConfigurationPath);
|
||||
}
|
||||
|
||||
private static string? ResolveLegacyOverridePath()
|
||||
{
|
||||
var localAppData = Environment.GetFolderPath(
|
||||
Environment.SpecialFolder.LocalApplicationData);
|
||||
return string.IsNullOrWhiteSpace(localAppData)
|
||||
? null
|
||||
: Path.Combine(
|
||||
localAppData,
|
||||
"MBN_STOCK_WEBVIEW",
|
||||
"Res",
|
||||
"MmoneyCoder.ini");
|
||||
}
|
||||
|
||||
public static DatabaseRuntime Create(DatabaseOptions options)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(options);
|
||||
|
||||
Reference in New Issue
Block a user