diff --git a/FileManager/UNTESTED/PersistentDictionary.cs b/FileManager/UNTESTED/PersistentDictionary.cs
index f5ee0b45..677a435f 100644
--- a/FileManager/UNTESTED/PersistentDictionary.cs
+++ b/FileManager/UNTESTED/PersistentDictionary.cs
@@ -64,7 +64,34 @@ namespace FileManager
// set cache
stringCache[propertyName] = newValue;
- // set in file
+ writeFile(propertyName, newValue);
+ }
+
+ public void Set(string propertyName, object newValue)
+ {
+ // set cache
+ objectCache[propertyName] = newValue;
+
+ var parsedNewValue = JToken.Parse(JsonConvert.SerializeObject(newValue));
+ writeFile(propertyName, parsedNewValue);
+ }
+
+ private void writeFile(string propertyName, JToken newValue)
+ {
+ try
+ {
+ var str = newValue?.ToString();
+ var formattedValue
+ = str is null ? "[null]"
+ : string.IsNullOrEmpty(str) ? "[empty]"
+ : string.IsNullOrWhiteSpace(str) ? $"[whitespace. Length={str.Length}]"
+ : str.Length > 100 ? $"[Length={str.Length}] {str[0..50]}...{str[^50..^0]}"
+ : str;
+ Serilog.Log.Logger.Information($"Config changed. {propertyName}={formattedValue}");
+ }
+ catch { }
+
+ // write new setting to file
lock (locker)
{
var jObject = readFile();
@@ -73,20 +100,7 @@ namespace FileManager
}
}
- public void Set(string propertyName, object newValue)
- {
- // set cache
- objectCache[propertyName] = newValue;
-
- // set in file
- lock (locker)
- {
- var jObject = readFile();
- jObject[propertyName] = JToken.Parse(JsonConvert.SerializeObject(newValue));
- File.WriteAllText(Filepath, JsonConvert.SerializeObject(jObject, Formatting.Indented));
- }
- }
-
+ // special case: no caching. no logging
public void SetWithJsonPath(string jsonPath, string propertyName, string newValue)
{
lock (locker)
@@ -94,6 +108,7 @@ namespace FileManager
var jObject = readFile();
var token = jObject.SelectToken(jsonPath);
var debug_oldValue = (string)token[propertyName];
+
token[propertyName] = newValue;
File.WriteAllText(Filepath, JsonConvert.SerializeObject(jObject, Formatting.Indented));
}
diff --git a/LibationLauncher/LibationLauncher.csproj b/LibationLauncher/LibationLauncher.csproj
index f4f2e146..cb15539f 100644
--- a/LibationLauncher/LibationLauncher.csproj
+++ b/LibationLauncher/LibationLauncher.csproj
@@ -13,7 +13,7 @@
win-x64
- 3.1.0.50
+ 3.1.0.52
diff --git a/LibationLauncher/UNTESTED/Program.cs b/LibationLauncher/UNTESTED/Program.cs
index 38375e88..9a42a72e 100644
--- a/LibationLauncher/UNTESTED/Program.cs
+++ b/LibationLauncher/UNTESTED/Program.cs
@@ -1,7 +1,6 @@
using System;
using System.IO;
using System.Linq;
-using System.Threading.Tasks;
using System.Windows.Forms;
using FileManager;
using LibationWinForms;
@@ -191,7 +190,6 @@ namespace LibationLauncher
//Log.Logger.Here().Debug("Begin Libation. Debug with line numbers");
}
- private static event Action cheating;
private static void checkForUpdate()
{
try
@@ -247,8 +245,9 @@ namespace LibationLauncher
private static void logStartupState()
{
Log.Logger.Information("Begin Libation");
-
Log.Logger.Information($"Version: {BuildVersion}");
+ Log.Logger.Information($"LibationFiles: {Configuration.Instance.LibationFiles}");
+ Log.Logger.Information($"Audible locale: {Configuration.Instance.LocaleCountryCode}");
}
private static Version BuildVersion => System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
diff --git a/LibationWinForms/UNTESTED/Dialogs/SetupDialog.Designer.cs b/LibationWinForms/UNTESTED/Dialogs/SetupDialog.Designer.cs
index f35f4600..0401cc7c 100644
--- a/LibationWinForms/UNTESTED/Dialogs/SetupDialog.Designer.cs
+++ b/LibationWinForms/UNTESTED/Dialogs/SetupDialog.Designer.cs
@@ -40,13 +40,15 @@
this.welcomeLbl.AutoSize = true;
this.welcomeLbl.Location = new System.Drawing.Point(12, 9);
this.welcomeLbl.Name = "welcomeLbl";
- this.welcomeLbl.Size = new System.Drawing.Size(399, 78);
+ this.welcomeLbl.Size = new System.Drawing.Size(399, 117);
this.welcomeLbl.TabIndex = 0;
this.welcomeLbl.Text = resources.GetString("welcomeLbl.Text");
//
// noQuestionsBtn
//
- this.noQuestionsBtn.Location = new System.Drawing.Point(15, 90);
+ this.noQuestionsBtn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.noQuestionsBtn.Location = new System.Drawing.Point(15, 129);
this.noQuestionsBtn.Name = "noQuestionsBtn";
this.noQuestionsBtn.Size = new System.Drawing.Size(396, 57);
this.noQuestionsBtn.TabIndex = 1;
@@ -55,7 +57,9 @@
//
// basicBtn
//
- this.basicBtn.Location = new System.Drawing.Point(15, 153);
+ this.basicBtn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.basicBtn.Location = new System.Drawing.Point(15, 192);
this.basicBtn.Name = "basicBtn";
this.basicBtn.Size = new System.Drawing.Size(396, 57);
this.basicBtn.TabIndex = 2;
@@ -64,7 +68,9 @@
//
// advancedBtn
//
- this.advancedBtn.Location = new System.Drawing.Point(15, 216);
+ this.advancedBtn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.advancedBtn.Location = new System.Drawing.Point(15, 255);
this.advancedBtn.Name = "advancedBtn";
this.advancedBtn.Size = new System.Drawing.Size(396, 57);
this.advancedBtn.TabIndex = 3;
@@ -75,7 +81,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(423, 285);
+ this.ClientSize = new System.Drawing.Size(423, 324);
this.Controls.Add(this.advancedBtn);
this.Controls.Add(this.basicBtn);
this.Controls.Add(this.noQuestionsBtn);
diff --git a/LibationWinForms/UNTESTED/Dialogs/SetupDialog.resx b/LibationWinForms/UNTESTED/Dialogs/SetupDialog.resx
index d2709b5f..3afce6fa 100644
--- a/LibationWinForms/UNTESTED/Dialogs/SetupDialog.resx
+++ b/LibationWinForms/UNTESTED/Dialogs/SetupDialog.resx
@@ -123,6 +123,9 @@
Please fill in a few settings. You can also change these settings later.
After you make your selections, get started by importing your library.
-Go to Import > Scan Library
+Go to Import > Scan Library
+
+Download your entire library from the "Liberate" tab or
+liberate your books one at a time by clicking the stoplight
\ No newline at end of file
diff --git a/LibationWinForms/UNTESTED/Form1.cs b/LibationWinForms/UNTESTED/Form1.cs
index 7e2233ee..a41fc307 100644
--- a/LibationWinForms/UNTESTED/Form1.cs
+++ b/LibationWinForms/UNTESTED/Form1.cs
@@ -49,12 +49,10 @@ namespace LibationWinForms
// also applies filter. ONLY call AFTER loading grid
loadInitialQuickFilterState();
- { // init bottom counts
- backupsCountsLbl.Text = "[Calculating backed up book quantities]";
- pdfsCountsLbl.Text = "[Calculating backed up PDFs]";
-
- setBackupCounts(null, null);
- }
+ // init bottom counts
+ backupsCountsLbl.Text = "[Calculating backed up book quantities]";
+ pdfsCountsLbl.Text = "[Calculating backed up PDFs]";
+ setBackupCounts(null, null);
}
#region reload grid
@@ -142,6 +140,7 @@ namespace LibationWinForms
= pending > 0
? $"{pending} remaining"
: "All books have been liberated";
+ Serilog.Log.Logger.Information(menuItemText);
menuStrip1.UIThread(() => beginBookBackupsToolStripMenuItem.Enabled = pending > 0);
menuStrip1.UIThread(() => beginBookBackupsToolStripMenuItem.Text = string.Format(beginBookBackupsToolStripMenuItem_format, menuItemText));
}
@@ -167,6 +166,7 @@ namespace LibationWinForms
= notDownloaded > 0
? $"{notDownloaded} remaining"
: "All PDFs have been downloaded";
+ Serilog.Log.Logger.Information(menuItemText);
menuStrip1.UIThread(() => beginPdfBackupsToolStripMenuItem.Enabled = notDownloaded > 0);
menuStrip1.UIThread(() => beginPdfBackupsToolStripMenuItem.Text = string.Format(beginPdfBackupsToolStripMenuItem_format, menuItemText));
}
diff --git a/WinFormsDesigner/Dialogs/SetupDialog.Designer.cs b/WinFormsDesigner/Dialogs/SetupDialog.Designer.cs
index 0b49b6aa..71bbaa50 100644
--- a/WinFormsDesigner/Dialogs/SetupDialog.Designer.cs
+++ b/WinFormsDesigner/Dialogs/SetupDialog.Designer.cs
@@ -40,13 +40,15 @@
this.welcomeLbl.AutoSize = true;
this.welcomeLbl.Location = new System.Drawing.Point(12, 9);
this.welcomeLbl.Name = "welcomeLbl";
- this.welcomeLbl.Size = new System.Drawing.Size(399, 78);
+ this.welcomeLbl.Size = new System.Drawing.Size(399, 117);
this.welcomeLbl.TabIndex = 0;
this.welcomeLbl.Text = resources.GetString("welcomeLbl.Text");
//
// noQuestionsBtn
//
- this.noQuestionsBtn.Location = new System.Drawing.Point(15, 90);
+ this.noQuestionsBtn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.noQuestionsBtn.Location = new System.Drawing.Point(15, 129);
this.noQuestionsBtn.Name = "noQuestionsBtn";
this.noQuestionsBtn.Size = new System.Drawing.Size(396, 57);
this.noQuestionsBtn.TabIndex = 1;
@@ -55,7 +57,9 @@
//
// basicBtn
//
- this.basicBtn.Location = new System.Drawing.Point(15, 153);
+ this.basicBtn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.basicBtn.Location = new System.Drawing.Point(15, 192);
this.basicBtn.Name = "basicBtn";
this.basicBtn.Size = new System.Drawing.Size(396, 57);
this.basicBtn.TabIndex = 2;
@@ -64,7 +68,9 @@
//
// advancedBtn
//
- this.advancedBtn.Location = new System.Drawing.Point(15, 216);
+ this.advancedBtn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.advancedBtn.Location = new System.Drawing.Point(15, 255);
this.advancedBtn.Name = "advancedBtn";
this.advancedBtn.Size = new System.Drawing.Size(396, 57);
this.advancedBtn.TabIndex = 3;
@@ -75,7 +81,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(423, 285);
+ this.ClientSize = new System.Drawing.Size(423, 324);
this.Controls.Add(this.advancedBtn);
this.Controls.Add(this.basicBtn);
this.Controls.Add(this.noQuestionsBtn);
diff --git a/WinFormsDesigner/Dialogs/SetupDialog.resx b/WinFormsDesigner/Dialogs/SetupDialog.resx
index d2709b5f..3afce6fa 100644
--- a/WinFormsDesigner/Dialogs/SetupDialog.resx
+++ b/WinFormsDesigner/Dialogs/SetupDialog.resx
@@ -123,6 +123,9 @@
Please fill in a few settings. You can also change these settings later.
After you make your selections, get started by importing your library.
-Go to Import > Scan Library
+Go to Import > Scan Library
+
+Download your entire library from the "Liberate" tab or
+liberate your books one at a time by clicking the stoplight
\ No newline at end of file