settings folders need read-only textbox

This commit is contained in:
Robert McRackan 2021-07-21 14:12:35 -04:00
parent 9aa31338d6
commit 206890b8f3
7 changed files with 46 additions and 44 deletions

View File

@ -222,17 +222,18 @@ namespace FileManager
if (libationFilesPathCache is not null) if (libationFilesPathCache is not null)
return libationFilesPathCache; return libationFilesPathCache;
// must write here before SettingsFilePath in next step reads cache // FIRST: must write here before SettingsFilePath in next step reads cache
libationFilesPathCache = getLiberationFilesSettingFromJson(); libationFilesPathCache = getLiberationFilesSettingFromJson();
// SECOND. before setting to json file with SetWithJsonPath, PersistentDictionary must exist
persistentDictionary = new PersistentDictionary(SettingsFilePath);
// Config init in Program.ensureSerilogConfig() only happens when serilog setting is first created (prob on 1st run). // Config init in Program.ensureSerilogConfig() only happens when serilog setting is first created (prob on 1st run).
// This Set() enforces current LibationFiles every time we restart Libation or redirect LibationFiles // This Set() enforces current LibationFiles every time we restart Libation or redirect LibationFiles
var logPath = Path.Combine(LibationFiles, "Log.log"); var logPath = Path.Combine(LibationFiles, "Log.log");
SetWithJsonPath("Serilog.WriteTo[1].Args", "path", logPath, true); SetWithJsonPath("Serilog.WriteTo[1].Args", "path", logPath, true);
configuration?.Reload(); configuration?.Reload();
persistentDictionary = new PersistentDictionary(SettingsFilePath);
return libationFilesPathCache; return libationFilesPathCache;
} }
} }

View File

@ -13,7 +13,7 @@
<!-- <PublishSingleFile>true</PublishSingleFile> --> <!-- <PublishSingleFile>true</PublishSingleFile> -->
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<Version>5.3.1.1</Version> <Version>5.3.2.1</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -49,7 +49,7 @@ namespace LibationWinForms.Dialogs
// customDirectoryRb // customDirectoryRb
// //
this.customDirectoryRb.AutoSize = true; this.customDirectoryRb.AutoSize = true;
this.customDirectoryRb.Location = new System.Drawing.Point(2, 56); this.customDirectoryRb.Location = new System.Drawing.Point(2, 62);
this.customDirectoryRb.Name = "customDirectoryRb"; this.customDirectoryRb.Name = "customDirectoryRb";
this.customDirectoryRb.Size = new System.Drawing.Size(14, 13); this.customDirectoryRb.Size = new System.Drawing.Size(14, 13);
this.customDirectoryRb.TabIndex = 2; this.customDirectoryRb.TabIndex = 2;
@ -60,7 +60,7 @@ namespace LibationWinForms.Dialogs
// //
this.customTb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.customTb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.customTb.Location = new System.Drawing.Point(22, 52); this.customTb.Location = new System.Drawing.Point(22, 58);
this.customTb.Name = "customTb"; this.customTb.Name = "customTb";
this.customTb.Size = new System.Drawing.Size(588, 23); this.customTb.Size = new System.Drawing.Size(588, 23);
this.customTb.TabIndex = 3; this.customTb.TabIndex = 3;
@ -68,7 +68,7 @@ namespace LibationWinForms.Dialogs
// customBtn // customBtn
// //
this.customBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.customBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.customBtn.Location = new System.Drawing.Point(616, 52); this.customBtn.Location = new System.Drawing.Point(616, 58);
this.customBtn.Name = "customBtn"; this.customBtn.Name = "customBtn";
this.customBtn.Size = new System.Drawing.Size(41, 27); this.customBtn.Size = new System.Drawing.Size(41, 27);
this.customBtn.TabIndex = 4; this.customBtn.TabIndex = 4;
@ -82,7 +82,7 @@ namespace LibationWinForms.Dialogs
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.directorySelectControl.Location = new System.Drawing.Point(23, 0); this.directorySelectControl.Location = new System.Drawing.Point(23, 0);
this.directorySelectControl.Name = "directorySelectControl"; this.directorySelectControl.Name = "directorySelectControl";
this.directorySelectControl.Size = new System.Drawing.Size(635, 46); this.directorySelectControl.Size = new System.Drawing.Size(635, 52);
this.directorySelectControl.TabIndex = 5; this.directorySelectControl.TabIndex = 5;
// //
// DirectoryOrCustomSelectControl // DirectoryOrCustomSelectControl
@ -95,7 +95,7 @@ namespace LibationWinForms.Dialogs
this.Controls.Add(this.customDirectoryRb); this.Controls.Add(this.customDirectoryRb);
this.Controls.Add(this.knownDirectoryRb); this.Controls.Add(this.knownDirectoryRb);
this.Name = "DirectoryOrCustomSelectControl"; this.Name = "DirectoryOrCustomSelectControl";
this.Size = new System.Drawing.Size(660, 81); this.Size = new System.Drawing.Size(660, 87);
this.Load += new System.EventHandler(this.DirectoryOrCustomSelectControl_Load); this.Load += new System.EventHandler(this.DirectoryOrCustomSelectControl_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();

View File

@ -30,7 +30,7 @@ namespace LibationWinForms.Dialogs
private void InitializeComponent() private void InitializeComponent()
{ {
this.directoryComboBox = new System.Windows.Forms.ComboBox(); this.directoryComboBox = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label(); this.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout(); this.SuspendLayout();
// //
// directoryComboBox // directoryComboBox
@ -45,23 +45,24 @@ namespace LibationWinForms.Dialogs
this.directoryComboBox.TabIndex = 0; this.directoryComboBox.TabIndex = 0;
this.directoryComboBox.SelectedIndexChanged += new System.EventHandler(this.directoryComboBox_SelectedIndexChanged); this.directoryComboBox.SelectedIndexChanged += new System.EventHandler(this.directoryComboBox_SelectedIndexChanged);
// //
// label1 // textBox1
// //
this.label1.AutoSize = true; this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.label1.Location = new System.Drawing.Point(0, 26); | System.Windows.Forms.AnchorStyles.Right)));
this.label1.Name = "label1"; this.textBox1.Location = new System.Drawing.Point(0, 29);
this.label1.Size = new System.Drawing.Size(97, 15); this.textBox1.Name = "textBox1";
this.label1.TabIndex = 1; this.textBox1.ReadOnly = true;
this.label1.Text = "Select a directory"; this.textBox1.Size = new System.Drawing.Size(647, 23);
this.textBox1.TabIndex = 1;
// //
// DirectorySelectControl // DirectorySelectControl
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label1); this.Controls.Add(this.textBox1);
this.Controls.Add(this.directoryComboBox); this.Controls.Add(this.directoryComboBox);
this.Name = "DirectorySelectControl"; this.Name = "DirectorySelectControl";
this.Size = new System.Drawing.Size(647, 46); this.Size = new System.Drawing.Size(647, 52);
this.Load += new System.EventHandler(this.DirectorySelectControl_Load); this.Load += new System.EventHandler(this.DirectorySelectControl_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -71,6 +72,6 @@ namespace LibationWinForms.Dialogs
#endregion #endregion
private System.Windows.Forms.ComboBox directoryComboBox; private System.Windows.Forms.ComboBox directoryComboBox;
private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox textBox1;
} }
} }

View File

@ -107,6 +107,6 @@ namespace LibationWinForms.Dialogs
} }
private void directoryComboBox_SelectedIndexChanged(object sender, EventArgs e) => this.label1.Text = selectedItem.UiDisplayPath; private void directoryComboBox_SelectedIndexChanged(object sender, EventArgs e) => this.textBox1.Text = selectedItem.UiDisplayPath;
} }
} }

View File

@ -75,14 +75,14 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.libationFilesSelectControl.Location = new System.Drawing.Point(14, 28); this.libationFilesSelectControl.Location = new System.Drawing.Point(14, 28);
this.libationFilesSelectControl.Name = "libationFilesSelectControl"; this.libationFilesSelectControl.Name = "libationFilesSelectControl";
this.libationFilesSelectControl.Size = new System.Drawing.Size(909, 81); this.libationFilesSelectControl.Size = new System.Drawing.Size(909, 87);
this.libationFilesSelectControl.TabIndex = 1; this.libationFilesSelectControl.TabIndex = 1;
// //
// LibationFilesDialog // LibationFilesDialog
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(933, 158); this.ClientSize = new System.Drawing.Size(933, 164);
this.Controls.Add(this.libationFilesSelectControl); this.Controls.Add(this.libationFilesSelectControl);
this.Controls.Add(this.cancelBtn); this.Controls.Add(this.cancelBtn);
this.Controls.Add(this.saveBtn); this.Controls.Add(this.saveBtn);

View File

@ -33,11 +33,11 @@
this.saveBtn = new System.Windows.Forms.Button(); this.saveBtn = new System.Windows.Forms.Button();
this.cancelBtn = new System.Windows.Forms.Button(); this.cancelBtn = new System.Windows.Forms.Button();
this.advancedSettingsGb = new System.Windows.Forms.GroupBox(); this.advancedSettingsGb = new System.Windows.Forms.GroupBox();
this.logsBtn = new System.Windows.Forms.Button();
this.convertLossyRb = new System.Windows.Forms.RadioButton(); this.convertLossyRb = new System.Windows.Forms.RadioButton();
this.convertLosslessRb = new System.Windows.Forms.RadioButton(); this.convertLosslessRb = new System.Windows.Forms.RadioButton();
this.inProgressSelectControl = new LibationWinForms.Dialogs.DirectorySelectControl(); this.inProgressSelectControl = new LibationWinForms.Dialogs.DirectorySelectControl();
this.allowLibationFixupCbox = new System.Windows.Forms.CheckBox(); this.allowLibationFixupCbox = new System.Windows.Forms.CheckBox();
this.logsBtn = new System.Windows.Forms.Button();
this.booksSelectControl = new LibationWinForms.Dialogs.DirectoryOrCustomSelectControl(); this.booksSelectControl = new LibationWinForms.Dialogs.DirectoryOrCustomSelectControl();
this.booksGb = new System.Windows.Forms.GroupBox(); this.booksGb = new System.Windows.Forms.GroupBox();
this.loggingLevelLbl = new System.Windows.Forms.Label(); this.loggingLevelLbl = new System.Windows.Forms.Label();
@ -69,7 +69,7 @@
// saveBtn // saveBtn
// //
this.saveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.saveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.saveBtn.Location = new System.Drawing.Point(714, 409); this.saveBtn.Location = new System.Drawing.Point(714, 419);
this.saveBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.saveBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.saveBtn.Name = "saveBtn"; this.saveBtn.Name = "saveBtn";
this.saveBtn.Size = new System.Drawing.Size(88, 27); this.saveBtn.Size = new System.Drawing.Size(88, 27);
@ -82,7 +82,7 @@
// //
this.cancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.cancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelBtn.Location = new System.Drawing.Point(832, 409); this.cancelBtn.Location = new System.Drawing.Point(832, 419);
this.cancelBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.cancelBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.cancelBtn.Name = "cancelBtn"; this.cancelBtn.Name = "cancelBtn";
this.cancelBtn.Size = new System.Drawing.Size(88, 27); this.cancelBtn.Size = new System.Drawing.Size(88, 27);
@ -100,25 +100,15 @@
this.advancedSettingsGb.Controls.Add(this.inProgressSelectControl); this.advancedSettingsGb.Controls.Add(this.inProgressSelectControl);
this.advancedSettingsGb.Controls.Add(this.allowLibationFixupCbox); this.advancedSettingsGb.Controls.Add(this.allowLibationFixupCbox);
this.advancedSettingsGb.Controls.Add(this.inProgressDescLbl); this.advancedSettingsGb.Controls.Add(this.inProgressDescLbl);
this.advancedSettingsGb.Location = new System.Drawing.Point(12, 170); this.advancedSettingsGb.Location = new System.Drawing.Point(12, 176);
this.advancedSettingsGb.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.advancedSettingsGb.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.advancedSettingsGb.Name = "advancedSettingsGb"; this.advancedSettingsGb.Name = "advancedSettingsGb";
this.advancedSettingsGb.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); this.advancedSettingsGb.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.advancedSettingsGb.Size = new System.Drawing.Size(908, 226); this.advancedSettingsGb.Size = new System.Drawing.Size(908, 232);
this.advancedSettingsGb.TabIndex = 5; this.advancedSettingsGb.TabIndex = 5;
this.advancedSettingsGb.TabStop = false; this.advancedSettingsGb.TabStop = false;
this.advancedSettingsGb.Text = "Advanced settings for control freaks"; this.advancedSettingsGb.Text = "Advanced settings for control freaks";
// //
// logsBtn
//
this.logsBtn.Location = new System.Drawing.Point(262, 141);
this.logsBtn.Name = "logsBtn";
this.logsBtn.Size = new System.Drawing.Size(132, 23);
this.logsBtn.TabIndex = 4;
this.logsBtn.Text = "Open log folder";
this.logsBtn.UseVisualStyleBackColor = true;
this.logsBtn.Click += new System.EventHandler(this.logsBtn_Click);
//
// convertLossyRb // convertLossyRb
// //
this.convertLossyRb.AutoSize = true; this.convertLossyRb.AutoSize = true;
@ -147,7 +137,7 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.inProgressSelectControl.Location = new System.Drawing.Point(10, 175); this.inProgressSelectControl.Location = new System.Drawing.Point(10, 175);
this.inProgressSelectControl.Name = "inProgressSelectControl"; this.inProgressSelectControl.Name = "inProgressSelectControl";
this.inProgressSelectControl.Size = new System.Drawing.Size(552, 46); this.inProgressSelectControl.Size = new System.Drawing.Size(552, 52);
this.inProgressSelectControl.TabIndex = 2; this.inProgressSelectControl.TabIndex = 2;
// //
// allowLibationFixupCbox // allowLibationFixupCbox
@ -163,13 +153,23 @@
this.allowLibationFixupCbox.UseVisualStyleBackColor = true; this.allowLibationFixupCbox.UseVisualStyleBackColor = true;
this.allowLibationFixupCbox.CheckedChanged += new System.EventHandler(this.allowLibationFixupCbox_CheckedChanged); this.allowLibationFixupCbox.CheckedChanged += new System.EventHandler(this.allowLibationFixupCbox_CheckedChanged);
// //
// logsBtn
//
this.logsBtn.Location = new System.Drawing.Point(262, 147);
this.logsBtn.Name = "logsBtn";
this.logsBtn.Size = new System.Drawing.Size(132, 23);
this.logsBtn.TabIndex = 4;
this.logsBtn.Text = "Open log folder";
this.logsBtn.UseVisualStyleBackColor = true;
this.logsBtn.Click += new System.EventHandler(this.logsBtn_Click);
//
// booksSelectControl // booksSelectControl
// //
this.booksSelectControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.booksSelectControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.booksSelectControl.Location = new System.Drawing.Point(7, 37); this.booksSelectControl.Location = new System.Drawing.Point(7, 37);
this.booksSelectControl.Name = "booksSelectControl"; this.booksSelectControl.Name = "booksSelectControl";
this.booksSelectControl.Size = new System.Drawing.Size(895, 81); this.booksSelectControl.Size = new System.Drawing.Size(895, 87);
this.booksSelectControl.TabIndex = 1; this.booksSelectControl.TabIndex = 1;
// //
// booksGb // booksGb
@ -180,7 +180,7 @@
this.booksGb.Controls.Add(this.booksLocationDescLbl); this.booksGb.Controls.Add(this.booksLocationDescLbl);
this.booksGb.Location = new System.Drawing.Point(12, 12); this.booksGb.Location = new System.Drawing.Point(12, 12);
this.booksGb.Name = "booksGb"; this.booksGb.Name = "booksGb";
this.booksGb.Size = new System.Drawing.Size(908, 123); this.booksGb.Size = new System.Drawing.Size(908, 129);
this.booksGb.TabIndex = 1; this.booksGb.TabIndex = 1;
this.booksGb.TabStop = false; this.booksGb.TabStop = false;
this.booksGb.Text = "Books location"; this.booksGb.Text = "Books location";
@ -188,7 +188,7 @@
// loggingLevelLbl // loggingLevelLbl
// //
this.loggingLevelLbl.AutoSize = true; this.loggingLevelLbl.AutoSize = true;
this.loggingLevelLbl.Location = new System.Drawing.Point(12, 144); this.loggingLevelLbl.Location = new System.Drawing.Point(12, 150);
this.loggingLevelLbl.Name = "loggingLevelLbl"; this.loggingLevelLbl.Name = "loggingLevelLbl";
this.loggingLevelLbl.Size = new System.Drawing.Size(78, 15); this.loggingLevelLbl.Size = new System.Drawing.Size(78, 15);
this.loggingLevelLbl.TabIndex = 2; this.loggingLevelLbl.TabIndex = 2;
@ -198,7 +198,7 @@
// //
this.loggingLevelCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.loggingLevelCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.loggingLevelCb.FormattingEnabled = true; this.loggingLevelCb.FormattingEnabled = true;
this.loggingLevelCb.Location = new System.Drawing.Point(96, 141); this.loggingLevelCb.Location = new System.Drawing.Point(96, 147);
this.loggingLevelCb.Name = "loggingLevelCb"; this.loggingLevelCb.Name = "loggingLevelCb";
this.loggingLevelCb.Size = new System.Drawing.Size(129, 23); this.loggingLevelCb.Size = new System.Drawing.Size(129, 23);
this.loggingLevelCb.TabIndex = 3; this.loggingLevelCb.TabIndex = 3;
@ -209,7 +209,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelBtn; this.CancelButton = this.cancelBtn;
this.ClientSize = new System.Drawing.Size(933, 450); this.ClientSize = new System.Drawing.Size(933, 462);
this.Controls.Add(this.logsBtn); this.Controls.Add(this.logsBtn);
this.Controls.Add(this.loggingLevelCb); this.Controls.Add(this.loggingLevelCb);
this.Controls.Add(this.loggingLevelLbl); this.Controls.Add(this.loggingLevelLbl);