When changing locale, clear previous locale specific settings

This commit is contained in:
Robert McRackan 2020-07-31 14:21:59 -04:00
parent b00f2bd908
commit e417f60a36
2 changed files with 18 additions and 3 deletions

View File

@ -13,7 +13,7 @@
<!-- <PublishSingleFile>true</PublishSingleFile> --> <!-- <PublishSingleFile>true</PublishSingleFile> -->
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<Version>3.1.11.10</Version> <Version>3.1.11.11</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -77,8 +77,23 @@ namespace LibationWinForms.Dialogs
private void saveBtn_Click(object sender, EventArgs e) private void saveBtn_Click(object sender, EventArgs e)
{ {
config.DecryptKey = this.decryptKeyTb.Text; var origLocale = config.LocaleCountryCode;
config.LocaleCountryCode = this.audibleLocaleCb.Text; var newLocale = this.audibleLocaleCb.Text;
if (origLocale == newLocale)
{
config.DecryptKey = this.decryptKeyTb.Text;
}
else
{
// when changing locale:
// - delete decrypt key
// - clear/delete identity tokens file
config.LocaleCountryCode = newLocale;
config.DecryptKey = "";
File.Delete(AudibleApiStorage.IdentityTokensFile);
}
config.DownloadsInProgressEnum = downloadsInProgressLibationFilesRb.Checked ? "LibationFiles" : "WinTemp"; config.DownloadsInProgressEnum = downloadsInProgressLibationFilesRb.Checked ? "LibationFiles" : "WinTemp";
config.DecryptInProgressEnum = decryptInProgressLibationFilesRb.Checked ? "LibationFiles" : "WinTemp"; config.DecryptInProgressEnum = decryptInProgressLibationFilesRb.Checked ? "LibationFiles" : "WinTemp";