From 206890b8f373aca026a9bc2d938fbb5d5430640f Mon Sep 17 00:00:00 2001 From: Robert McRackan Date: Wed, 21 Jul 2021 14:12:35 -0400 Subject: [PATCH] settings folders need read-only textbox --- FileManager/Configuration.cs | 7 ++-- LibationLauncher/LibationLauncher.csproj | 2 +- ...DirectoryOrCustomSelectControl.Designer.cs | 10 ++--- .../DirectorySelectControl.Designer.cs | 23 +++++----- .../Dialogs/DirectorySelectControl.cs | 2 +- .../Dialogs/LibationFilesDialog.Designer.cs | 4 +- .../Dialogs/SettingsDialog.Designer.cs | 42 +++++++++---------- 7 files changed, 46 insertions(+), 44 deletions(-) diff --git a/FileManager/Configuration.cs b/FileManager/Configuration.cs index 1d2ecd1d..20033fc6 100644 --- a/FileManager/Configuration.cs +++ b/FileManager/Configuration.cs @@ -222,17 +222,18 @@ namespace FileManager if (libationFilesPathCache is not null) 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(); + // 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). // This Set() enforces current LibationFiles every time we restart Libation or redirect LibationFiles var logPath = Path.Combine(LibationFiles, "Log.log"); SetWithJsonPath("Serilog.WriteTo[1].Args", "path", logPath, true); configuration?.Reload(); - persistentDictionary = new PersistentDictionary(SettingsFilePath); - return libationFilesPathCache; } } diff --git a/LibationLauncher/LibationLauncher.csproj b/LibationLauncher/LibationLauncher.csproj index 416907c5..c98c7b69 100644 --- a/LibationLauncher/LibationLauncher.csproj +++ b/LibationLauncher/LibationLauncher.csproj @@ -13,7 +13,7 @@ win-x64 - 5.3.1.1 + 5.3.2.1 diff --git a/LibationWinForms/Dialogs/DirectoryOrCustomSelectControl.Designer.cs b/LibationWinForms/Dialogs/DirectoryOrCustomSelectControl.Designer.cs index 7fc9170a..cea7e0b8 100644 --- a/LibationWinForms/Dialogs/DirectoryOrCustomSelectControl.Designer.cs +++ b/LibationWinForms/Dialogs/DirectoryOrCustomSelectControl.Designer.cs @@ -49,7 +49,7 @@ namespace LibationWinForms.Dialogs // customDirectoryRb // 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.Size = new System.Drawing.Size(14, 13); 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) | 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.Size = new System.Drawing.Size(588, 23); this.customTb.TabIndex = 3; @@ -68,7 +68,7 @@ namespace LibationWinForms.Dialogs // customBtn // 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.Size = new System.Drawing.Size(41, 27); this.customBtn.TabIndex = 4; @@ -82,7 +82,7 @@ namespace LibationWinForms.Dialogs | System.Windows.Forms.AnchorStyles.Right))); this.directorySelectControl.Location = new System.Drawing.Point(23, 0); 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; // // DirectoryOrCustomSelectControl @@ -95,7 +95,7 @@ namespace LibationWinForms.Dialogs this.Controls.Add(this.customDirectoryRb); this.Controls.Add(this.knownDirectoryRb); 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.ResumeLayout(false); this.PerformLayout(); diff --git a/LibationWinForms/Dialogs/DirectorySelectControl.Designer.cs b/LibationWinForms/Dialogs/DirectorySelectControl.Designer.cs index 9527062e..feff2dfc 100644 --- a/LibationWinForms/Dialogs/DirectorySelectControl.Designer.cs +++ b/LibationWinForms/Dialogs/DirectorySelectControl.Designer.cs @@ -30,7 +30,7 @@ namespace LibationWinForms.Dialogs private void InitializeComponent() { this.directoryComboBox = new System.Windows.Forms.ComboBox(); - this.label1 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // directoryComboBox @@ -45,23 +45,24 @@ namespace LibationWinForms.Dialogs this.directoryComboBox.TabIndex = 0; this.directoryComboBox.SelectedIndexChanged += new System.EventHandler(this.directoryComboBox_SelectedIndexChanged); // - // label1 + // textBox1 // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(0, 26); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(97, 15); - this.label1.TabIndex = 1; - this.label1.Text = "Select a directory"; + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox1.Location = new System.Drawing.Point(0, 29); + this.textBox1.Name = "textBox1"; + this.textBox1.ReadOnly = true; + this.textBox1.Size = new System.Drawing.Size(647, 23); + this.textBox1.TabIndex = 1; // // DirectorySelectControl // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.label1); + this.Controls.Add(this.textBox1); this.Controls.Add(this.directoryComboBox); 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.ResumeLayout(false); this.PerformLayout(); @@ -71,6 +72,6 @@ namespace LibationWinForms.Dialogs #endregion private System.Windows.Forms.ComboBox directoryComboBox; - private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox1; } } diff --git a/LibationWinForms/Dialogs/DirectorySelectControl.cs b/LibationWinForms/Dialogs/DirectorySelectControl.cs index 4555e5b0..ab8def7a 100644 --- a/LibationWinForms/Dialogs/DirectorySelectControl.cs +++ b/LibationWinForms/Dialogs/DirectorySelectControl.cs @@ -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; } } diff --git a/LibationWinForms/Dialogs/LibationFilesDialog.Designer.cs b/LibationWinForms/Dialogs/LibationFilesDialog.Designer.cs index 91204087..4161d938 100644 --- a/LibationWinForms/Dialogs/LibationFilesDialog.Designer.cs +++ b/LibationWinForms/Dialogs/LibationFilesDialog.Designer.cs @@ -75,14 +75,14 @@ | System.Windows.Forms.AnchorStyles.Right))); this.libationFilesSelectControl.Location = new System.Drawing.Point(14, 28); 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; // // LibationFilesDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); 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.cancelBtn); this.Controls.Add(this.saveBtn); diff --git a/LibationWinForms/Dialogs/SettingsDialog.Designer.cs b/LibationWinForms/Dialogs/SettingsDialog.Designer.cs index b7422978..c58b75ce 100644 --- a/LibationWinForms/Dialogs/SettingsDialog.Designer.cs +++ b/LibationWinForms/Dialogs/SettingsDialog.Designer.cs @@ -33,11 +33,11 @@ this.saveBtn = new System.Windows.Forms.Button(); this.cancelBtn = new System.Windows.Forms.Button(); this.advancedSettingsGb = new System.Windows.Forms.GroupBox(); - this.logsBtn = new System.Windows.Forms.Button(); this.convertLossyRb = new System.Windows.Forms.RadioButton(); this.convertLosslessRb = new System.Windows.Forms.RadioButton(); this.inProgressSelectControl = new LibationWinForms.Dialogs.DirectorySelectControl(); this.allowLibationFixupCbox = new System.Windows.Forms.CheckBox(); + this.logsBtn = new System.Windows.Forms.Button(); this.booksSelectControl = new LibationWinForms.Dialogs.DirectoryOrCustomSelectControl(); this.booksGb = new System.Windows.Forms.GroupBox(); this.loggingLevelLbl = new System.Windows.Forms.Label(); @@ -69,7 +69,7 @@ // saveBtn // 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.Name = "saveBtn"; 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.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.Name = "cancelBtn"; this.cancelBtn.Size = new System.Drawing.Size(88, 27); @@ -100,25 +100,15 @@ this.advancedSettingsGb.Controls.Add(this.inProgressSelectControl); this.advancedSettingsGb.Controls.Add(this.allowLibationFixupCbox); 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.Name = "advancedSettingsGb"; 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.TabStop = false; 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 // this.convertLossyRb.AutoSize = true; @@ -147,7 +137,7 @@ | System.Windows.Forms.AnchorStyles.Right))); this.inProgressSelectControl.Location = new System.Drawing.Point(10, 175); 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; // // allowLibationFixupCbox @@ -163,13 +153,23 @@ this.allowLibationFixupCbox.UseVisualStyleBackColor = true; 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 // this.booksSelectControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.booksSelectControl.Location = new System.Drawing.Point(7, 37); 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; // // booksGb @@ -180,7 +180,7 @@ this.booksGb.Controls.Add(this.booksLocationDescLbl); this.booksGb.Location = new System.Drawing.Point(12, 12); 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.TabStop = false; this.booksGb.Text = "Books location"; @@ -188,7 +188,7 @@ // loggingLevelLbl // 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.Size = new System.Drawing.Size(78, 15); this.loggingLevelLbl.TabIndex = 2; @@ -198,7 +198,7 @@ // this.loggingLevelCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 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.Size = new System.Drawing.Size(129, 23); this.loggingLevelCb.TabIndex = 3; @@ -209,7 +209,7 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 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.loggingLevelCb); this.Controls.Add(this.loggingLevelLbl);