migrate old files/settings
This commit is contained in:
parent
04a32533cb
commit
b768362eae
@ -24,7 +24,7 @@ namespace InternalUtilities
|
||||
{
|
||||
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; }
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
<!-- <PublishSingleFile>true</PublishSingleFile> -->
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
|
||||
<Version>3.1.12.120</Version>
|
||||
<Version>3.1.12.123</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@ -26,7 +26,6 @@ namespace LibationLauncher
|
||||
|
||||
AudibleApiStorage.EnsureAccountsSettingsFileExists();
|
||||
migrateIdentityFile();
|
||||
updateSettingsFile();
|
||||
|
||||
ensureLoggingConfig();
|
||||
ensureSerilogConfig();
|
||||
@ -101,6 +100,9 @@ namespace LibationLauncher
|
||||
|
||||
// delete legacy token file
|
||||
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()
|
||||
@ -170,15 +172,27 @@ namespace LibationLauncher
|
||||
if (!File.Exists(Configuration.Instance.SettingsFilePath))
|
||||
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
|
||||
var settingsContents = File.ReadAllText(Configuration.Instance.SettingsFilePath);
|
||||
var jObj = JObject.Parse(settingsContents);
|
||||
|
||||
jObj.Property("DecryptKey")?.Remove();
|
||||
jObj.Property("LocaleCountryCode")?.Remove();
|
||||
var resave = false;
|
||||
|
||||
// remember to remove these from Configuration.cs
|
||||
throw new NotImplementedException();
|
||||
var jDecryptKey = jObj.Property("DecryptKey");
|
||||
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";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user