Display settings wizard on first run
This commit is contained in:
parent
22e5dbf83d
commit
0b08bb3c4a
@ -38,7 +38,7 @@ namespace FileManager
|
|||||||
[Description("Location of the configuration file where these settings are saved. Please do not edit this file directly while Libation is running.")]
|
[Description("Location of the configuration file where these settings are saved. Please do not edit this file directly while Libation is running.")]
|
||||||
public string Filepath { get; }
|
public string Filepath { get; }
|
||||||
|
|
||||||
[Description("Your user-specific key used to decrypt your audible files (*.aax) into audio files you can use anywhere (*.m4b)")]
|
[Description("[Advanced. Leave alone in most cases.] Your user-specific key used to decrypt your audible files (*.aax) into audio files you can use anywhere (*.m4b)")]
|
||||||
public string DecryptKey
|
public string DecryptKey
|
||||||
{
|
{
|
||||||
get => persistentDictionary[nameof(DecryptKey)];
|
get => persistentDictionary[nameof(DecryptKey)];
|
||||||
|
|||||||
@ -202,10 +202,11 @@
|
|||||||
this.libationFilesCustomRb.TabIndex = 3;
|
this.libationFilesCustomRb.TabIndex = 3;
|
||||||
this.libationFilesCustomRb.TabStop = true;
|
this.libationFilesCustomRb.TabStop = true;
|
||||||
this.libationFilesCustomRb.UseVisualStyleBackColor = true;
|
this.libationFilesCustomRb.UseVisualStyleBackColor = true;
|
||||||
|
this.libationFilesCustomRb.CheckedChanged += new System.EventHandler(this.libationFilesCustomRb_CheckedChanged);
|
||||||
//
|
//
|
||||||
// libationFilesMyDocsRb
|
// libationFilesMyDocsRb
|
||||||
//
|
//
|
||||||
this.libationFilesMyDocsRb.AutoSize = true;
|
this.libationFilesMyDocsRb.AutoSize = true;
|
||||||
this.libationFilesMyDocsRb.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
|
this.libationFilesMyDocsRb.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
|
||||||
this.libationFilesMyDocsRb.Location = new System.Drawing.Point(9, 68);
|
this.libationFilesMyDocsRb.Location = new System.Drawing.Point(9, 68);
|
||||||
this.libationFilesMyDocsRb.Name = "libationFilesMyDocsRb";
|
this.libationFilesMyDocsRb.Name = "libationFilesMyDocsRb";
|
||||||
|
|||||||
@ -1,110 +1,116 @@
|
|||||||
using FileManager;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Dinah.Core;
|
using Dinah.Core;
|
||||||
|
using FileManager;
|
||||||
|
|
||||||
namespace LibationWinForm
|
namespace LibationWinForm
|
||||||
{
|
{
|
||||||
public partial class SettingsDialog : Form
|
public partial class SettingsDialog : Form
|
||||||
{
|
{
|
||||||
Configuration config { get; } = Configuration.Instance;
|
Configuration config { get; } = Configuration.Instance;
|
||||||
Func<string, string> desc { get; } = Configuration.GetDescription;
|
Func<string, string> desc { get; } = Configuration.GetDescription;
|
||||||
string exeRoot { get; }
|
string exeRoot { get; }
|
||||||
string myDocs { get; }
|
string myDocs { get; }
|
||||||
|
|
||||||
public SettingsDialog()
|
bool isFirstLoad;
|
||||||
{
|
|
||||||
InitializeComponent();
|
public SettingsDialog()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
audibleLocaleCb.SelectedIndex = 0;
|
audibleLocaleCb.SelectedIndex = 0;
|
||||||
|
|
||||||
exeRoot = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Exe.FileLocationOnDisk), "Libation"));
|
exeRoot = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Exe.FileLocationOnDisk), "Libation"));
|
||||||
myDocs = Path.GetFullPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Libation"));
|
myDocs = Path.GetFullPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Libation"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SettingsDialog_Load(object sender, EventArgs e)
|
private void SettingsDialog_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.settingsFileTb.Text = config.Filepath;
|
isFirstLoad = string.IsNullOrWhiteSpace(config.Books);
|
||||||
this.settingsFileDescLbl.Text = desc(nameof(config.Filepath));
|
|
||||||
|
|
||||||
this.decryptKeyTb.Text = config.DecryptKey;
|
this.settingsFileTb.Text = config.Filepath;
|
||||||
this.decryptKeyDescLbl.Text = desc(nameof(config.DecryptKey));
|
this.settingsFileDescLbl.Text = desc(nameof(config.Filepath));
|
||||||
|
|
||||||
this.booksLocationTb.Text = config.Books;
|
this.decryptKeyTb.Text = config.DecryptKey;
|
||||||
this.booksLocationDescLbl.Text = desc(nameof(config.Books));
|
this.decryptKeyDescLbl.Text = desc(nameof(config.DecryptKey));
|
||||||
|
|
||||||
|
this.booksLocationTb.Text = config.Books;
|
||||||
|
this.booksLocationDescLbl.Text = desc(nameof(config.Books));
|
||||||
|
|
||||||
this.audibleLocaleCb.Text = config.LocaleCountryCode;
|
this.audibleLocaleCb.Text = config.LocaleCountryCode;
|
||||||
|
|
||||||
libationFilesDescLbl.Text = desc(nameof(config.LibationFiles));
|
libationFilesDescLbl.Text = desc(nameof(config.LibationFiles));
|
||||||
this.libationFilesRootRb.Text = "In the same folder that Libation is running from\r\n" + exeRoot;
|
this.libationFilesRootRb.Text = "In the same folder that Libation is running from\r\n" + exeRoot;
|
||||||
this.libationFilesMyDocsRb.Text = "In My Documents\r\n" + myDocs;
|
this.libationFilesMyDocsRb.Text = "In My Documents\r\n" + myDocs;
|
||||||
if (config.LibationFiles == exeRoot)
|
if (config.LibationFiles == exeRoot)
|
||||||
libationFilesRootRb.Checked = true;
|
libationFilesRootRb.Checked = true;
|
||||||
else if (config.LibationFiles == myDocs)
|
else if (config.LibationFiles == myDocs)
|
||||||
libationFilesMyDocsRb.Checked = true;
|
libationFilesMyDocsRb.Checked = true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
libationFilesCustomRb.Checked = true;
|
libationFilesCustomRb.Checked = true;
|
||||||
libationFilesCustomTb.Text = config.LibationFiles;
|
libationFilesCustomTb.Text = config.LibationFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.downloadsInProgressDescLbl.Text = desc(nameof(config.DownloadsInProgressEnum));
|
this.downloadsInProgressDescLbl.Text = desc(nameof(config.DownloadsInProgressEnum));
|
||||||
var winTempDownloadsInProgress = Path.Combine(config.WinTemp, "DownloadsInProgress");
|
var winTempDownloadsInProgress = Path.Combine(config.WinTemp, "DownloadsInProgress");
|
||||||
this.downloadsInProgressWinTempRb.Text = "In your Windows temporary folder\r\n" + winTempDownloadsInProgress;
|
this.downloadsInProgressWinTempRb.Text = "In your Windows temporary folder\r\n" + winTempDownloadsInProgress;
|
||||||
switch (config.DownloadsInProgressEnum)
|
switch (config.DownloadsInProgressEnum)
|
||||||
{
|
{
|
||||||
case "LibationFiles":
|
case "LibationFiles":
|
||||||
downloadsInProgressLibationFilesRb.Checked = true;
|
downloadsInProgressLibationFilesRb.Checked = true;
|
||||||
break;
|
break;
|
||||||
case "WinTemp":
|
case "WinTemp":
|
||||||
default:
|
default:
|
||||||
downloadsInProgressWinTempRb.Checked = true;
|
downloadsInProgressWinTempRb.Checked = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.decryptInProgressDescLbl.Text = desc(nameof(config.DecryptInProgressEnum));
|
this.decryptInProgressDescLbl.Text = desc(nameof(config.DecryptInProgressEnum));
|
||||||
var winTempDecryptInProgress = Path.Combine(config.WinTemp, "DecryptInProgress");
|
var winTempDecryptInProgress = Path.Combine(config.WinTemp, "DecryptInProgress");
|
||||||
this.decryptInProgressWinTempRb.Text = "In your Windows temporary folder\r\n" + winTempDecryptInProgress;
|
this.decryptInProgressWinTempRb.Text = "In your Windows temporary folder\r\n" + winTempDecryptInProgress;
|
||||||
switch (config.DecryptInProgressEnum)
|
switch (config.DecryptInProgressEnum)
|
||||||
{
|
{
|
||||||
case "LibationFiles":
|
case "LibationFiles":
|
||||||
decryptInProgressLibationFilesRb.Checked = true;
|
decryptInProgressLibationFilesRb.Checked = true;
|
||||||
break;
|
break;
|
||||||
case "WinTemp":
|
case "WinTemp":
|
||||||
default:
|
default:
|
||||||
decryptInProgressWinTempRb.Checked = true;
|
decryptInProgressWinTempRb.Checked = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
libationFiles_Changed(this, null);
|
libationFiles_Changed(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void libationFiles_Changed(object sender, EventArgs e)
|
private void libationFiles_Changed(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var libationFilesDir
|
Check_libationFilesCustom_RadioButton();
|
||||||
= libationFilesRootRb.Checked ? exeRoot
|
|
||||||
: libationFilesMyDocsRb.Checked ? myDocs
|
|
||||||
: libationFilesCustomTb.Text;
|
|
||||||
|
|
||||||
var downloadsInProgress = Path.Combine(libationFilesDir, "DownloadsInProgress");
|
var libationFilesDir
|
||||||
this.downloadsInProgressLibationFilesRb.Text = $"In your Libation Files (ie: program-created files)\r\n{downloadsInProgress}";
|
= libationFilesRootRb.Checked ? exeRoot
|
||||||
|
: libationFilesMyDocsRb.Checked ? myDocs
|
||||||
|
: libationFilesCustomTb.Text;
|
||||||
|
|
||||||
var decryptInProgress = Path.Combine(libationFilesDir, "DecryptInProgress");
|
var downloadsInProgress = Path.Combine(libationFilesDir, "DownloadsInProgress");
|
||||||
this.decryptInProgressLibationFilesRb.Text = $"In your Libation Files (ie: program-created files)\r\n{decryptInProgress}";
|
this.downloadsInProgressLibationFilesRb.Text = $"In your Libation Files (ie: program-created files)\r\n{downloadsInProgress}";
|
||||||
}
|
|
||||||
|
|
||||||
private void booksLocationSearchBtn_Click(object sender, EventArgs e) => selectFolder("Search for books location", this.booksLocationTb);
|
var decryptInProgress = Path.Combine(libationFilesDir, "DecryptInProgress");
|
||||||
|
this.decryptInProgressLibationFilesRb.Text = $"In your Libation Files (ie: program-created files)\r\n{decryptInProgress}";
|
||||||
|
}
|
||||||
|
|
||||||
private void libationFilesCustomBtn_Click(object sender, EventArgs e) => selectFolder("Search for Libation Files location", this.libationFilesCustomTb);
|
private void booksLocationSearchBtn_Click(object sender, EventArgs e) => selectFolder("Search for books location", this.booksLocationTb);
|
||||||
|
|
||||||
private static void selectFolder(string desc, TextBox textbox)
|
private void libationFilesCustomBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Check_libationFilesCustom_RadioButton();
|
||||||
|
selectFolder("Search for Libation Files location", this.libationFilesCustomTb);
|
||||||
|
}
|
||||||
|
private void libationFilesCustomRb_CheckedChanged(object sender, EventArgs e) => Check_libationFilesCustom_RadioButton();
|
||||||
|
|
||||||
|
private void Check_libationFilesCustom_RadioButton() => this.libationFilesCustomRb.Checked = true;
|
||||||
|
|
||||||
|
private static void selectFolder(string desc, TextBox textbox)
|
||||||
{
|
{
|
||||||
using var dialog = new FolderBrowserDialog { Description = desc, SelectedPath = "" };
|
using var dialog = new FolderBrowserDialog { Description = desc, SelectedPath = "" };
|
||||||
dialog.ShowDialog();
|
dialog.ShowDialog();
|
||||||
@ -143,7 +149,7 @@ namespace LibationWinForm
|
|||||||
config.DownloadsInProgressEnum = downloadsInProgressLibationFilesRb.Checked ? "LibationFiles" : "WinTemp";
|
config.DownloadsInProgressEnum = downloadsInProgressLibationFilesRb.Checked ? "LibationFiles" : "WinTemp";
|
||||||
config.DecryptInProgressEnum = decryptInProgressLibationFilesRb.Checked ? "LibationFiles" : "WinTemp";
|
config.DecryptInProgressEnum = decryptInProgressLibationFilesRb.Checked ? "LibationFiles" : "WinTemp";
|
||||||
|
|
||||||
if (pathsChanged)
|
if (!isFirstLoad && pathsChanged)
|
||||||
{
|
{
|
||||||
var shutdownResult = MessageBox.Show(
|
var shutdownResult = MessageBox.Show(
|
||||||
"You have changed a file path important for this program. All files will remain in their original location; nothing will be moved. It is highly recommended that you restart this program so these changes are handled correctly."
|
"You have changed a file path important for this program. All files will remain in their original location; nothing will be moved. It is highly recommended that you restart this program so these changes are handled correctly."
|
||||||
@ -164,5 +170,5 @@ namespace LibationWinForm
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void cancelBtn_Click(object sender, EventArgs e) => this.Close();
|
private void cancelBtn_Click(object sender, EventArgs e) => this.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace LibationWinForm
|
namespace LibationWinForm
|
||||||
@ -16,6 +13,20 @@ namespace LibationWinForm
|
|||||||
{
|
{
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(FileManager.Configuration.Instance.Books))
|
||||||
|
{
|
||||||
|
var welcomeText = @"
|
||||||
|
This appears to be your first time using Libation. Welcome.
|
||||||
|
Please fill fill in a few settings on the following page. You can also change these settings later.
|
||||||
|
|
||||||
|
After you make your selections, get started by importing your library.
|
||||||
|
Go to Import > Scan Library
|
||||||
|
".Trim();
|
||||||
|
MessageBox.Show(welcomeText, "Welcom to Libation", MessageBoxButtons.OK);
|
||||||
|
new SettingsDialog().ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
Application.Run(new Form1());
|
Application.Run(new Form1());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
45
__TODO.txt
45
__TODO.txt
@ -1,4 +1,27 @@
|
|||||||
-- begin ENHANCEMENT, PERFORMANCE: IMPORT ---------------------------------------------------------------------------------------------------------------------
|
-- begin BETA ---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Screenshots and examples. Import. Search. Save tag. Search by tag.
|
||||||
|
Link to site with search syntax
|
||||||
|
|
||||||
|
Warn of know performance issues
|
||||||
|
- Library import
|
||||||
|
- Tag add/edit
|
||||||
|
- Grid is slow to respond loading when books aren't liberated
|
||||||
|
|
||||||
|
Error logging
|
||||||
|
|
||||||
|
Instructions on how to send me error logs
|
||||||
|
|
||||||
|
how to use tags. add, edit, search. spaces, underscores. search
|
||||||
|
partial (eg: [bio] also shows auto_bio)
|
||||||
|
|
||||||
|
instructions for using and saving filters
|
||||||
|
|
||||||
|
how to tag for hidden/greyed out
|
||||||
|
|
||||||
|
Create release version and installer
|
||||||
|
-- end BETA ---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- begin ENHANCEMENT, PERFORMANCE: IMPORT ---------------------------------------------------------------------------------------------------------------------
|
||||||
imports are PAINFULLY slow for just a few hundred items. wtf is taking so long?
|
imports are PAINFULLY slow for just a few hundred items. wtf is taking so long?
|
||||||
-- end ENHANCEMENT, PERFORMANCE: IMPORT ---------------------------------------------------------------------------------------------------------------------
|
-- end ENHANCEMENT, PERFORMANCE: IMPORT ---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -43,14 +66,14 @@ stack trace
|
|||||||
at System.ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion()
|
at System.ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion()
|
||||||
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
|
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
|
||||||
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
|
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
|
||||||
at FileManager.FilePathCache.GetPath(String id, FileType type) in C:\Dropbox\Dinah's folder\coding\_NET\Visual Studio 2019\Libation\FileManager\UNTESTED\FilePathCache.cs:line 33
|
at FileManager.FilePathCache.GetPath(String id, FileType type) in \Libation\FileManager\UNTESTED\FilePathCache.cs:line 33
|
||||||
at FileManager.AudibleFileStorage.<getAsync>d__32.MoveNext() in C:\Dropbox\Dinah's folder\coding\_NET\Visual Studio 2019\Libation\FileManager\UNTESTED\AudibleFileStorage.cs:line 112
|
at FileManager.AudibleFileStorage.<getAsync>d__32.MoveNext() in \Libation\FileManager\UNTESTED\AudibleFileStorage.cs:line 112
|
||||||
at FileManager.AudibleFileStorage.<GetAsync>d__31.MoveNext() in C:\Dropbox\Dinah's folder\coding\_NET\Visual Studio 2019\Libation\FileManager\UNTESTED\AudibleFileStorage.cs:line 107
|
at FileManager.AudibleFileStorage.<GetAsync>d__31.MoveNext() in \Libation\FileManager\UNTESTED\AudibleFileStorage.cs:line 107
|
||||||
at FileManager.AudibleFileStorage.<ExistsAsync>d__30.MoveNext() in C:\Dropbox\Dinah's folder\coding\_NET\Visual Studio 2019\Libation\FileManager\UNTESTED\AudibleFileStorage.cs:line 104
|
at FileManager.AudibleFileStorage.<ExistsAsync>d__30.MoveNext() in \Libation\FileManager\UNTESTED\AudibleFileStorage.cs:line 104
|
||||||
at LibationWinForm.Form1.<<setBookBackupCountsAsync>g__getAudioFileStateAsync|15_1>d.MoveNext() in C:\Dropbox\Dinah's folder\coding\_NET\Visual Studio 2019\Libation\LibationWinForm\UNTESTED\Form1.cs:line 110
|
at LibationWinForm.Form1.<<setBookBackupCountsAsync>g__getAudioFileStateAsync|15_1>d.MoveNext() in \Libation\LibationWinForm\UNTESTED\Form1.cs:line 110
|
||||||
at LibationWinForm.Form1.<setBookBackupCountsAsync>d__15.MoveNext() in C:\Dropbox\Dinah's folder\coding\_NET\Visual Studio 2019\Libation\LibationWinForm\UNTESTED\Form1.cs:line 117
|
at LibationWinForm.Form1.<setBookBackupCountsAsync>d__15.MoveNext() in \Libation\LibationWinForm\UNTESTED\Form1.cs:line 117
|
||||||
at LibationWinForm.Form1.<setBackupCountsAsync>d__13.MoveNext() in C:\Dropbox\Dinah's folder\coding\_NET\Visual Studio 2019\Libation\LibationWinForm\UNTESTED\Form1.cs:line 81
|
at LibationWinForm.Form1.<setBackupCountsAsync>d__13.MoveNext() in \Libation\LibationWinForm\UNTESTED\Form1.cs:line 81
|
||||||
at LibationWinForm.Form1.<Form1_Load>d__11.MoveNext() in C:\Dropbox\Dinah's folder\coding\_NET\Visual Studio 2019\Libation\LibationWinForm\UNTESTED\Form1.cs:line 60
|
at LibationWinForm.Form1.<Form1_Load>d__11.MoveNext() in \Libation\LibationWinForm\UNTESTED\Form1.cs:line 60
|
||||||
-- end BUG, MOVING FILES ---------------------------------------------------------------------------------------------------------------------
|
-- end BUG, MOVING FILES ---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- begin CONFIG FILES ---------------------------------------------------------------------------------------------------------------------
|
-- begin CONFIG FILES ---------------------------------------------------------------------------------------------------------------------
|
||||||
@ -63,8 +86,8 @@ multiple files named "appsettings.json" will overwrite each other
|
|||||||
libraries should avoid this generic name. ok for applications to use them
|
libraries should avoid this generic name. ok for applications to use them
|
||||||
|
|
||||||
Audible API
|
Audible API
|
||||||
C:\Dropbox\Dinah's folder\coding\_NET\Visual Studio 2019\audible api\AudibleApi\_Tests\AudibleApi.Tests\bin\Debug\netcoreapp3.0\L1
|
\AudibleApi\_Tests\AudibleApi.Tests\bin\Debug\netcoreapp3.0\L1
|
||||||
C:\Dropbox\Dinah's folder\coding\_NET\Visual Studio 2019\audible api\AudibleApi\_Tests\AudibleApi.Tests\bin\Debug\netcoreapp3.0\ComputedTestValues
|
\AudibleApi\_Tests\AudibleApi.Tests\bin\Debug\netcoreapp3.0\ComputedTestValues
|
||||||
14+ json files
|
14+ json files
|
||||||
these can go in a shared solution folder
|
these can go in a shared solution folder
|
||||||
BasePath => recursively search directories upward-only until fild dir with .sln
|
BasePath => recursively search directories upward-only until fild dir with .sln
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user