Set Import/Esport initial directory

This commit is contained in:
Michael Bucari-Tovo 2022-06-12 16:29:33 -06:00
parent 2341f6ea3b
commit fa195483d6
2 changed files with 17 additions and 2 deletions

View File

@ -429,7 +429,7 @@ namespace AppScaffolding
string updateContentType =
"UPDATE books " +
"SET contenttype = 4 " +
"WHERE audibleproductid IN(SELECT books.audibleproductid " +
"WHERE audibleproductid IN (SELECT books.audibleproductid " +
"FROM books " +
"INNER JOIN series " +
"ON ( books.audibleproductid = " +
@ -445,7 +445,7 @@ namespace AppScaffolding
"'- 1' " +
"FROM books " +
"LEFT OUTER JOIN seriesbook " +
"ON books.bookid = seriesbook.bookid " +
"ON books.bookid = seriesbook.bookid " +
"INNER JOIN series " +
"ON books.audibleproductid = series.audibleseriesid " +
"WHERE books.contenttype = 4 " +

View File

@ -210,6 +210,9 @@ namespace LibationWinForms.Dialogs
})
.ToList();
private string GetAudibleCliAppDataPath()
=> Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Audible");
private void Export(string accountId, string locale)
{
// without transaction, accounts persister will write ANY EDIT immediately to file
@ -229,6 +232,11 @@ namespace LibationWinForms.Dialogs
SaveFileDialog sfd = new();
sfd.Filter = "JSON File|*.json";
string audibleAppDataDir = GetAudibleCliAppDataPath();
if (Directory.Exists(audibleAppDataDir))
sfd.InitialDirectory = audibleAppDataDir;
if (sfd.ShowDialog() != DialogResult.OK) return;
try
@ -249,10 +257,17 @@ namespace LibationWinForms.Dialogs
ex);
}
}
private async void importBtn_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new();
ofd.Filter = "JSON File|*.json";
ofd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
string audibleAppDataDir = GetAudibleCliAppDataPath();
if (Directory.Exists(audibleAppDataDir))
ofd.InitialDirectory = audibleAppDataDir;
if (ofd.ShowDialog() != DialogResult.OK) return;