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.")]
|
||||
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
|
||||
{
|
||||
get => persistentDictionary[nameof(DecryptKey)];
|
||||
|
||||
@ -202,10 +202,11 @@
|
||||
this.libationFilesCustomRb.TabIndex = 3;
|
||||
this.libationFilesCustomRb.TabStop = true;
|
||||
this.libationFilesCustomRb.UseVisualStyleBackColor = true;
|
||||
this.libationFilesCustomRb.CheckedChanged += new System.EventHandler(this.libationFilesCustomRb_CheckedChanged);
|
||||
//
|
||||
// libationFilesMyDocsRb
|
||||
//
|
||||
this.libationFilesMyDocsRb.AutoSize = true;
|
||||
this.libationFilesMyDocsRb.AutoSize = true;
|
||||
this.libationFilesMyDocsRb.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
|
||||
this.libationFilesMyDocsRb.Location = new System.Drawing.Point(9, 68);
|
||||
this.libationFilesMyDocsRb.Name = "libationFilesMyDocsRb";
|
||||
|
||||
@ -1,110 +1,116 @@
|
||||
using FileManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Dinah.Core;
|
||||
using FileManager;
|
||||
|
||||
namespace LibationWinForm
|
||||
{
|
||||
public partial class SettingsDialog : Form
|
||||
{
|
||||
Configuration config { get; } = Configuration.Instance;
|
||||
Func<string, string> desc { get; } = Configuration.GetDescription;
|
||||
string exeRoot { get; }
|
||||
string myDocs { get; }
|
||||
public partial class SettingsDialog : Form
|
||||
{
|
||||
Configuration config { get; } = Configuration.Instance;
|
||||
Func<string, string> desc { get; } = Configuration.GetDescription;
|
||||
string exeRoot { get; }
|
||||
string myDocs { get; }
|
||||
|
||||
public SettingsDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
bool isFirstLoad;
|
||||
|
||||
public SettingsDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
audibleLocaleCb.SelectedIndex = 0;
|
||||
|
||||
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)
|
||||
{
|
||||
this.settingsFileTb.Text = config.Filepath;
|
||||
this.settingsFileDescLbl.Text = desc(nameof(config.Filepath));
|
||||
private void SettingsDialog_Load(object sender, EventArgs e)
|
||||
{
|
||||
isFirstLoad = string.IsNullOrWhiteSpace(config.Books);
|
||||
|
||||
this.decryptKeyTb.Text = config.DecryptKey;
|
||||
this.decryptKeyDescLbl.Text = desc(nameof(config.DecryptKey));
|
||||
this.settingsFileTb.Text = config.Filepath;
|
||||
this.settingsFileDescLbl.Text = desc(nameof(config.Filepath));
|
||||
|
||||
this.booksLocationTb.Text = config.Books;
|
||||
this.booksLocationDescLbl.Text = desc(nameof(config.Books));
|
||||
this.decryptKeyTb.Text = config.DecryptKey;
|
||||
this.decryptKeyDescLbl.Text = desc(nameof(config.DecryptKey));
|
||||
|
||||
this.booksLocationTb.Text = config.Books;
|
||||
this.booksLocationDescLbl.Text = desc(nameof(config.Books));
|
||||
|
||||
this.audibleLocaleCb.Text = config.LocaleCountryCode;
|
||||
|
||||
libationFilesDescLbl.Text = desc(nameof(config.LibationFiles));
|
||||
this.libationFilesRootRb.Text = "In the same folder that Libation is running from\r\n" + exeRoot;
|
||||
this.libationFilesMyDocsRb.Text = "In My Documents\r\n" + myDocs;
|
||||
if (config.LibationFiles == exeRoot)
|
||||
libationFilesRootRb.Checked = true;
|
||||
else if (config.LibationFiles == myDocs)
|
||||
libationFilesMyDocsRb.Checked = true;
|
||||
else
|
||||
{
|
||||
libationFilesCustomRb.Checked = true;
|
||||
libationFilesCustomTb.Text = config.LibationFiles;
|
||||
}
|
||||
libationFilesDescLbl.Text = desc(nameof(config.LibationFiles));
|
||||
this.libationFilesRootRb.Text = "In the same folder that Libation is running from\r\n" + exeRoot;
|
||||
this.libationFilesMyDocsRb.Text = "In My Documents\r\n" + myDocs;
|
||||
if (config.LibationFiles == exeRoot)
|
||||
libationFilesRootRb.Checked = true;
|
||||
else if (config.LibationFiles == myDocs)
|
||||
libationFilesMyDocsRb.Checked = true;
|
||||
else
|
||||
{
|
||||
libationFilesCustomRb.Checked = true;
|
||||
libationFilesCustomTb.Text = config.LibationFiles;
|
||||
}
|
||||
|
||||
this.downloadsInProgressDescLbl.Text = desc(nameof(config.DownloadsInProgressEnum));
|
||||
var winTempDownloadsInProgress = Path.Combine(config.WinTemp, "DownloadsInProgress");
|
||||
this.downloadsInProgressWinTempRb.Text = "In your Windows temporary folder\r\n" + winTempDownloadsInProgress;
|
||||
switch (config.DownloadsInProgressEnum)
|
||||
{
|
||||
case "LibationFiles":
|
||||
downloadsInProgressLibationFilesRb.Checked = true;
|
||||
break;
|
||||
case "WinTemp":
|
||||
default:
|
||||
downloadsInProgressWinTempRb.Checked = true;
|
||||
break;
|
||||
}
|
||||
this.downloadsInProgressDescLbl.Text = desc(nameof(config.DownloadsInProgressEnum));
|
||||
var winTempDownloadsInProgress = Path.Combine(config.WinTemp, "DownloadsInProgress");
|
||||
this.downloadsInProgressWinTempRb.Text = "In your Windows temporary folder\r\n" + winTempDownloadsInProgress;
|
||||
switch (config.DownloadsInProgressEnum)
|
||||
{
|
||||
case "LibationFiles":
|
||||
downloadsInProgressLibationFilesRb.Checked = true;
|
||||
break;
|
||||
case "WinTemp":
|
||||
default:
|
||||
downloadsInProgressWinTempRb.Checked = true;
|
||||
break;
|
||||
}
|
||||
|
||||
this.decryptInProgressDescLbl.Text = desc(nameof(config.DecryptInProgressEnum));
|
||||
var winTempDecryptInProgress = Path.Combine(config.WinTemp, "DecryptInProgress");
|
||||
this.decryptInProgressWinTempRb.Text = "In your Windows temporary folder\r\n" + winTempDecryptInProgress;
|
||||
switch (config.DecryptInProgressEnum)
|
||||
{
|
||||
case "LibationFiles":
|
||||
decryptInProgressLibationFilesRb.Checked = true;
|
||||
break;
|
||||
case "WinTemp":
|
||||
default:
|
||||
decryptInProgressWinTempRb.Checked = true;
|
||||
break;
|
||||
}
|
||||
this.decryptInProgressDescLbl.Text = desc(nameof(config.DecryptInProgressEnum));
|
||||
var winTempDecryptInProgress = Path.Combine(config.WinTemp, "DecryptInProgress");
|
||||
this.decryptInProgressWinTempRb.Text = "In your Windows temporary folder\r\n" + winTempDecryptInProgress;
|
||||
switch (config.DecryptInProgressEnum)
|
||||
{
|
||||
case "LibationFiles":
|
||||
decryptInProgressLibationFilesRb.Checked = true;
|
||||
break;
|
||||
case "WinTemp":
|
||||
default:
|
||||
decryptInProgressWinTempRb.Checked = true;
|
||||
break;
|
||||
}
|
||||
|
||||
libationFiles_Changed(this, null);
|
||||
}
|
||||
libationFiles_Changed(this, null);
|
||||
}
|
||||
|
||||
private void libationFiles_Changed(object sender, EventArgs e)
|
||||
{
|
||||
var libationFilesDir
|
||||
= libationFilesRootRb.Checked ? exeRoot
|
||||
: libationFilesMyDocsRb.Checked ? myDocs
|
||||
: libationFilesCustomTb.Text;
|
||||
private void libationFiles_Changed(object sender, EventArgs e)
|
||||
{
|
||||
Check_libationFilesCustom_RadioButton();
|
||||
|
||||
var downloadsInProgress = Path.Combine(libationFilesDir, "DownloadsInProgress");
|
||||
this.downloadsInProgressLibationFilesRb.Text = $"In your Libation Files (ie: program-created files)\r\n{downloadsInProgress}";
|
||||
var libationFilesDir
|
||||
= libationFilesRootRb.Checked ? exeRoot
|
||||
: libationFilesMyDocsRb.Checked ? myDocs
|
||||
: libationFilesCustomTb.Text;
|
||||
|
||||
var decryptInProgress = Path.Combine(libationFilesDir, "DecryptInProgress");
|
||||
this.decryptInProgressLibationFilesRb.Text = $"In your Libation Files (ie: program-created files)\r\n{decryptInProgress}";
|
||||
}
|
||||
var downloadsInProgress = Path.Combine(libationFilesDir, "DownloadsInProgress");
|
||||
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 = "" };
|
||||
dialog.ShowDialog();
|
||||
@ -143,7 +149,7 @@ namespace LibationWinForm
|
||||
config.DownloadsInProgressEnum = downloadsInProgressLibationFilesRb.Checked ? "LibationFiles" : "WinTemp";
|
||||
config.DecryptInProgressEnum = decryptInProgressLibationFilesRb.Checked ? "LibationFiles" : "WinTemp";
|
||||
|
||||
if (pathsChanged)
|
||||
if (!isFirstLoad && pathsChanged)
|
||||
{
|
||||
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."
|
||||
@ -164,5 +170,5 @@ namespace LibationWinForm
|
||||
}
|
||||
|
||||
private void cancelBtn_Click(object sender, EventArgs e) => this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace LibationWinForm
|
||||
@ -16,6 +13,20 @@ namespace LibationWinForm
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
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?
|
||||
-- end ENHANCEMENT, PERFORMANCE: IMPORT ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@ -43,14 +66,14 @@ stack trace
|
||||
at System.ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion()
|
||||
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
|
||||
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.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__31.MoveNext() in C:\Dropbox\Dinah's folder\coding\_NET\Visual Studio 2019\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 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>d__15.MoveNext() in C:\Dropbox\Dinah's folder\coding\_NET\Visual Studio 2019\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.<Form1_Load>d__11.MoveNext() in C:\Dropbox\Dinah's folder\coding\_NET\Visual Studio 2019\Libation\LibationWinForm\UNTESTED\Form1.cs:line 60
|
||||
at FileManager.FilePathCache.GetPath(String id, FileType type) in \Libation\FileManager\UNTESTED\FilePathCache.cs:line 33
|
||||
at FileManager.AudibleFileStorage.<getAsync>d__32.MoveNext() in \Libation\FileManager\UNTESTED\AudibleFileStorage.cs:line 112
|
||||
at FileManager.AudibleFileStorage.<GetAsync>d__31.MoveNext() in \Libation\FileManager\UNTESTED\AudibleFileStorage.cs:line 107
|
||||
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 \Libation\LibationWinForm\UNTESTED\Form1.cs:line 110
|
||||
at LibationWinForm.Form1.<setBookBackupCountsAsync>d__15.MoveNext() in \Libation\LibationWinForm\UNTESTED\Form1.cs:line 117
|
||||
at LibationWinForm.Form1.<setBackupCountsAsync>d__13.MoveNext() in \Libation\LibationWinForm\UNTESTED\Form1.cs:line 81
|
||||
at LibationWinForm.Form1.<Form1_Load>d__11.MoveNext() in \Libation\LibationWinForm\UNTESTED\Form1.cs:line 60
|
||||
-- end BUG, MOVING 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
|
||||
|
||||
Audible API
|
||||
C:\Dropbox\Dinah's folder\coding\_NET\Visual Studio 2019\audible api\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\L1
|
||||
\AudibleApi\_Tests\AudibleApi.Tests\bin\Debug\netcoreapp3.0\ComputedTestValues
|
||||
14+ json files
|
||||
these can go in a shared solution folder
|
||||
BasePath => recursively search directories upward-only until fild dir with .sln
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user