Libation 4.0 prep: in process of migrating to new settings files
This commit is contained in:
parent
8391e43b03
commit
643ae09b2b
8 changed files with 667 additions and 17 deletions
|
|
@ -24,7 +24,7 @@ namespace LibationLauncher
|
|||
|
||||
createSettings();
|
||||
|
||||
ensureIdentityFile();
|
||||
AudibleApiStorage.EnsureAccountsSettingsFileExists();
|
||||
migrateIdentityFile();
|
||||
updateSettingsFile();
|
||||
|
||||
|
|
@ -82,18 +82,6 @@ namespace LibationLauncher
|
|||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
private static void ensureIdentityFile()
|
||||
{
|
||||
if (File.Exists(AudibleApiStorage.AccountsSettingsFile))
|
||||
return;
|
||||
|
||||
var jObj = new JObject {
|
||||
{ "AccountsSettings", new JArray() }
|
||||
};
|
||||
var contents = jObj.ToString(Formatting.Indented);
|
||||
File.WriteAllText(AudibleApiStorage.AccountsSettingsFile, contents);
|
||||
}
|
||||
|
||||
private static void migrateIdentityFile()
|
||||
{
|
||||
if (!File.Exists(AudibleApiStorage.AccountsSettingsFileLegacy30))
|
||||
|
|
@ -102,8 +90,9 @@ namespace LibationLauncher
|
|||
try
|
||||
{
|
||||
//
|
||||
// for all in here: read directly from json file => JObject. A lot of this is legacy; don't rely on applicable POCOs
|
||||
// in here: read directly from json file => JObject. A lot of this is legacy; don't rely on applicable POCOs
|
||||
//
|
||||
|
||||
var legacyContents = File.ReadAllText(AudibleApiStorage.AccountsSettingsFileLegacy30);
|
||||
var legacyJObj = JObject.Parse(legacyContents);
|
||||
|
||||
|
|
@ -127,6 +116,11 @@ namespace LibationLauncher
|
|||
}
|
||||
}
|
||||
|
||||
// create new account stub in new file
|
||||
var api = AudibleApiActions.GetApiAsyncLegacy30Async().GetAwaiter().GetResult();
|
||||
var email = api.GetEmailAsync().GetAwaiter().GetResult();
|
||||
var locale = api.GetLocaleAsync(AudibleApi.CustomerOptions.All).GetAwaiter().GetResult();
|
||||
|
||||
// more to do?
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue