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

@ -76,9 +76,24 @@ namespace LibationWinForms.Dialogs
} }
private void saveBtn_Click(object sender, EventArgs e) private void saveBtn_Click(object sender, EventArgs e)
{
var origLocale = config.LocaleCountryCode;
var newLocale = this.audibleLocaleCb.Text;
if (origLocale == newLocale)
{ {
config.DecryptKey = this.decryptKeyTb.Text; config.DecryptKey = this.decryptKeyTb.Text;
config.LocaleCountryCode = this.audibleLocaleCb.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";