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 = string updateContentType =
"UPDATE books " + "UPDATE books " +
"SET contenttype = 4 " + "SET contenttype = 4 " +
"WHERE audibleproductid IN(SELECT books.audibleproductid " + "WHERE audibleproductid IN (SELECT books.audibleproductid " +
"FROM books " + "FROM books " +
"INNER JOIN series " + "INNER JOIN series " +
"ON ( books.audibleproductid = " + "ON ( books.audibleproductid = " +

View File

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