migrate old files/settings
This commit is contained in:
parent
04a32533cb
commit
b768362eae
@ -24,7 +24,7 @@ namespace InternalUtilities
|
|||||||
{
|
{
|
||||||
Localization.SetLocale(Configuration.Instance.LocaleCountryCode);
|
Localization.SetLocale(Configuration.Instance.LocaleCountryCode);
|
||||||
|
|
||||||
return await EzApiCreator.GetApiAsync(AudibleApiStorage.AccountsSettingsFile, AudibleApiStorage.GetJsonPath(), loginCallback);
|
return await EzApiCreator.GetApiAsync(AudibleApiStorage.AccountsSettingsFile, AudibleApiStorage.GetIdentityTokensJsonPath(), loginCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AsyncRetryPolicy policy { get; }
|
private static AsyncRetryPolicy policy { get; }
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
<!-- <PublishSingleFile>true</PublishSingleFile> -->
|
<!-- <PublishSingleFile>true</PublishSingleFile> -->
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
|
|
||||||
<Version>3.1.12.120</Version>
|
<Version>3.1.12.123</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -26,7 +26,6 @@ namespace LibationLauncher
|
|||||||
|
|
||||||
AudibleApiStorage.EnsureAccountsSettingsFileExists();
|
AudibleApiStorage.EnsureAccountsSettingsFileExists();
|
||||||
migrateIdentityFile();
|
migrateIdentityFile();
|
||||||
updateSettingsFile();
|
|
||||||
|
|
||||||
ensureLoggingConfig();
|
ensureLoggingConfig();
|
||||||
ensureSerilogConfig();
|
ensureSerilogConfig();
|
||||||
@ -101,6 +100,9 @@ namespace LibationLauncher
|
|||||||
|
|
||||||
// delete legacy token file
|
// delete legacy token file
|
||||||
File.Delete(AudibleApiStorage.AccountsSettingsFileLegacy30);
|
File.Delete(AudibleApiStorage.AccountsSettingsFileLegacy30);
|
||||||
|
|
||||||
|
// in reality, only need to run this when migating v3 => v4. put inside here so already upgraded versions won't make this check
|
||||||
|
updateSettingsFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void updateLegacyFileWithLocale()
|
private static void updateLegacyFileWithLocale()
|
||||||
@ -170,15 +172,27 @@ namespace LibationLauncher
|
|||||||
if (!File.Exists(Configuration.Instance.SettingsFilePath))
|
if (!File.Exists(Configuration.Instance.SettingsFilePath))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// don't delete old settings until new values are used
|
||||||
|
// remember to remove these from Configuration.cs
|
||||||
|
throw new NotImplementedException();
|
||||||
|
|
||||||
// use JObject to remove decrypt key and locale from Settings.json
|
// use JObject to remove decrypt key and locale from Settings.json
|
||||||
var settingsContents = File.ReadAllText(Configuration.Instance.SettingsFilePath);
|
var settingsContents = File.ReadAllText(Configuration.Instance.SettingsFilePath);
|
||||||
var jObj = JObject.Parse(settingsContents);
|
var jObj = JObject.Parse(settingsContents);
|
||||||
|
|
||||||
jObj.Property("DecryptKey")?.Remove();
|
var resave = false;
|
||||||
jObj.Property("LocaleCountryCode")?.Remove();
|
|
||||||
|
|
||||||
// remember to remove these from Configuration.cs
|
var jDecryptKey = jObj.Property("DecryptKey");
|
||||||
throw new NotImplementedException();
|
var jLocale = jObj.Property("LocaleCountryCode");
|
||||||
|
|
||||||
|
jDecryptKey?.Remove();
|
||||||
|
jLocale?.Remove();
|
||||||
|
|
||||||
|
if (jDecryptKey != null || jLocale != null)
|
||||||
|
{
|
||||||
|
var newContents = jObj.ToString(Formatting.Indented);
|
||||||
|
File.WriteAllText(Configuration.Instance.SettingsFilePath, newContents);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string defaultLoggingLevel { get; } = "Information";
|
private static string defaultLoggingLevel { get; } = "Information";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user