From 505751e038fe7c00201e5d439a4f7738d26663e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E9=9D=99=E7=9A=84=E6=8D=82=E4=BD=8F=E8=80=B3?= =?UTF-8?q?=E6=9C=B5?= <34530046+msglog@users.noreply.github.com> Date: Tue, 23 Jan 2024 11:30:08 +0800 Subject: [PATCH 1/5] Update ConnectionForm.cs Facilitates a clearer understanding of the rapid creation of new database files --- LiteDB.Studio/Forms/ConnectionForm.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/LiteDB.Studio/Forms/ConnectionForm.cs b/LiteDB.Studio/Forms/ConnectionForm.cs index 2f9640d..908635e 100644 --- a/LiteDB.Studio/Forms/ConnectionForm.cs +++ b/LiteDB.Studio/Forms/ConnectionForm.cs @@ -1,14 +1,12 @@ -using System; +using ICSharpCode.TextEditor.Util; + +using System; using System.Collections.Generic; -using System.ComponentModel; using System.Data; -using System.Drawing; using System.Globalization; +using System.IO; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; -using ICSharpCode.TextEditor.Util; namespace LiteDB.Studio.Forms { @@ -28,7 +26,7 @@ public ConnectionForm(ConnectionString cs) chkUpgrade.Checked = cs.Upgrade; - cmbCulture.DataSource = + cmbCulture.DataSource = CultureInfo.GetCultures(CultureTypes.AllCultures) .Select(x => x.LCID) .Distinct() @@ -129,5 +127,12 @@ private void ConnectionForm_DragDrop(object sender, DragEventArgs e) txtFilename.Text = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString(); } } + + private void buttonBuildDefaultFileName_Click(object sender, EventArgs e) + { + var fileName = $"{DateTime.Now:yyyyMMddHHmmss}.db"; + var fullFileNamePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "dbFile", fileName); + txtFilename.Text = fullFileNamePath; + } } } From 4af4286fa03ea12da351391d18cd8c935c266644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E9=9D=99=E7=9A=84=E6=8D=82=E4=BD=8F=E8=80=B3?= =?UTF-8?q?=E6=9C=B5?= <34530046+msglog@users.noreply.github.com> Date: Tue, 23 Jan 2024 11:30:44 +0800 Subject: [PATCH 2/5] Update ConnectionForm.Designer.cs Facilitates a clearer understanding of the rapid creation of new database files --- .../Forms/ConnectionForm.Designer.cs | 75 +++++++++++-------- 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/LiteDB.Studio/Forms/ConnectionForm.Designer.cs b/LiteDB.Studio/Forms/ConnectionForm.Designer.cs index c5d3cd4..0ab0fea 100644 --- a/LiteDB.Studio/Forms/ConnectionForm.Designer.cs +++ b/LiteDB.Studio/Forms/ConnectionForm.Designer.cs @@ -1,4 +1,4 @@ -namespace LiteDB.Studio.Forms +namespace LiteDB.Studio.Forms { partial class ConnectionForm { @@ -29,7 +29,7 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.groupBoxConnectionMode = new System.Windows.Forms.GroupBox(); this.radModeShared = new System.Windows.Forms.RadioButton(); this.radModeDirect = new System.Windows.Forms.RadioButton(); this.btnOK = new System.Windows.Forms.Button(); @@ -49,28 +49,29 @@ private void InitializeComponent() this.txtPassword = new System.Windows.Forms.TextBox(); this.chkReadonly = new System.Windows.Forms.CheckBox(); this.label3 = new System.Windows.Forms.Label(); - this.groupBox1.SuspendLayout(); + this.buttonBuildDefaultFileName = new System.Windows.Forms.Button(); + this.groupBoxConnectionMode.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); this.SuspendLayout(); // - // groupBox1 + // groupBoxConnectionMode // - this.groupBox1.Controls.Add(this.radModeShared); - this.groupBox1.Controls.Add(this.radModeDirect); - this.groupBox1.Location = new System.Drawing.Point(12, 11); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(569, 60); - this.groupBox1.TabIndex = 27; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Connection Mode"; + this.groupBoxConnectionMode.Controls.Add(this.radModeShared); + this.groupBoxConnectionMode.Controls.Add(this.radModeDirect); + this.groupBoxConnectionMode.Location = new System.Drawing.Point(12, 11); + this.groupBoxConnectionMode.Name = "groupBoxConnectionMode"; + this.groupBoxConnectionMode.Size = new System.Drawing.Size(569, 60); + this.groupBoxConnectionMode.TabIndex = 27; + this.groupBoxConnectionMode.TabStop = false; + this.groupBoxConnectionMode.Text = "Connection Mode"; // // radModeShared // this.radModeShared.AutoSize = true; this.radModeShared.Location = new System.Drawing.Point(151, 25); this.radModeShared.Name = "radModeShared"; - this.radModeShared.Size = new System.Drawing.Size(76, 24); + this.radModeShared.Size = new System.Drawing.Size(92, 29); this.radModeShared.TabIndex = 10; this.radModeShared.Text = "Shared"; this.radModeShared.UseVisualStyleBackColor = true; @@ -81,7 +82,7 @@ private void InitializeComponent() this.radModeDirect.Checked = true; this.radModeDirect.Location = new System.Drawing.Point(30, 25); this.radModeDirect.Name = "radModeDirect"; - this.radModeDirect.Size = new System.Drawing.Size(70, 24); + this.radModeDirect.Size = new System.Drawing.Size(83, 29); this.radModeDirect.TabIndex = 9; this.radModeDirect.TabStop = true; this.radModeDirect.Text = "Direct"; @@ -116,12 +117,13 @@ private void InitializeComponent() // this.txtInitialSize.Location = new System.Drawing.Point(151, 61); this.txtInitialSize.Name = "txtInitialSize"; - this.txtInitialSize.Size = new System.Drawing.Size(70, 27); + this.txtInitialSize.Size = new System.Drawing.Size(70, 31); this.txtInitialSize.TabIndex = 24; this.txtInitialSize.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // // groupBox2 // + this.groupBox2.Controls.Add(this.buttonBuildDefaultFileName); this.groupBox2.Controls.Add(this.btnOpen); this.groupBox2.Controls.Add(this.txtFilename); this.groupBox2.Location = new System.Drawing.Point(12, 81); @@ -135,7 +137,7 @@ private void InitializeComponent() // this.txtFilename.Location = new System.Drawing.Point(19, 28); this.txtFilename.Name = "txtFilename"; - this.txtFilename.Size = new System.Drawing.Size(502, 27); + this.txtFilename.Size = new System.Drawing.Size(502, 31); this.txtFilename.TabIndex = 2; // // groupBox3 @@ -162,7 +164,7 @@ private void InitializeComponent() this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(274, 103); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(15, 20); + this.label4.Size = new System.Drawing.Size(19, 25); this.label4.TabIndex = 38; this.label4.Text = "/"; // @@ -174,7 +176,7 @@ private void InitializeComponent() this.cmbSort.FormattingEnabled = true; this.cmbSort.Location = new System.Drawing.Point(292, 100); this.cmbSort.Name = "cmbSort"; - this.cmbSort.Size = new System.Drawing.Size(117, 28); + this.cmbSort.Size = new System.Drawing.Size(117, 33); this.cmbSort.TabIndex = 37; // // label2 @@ -182,7 +184,7 @@ private void InitializeComponent() this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(18, 103); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(72, 20); + this.label2.Size = new System.Drawing.Size(86, 25); this.label2.TabIndex = 36; this.label2.Text = "Collation:"; // @@ -194,7 +196,7 @@ private void InitializeComponent() this.cmbCulture.FormattingEnabled = true; this.cmbCulture.Location = new System.Drawing.Point(151, 100); this.cmbCulture.Name = "cmbCulture"; - this.cmbCulture.Size = new System.Drawing.Size(117, 28); + this.cmbCulture.Size = new System.Drawing.Size(117, 33); this.cmbCulture.TabIndex = 35; // // chkUpgrade @@ -202,7 +204,7 @@ private void InitializeComponent() this.chkUpgrade.AutoSize = true; this.chkUpgrade.Location = new System.Drawing.Point(21, 175); this.chkUpgrade.Name = "chkUpgrade"; - this.chkUpgrade.Size = new System.Drawing.Size(269, 24); + this.chkUpgrade.Size = new System.Drawing.Size(319, 29); this.chkUpgrade.TabIndex = 33; this.chkUpgrade.Text = "Upgrade from LiteDB v4 (if needed)"; // @@ -211,7 +213,7 @@ private void InitializeComponent() this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(18, 25); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(73, 20); + this.label1.Size = new System.Drawing.Size(91, 25); this.label1.TabIndex = 32; this.label1.Text = "Password:"; // @@ -220,7 +222,7 @@ private void InitializeComponent() this.txtPassword.Location = new System.Drawing.Point(151, 22); this.txtPassword.Name = "txtPassword"; this.txtPassword.PasswordChar = '*'; - this.txtPassword.Size = new System.Drawing.Size(404, 27); + this.txtPassword.Size = new System.Drawing.Size(404, 31); this.txtPassword.TabIndex = 4; // // chkReadonly @@ -228,7 +230,7 @@ private void InitializeComponent() this.chkReadonly.AutoSize = true; this.chkReadonly.Location = new System.Drawing.Point(21, 139); this.chkReadonly.Name = "chkReadonly"; - this.chkReadonly.Size = new System.Drawing.Size(97, 24); + this.chkReadonly.Size = new System.Drawing.Size(116, 29); this.chkReadonly.TabIndex = 27; this.chkReadonly.Text = "Read only"; this.chkReadonly.UseVisualStyleBackColor = true; @@ -239,19 +241,29 @@ private void InitializeComponent() this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(18, 64); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(116, 20); + this.label3.Size = new System.Drawing.Size(135, 25); this.label3.TabIndex = 30; this.label3.Text = "Initial Size (MB):"; // + // buttonBuildDefaultFileName + // + this.buttonBuildDefaultFileName.Location = new System.Drawing.Point(318, 0); + this.buttonBuildDefaultFileName.Name = "buttonBuildDefaultFileName"; + this.buttonBuildDefaultFileName.Size = new System.Drawing.Size(203, 23); + this.buttonBuildDefaultFileName.TabIndex = 4; + this.buttonBuildDefaultFileName.Text = "Build Default File Name"; + this.buttonBuildDefaultFileName.UseVisualStyleBackColor = true; + this.buttonBuildDefaultFileName.Click += new System.EventHandler(this.buttonBuildDefaultFileName_Click); + // // ConnectionForm // this.AllowDrop = true; - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); + this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(596, 436); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox2); - this.Controls.Add(this.groupBox1); + this.Controls.Add(this.groupBoxConnectionMode); this.Controls.Add(this.btnOK); this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; @@ -263,8 +275,8 @@ private void InitializeComponent() this.Text = "Connection Manager"; this.DragDrop += new System.Windows.Forms.DragEventHandler(this.ConnectionForm_DragDrop); this.DragEnter += new System.Windows.Forms.DragEventHandler(this.ConnectionForm_DragEnter); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); + this.groupBoxConnectionMode.ResumeLayout(false); + this.groupBoxConnectionMode.PerformLayout(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.groupBox3.ResumeLayout(false); @@ -274,7 +286,7 @@ private void InitializeComponent() } #endregion - private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.GroupBox groupBoxConnectionMode; private System.Windows.Forms.RadioButton radModeDirect; private System.Windows.Forms.Button btnOK; private System.Windows.Forms.OpenFileDialog openFileDialog; @@ -294,5 +306,6 @@ private void InitializeComponent() private System.Windows.Forms.Label label2; private System.Windows.Forms.ComboBox cmbCulture; private System.Windows.Forms.Label label4; + private System.Windows.Forms.Button buttonBuildDefaultFileName; } -} \ No newline at end of file +} From 13c98e8661f7f8299d015a00e6121d7b2e2234a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E9=9D=99=E7=9A=84=E6=8D=82=E4=BD=8F=E8=80=B3?= =?UTF-8?q?=E6=9C=B5?= <34530046+msglog@users.noreply.github.com> Date: Tue, 23 Jan 2024 16:26:14 +0800 Subject: [PATCH 3/5] Update ConnectionForm.Designer.cs When modifying the default open data, open the file directory --- LiteDB.Studio/Forms/ConnectionForm.Designer.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/LiteDB.Studio/Forms/ConnectionForm.Designer.cs b/LiteDB.Studio/Forms/ConnectionForm.Designer.cs index 0ab0fea..0eab152 100644 --- a/LiteDB.Studio/Forms/ConnectionForm.Designer.cs +++ b/LiteDB.Studio/Forms/ConnectionForm.Designer.cs @@ -34,6 +34,7 @@ private void InitializeComponent() this.radModeDirect = new System.Windows.Forms.RadioButton(); this.btnOK = new System.Windows.Forms.Button(); this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); + this.openFileDialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory; this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.btnOpen = new System.Windows.Forms.Button(); this.txtInitialSize = new System.Windows.Forms.TextBox(); From 6238c1aa365686d491f1bfd56a6450e3d9ecf997 Mon Sep 17 00:00:00 2001 From: "gang.dong" Date: Thu, 25 Jan 2024 11:14:19 +0800 Subject: [PATCH 4/5] fix system using --- LiteDB.Studio/Forms/ConnectionForm.Designer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LiteDB.Studio/Forms/ConnectionForm.Designer.cs b/LiteDB.Studio/Forms/ConnectionForm.Designer.cs index 0eab152..a34e2b0 100644 --- a/LiteDB.Studio/Forms/ConnectionForm.Designer.cs +++ b/LiteDB.Studio/Forms/ConnectionForm.Designer.cs @@ -34,7 +34,7 @@ private void InitializeComponent() this.radModeDirect = new System.Windows.Forms.RadioButton(); this.btnOK = new System.Windows.Forms.Button(); this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); - this.openFileDialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory; + this.openFileDialog.InitialDirectory = System.AppDomain.CurrentDomain.BaseDirectory; this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.btnOpen = new System.Windows.Forms.Button(); this.txtInitialSize = new System.Windows.Forms.TextBox(); From c81bcd34637659178c6dbc8a29273c683f9ed30a Mon Sep 17 00:00:00 2001 From: "gang.dong" Date: Thu, 25 Jan 2024 11:41:07 +0800 Subject: [PATCH 5/5] add dbFilePath=AppDomain.CurrentDomain.BaseDirectory --- LiteDB.Studio/Forms/ConnectionForm.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LiteDB.Studio/Forms/ConnectionForm.cs b/LiteDB.Studio/Forms/ConnectionForm.cs index 908635e..045a882 100644 --- a/LiteDB.Studio/Forms/ConnectionForm.cs +++ b/LiteDB.Studio/Forms/ConnectionForm.cs @@ -131,7 +131,7 @@ private void ConnectionForm_DragDrop(object sender, DragEventArgs e) private void buttonBuildDefaultFileName_Click(object sender, EventArgs e) { var fileName = $"{DateTime.Now:yyyyMMddHHmmss}.db"; - var fullFileNamePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "dbFile", fileName); + var fullFileNamePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fileName); txtFilename.Text = fullFileNamePath; } }