diff --git a/SabreToolsUI/SabreToolsUI.Designer.cs b/SabreToolsUI/SabreToolsUI.Designer.cs index 45aff715..5d7c8c13 100644 --- a/SabreToolsUI/SabreToolsUI.Designer.cs +++ b/SabreToolsUI/SabreToolsUI.Designer.cs @@ -44,10 +44,10 @@ this.oldCheckBox = new System.Windows.Forms.CheckBox(); this.renameCheckBox = new System.Windows.Forms.CheckBox(); this.importDatLabel = new System.Windows.Forms.Label(); - this.fileOrFolderLabel = new System.Windows.Forms.Label(); this.importTextBox = new System.Windows.Forms.TextBox(); - this.exploreButton = new System.Windows.Forms.Button(); + this.fileButton = new System.Windows.Forms.Button(); this.importButton = new System.Windows.Forms.Button(); + this.folderButton = new System.Windows.Forms.Button(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -198,50 +198,51 @@ this.importDatLabel.TabIndex = 12; this.importDatLabel.Text = "Import DAT"; // - // fileOrFolderLabel - // - this.fileOrFolderLabel.AutoSize = true; - this.fileOrFolderLabel.Location = new System.Drawing.Point(15, 197); - this.fileOrFolderLabel.Name = "fileOrFolderLabel"; - this.fileOrFolderLabel.Size = new System.Drawing.Size(70, 13); - this.fileOrFolderLabel.TabIndex = 13; - this.fileOrFolderLabel.Text = "File or Folder:"; - // // importTextBox // - this.importTextBox.Location = new System.Drawing.Point(91, 194); + this.importTextBox.Location = new System.Drawing.Point(100, 201); this.importTextBox.Name = "importTextBox"; - this.importTextBox.Size = new System.Drawing.Size(264, 20); + this.importTextBox.Size = new System.Drawing.Size(405, 20); this.importTextBox.TabIndex = 14; // - // exploreButton + // fileButton // - this.exploreButton.Location = new System.Drawing.Point(361, 192); - this.exploreButton.Name = "exploreButton"; - this.exploreButton.Size = new System.Drawing.Size(58, 23); - this.exploreButton.TabIndex = 15; - this.exploreButton.Text = "Explore"; - this.exploreButton.UseVisualStyleBackColor = true; - this.exploreButton.Click += new System.EventHandler(this.exploreButton_Click); + this.fileButton.Location = new System.Drawing.Point(511, 199); + this.fileButton.Name = "fileButton"; + this.fileButton.Size = new System.Drawing.Size(33, 23); + this.fileButton.TabIndex = 15; + this.fileButton.Text = "File"; + this.fileButton.UseVisualStyleBackColor = true; + this.fileButton.Click += new System.EventHandler(this.fileButton_Click); // // importButton // - this.importButton.Location = new System.Drawing.Point(426, 192); + this.importButton.Location = new System.Drawing.Point(15, 199); this.importButton.Name = "importButton"; this.importButton.Size = new System.Drawing.Size(75, 23); this.importButton.TabIndex = 16; this.importButton.Text = "Import"; this.importButton.UseVisualStyleBackColor = true; // + // folderButton + // + this.folderButton.Location = new System.Drawing.Point(550, 199); + this.folderButton.Name = "folderButton"; + this.folderButton.Size = new System.Drawing.Size(46, 23); + this.folderButton.TabIndex = 17; + this.folderButton.Text = "Folder"; + this.folderButton.UseVisualStyleBackColor = true; + this.folderButton.Click += new System.EventHandler(this.folderButton_Click); + // // SabreToolsUI // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(681, 477); + this.Controls.Add(this.folderButton); this.Controls.Add(this.importButton); - this.Controls.Add(this.exploreButton); + this.Controls.Add(this.fileButton); this.Controls.Add(this.importTextBox); - this.Controls.Add(this.fileOrFolderLabel); this.Controls.Add(this.importDatLabel); this.Controls.Add(this.renameCheckBox); this.Controls.Add(this.oldCheckBox); @@ -281,10 +282,10 @@ private System.Windows.Forms.CheckBox oldCheckBox; private System.Windows.Forms.CheckBox renameCheckBox; private System.Windows.Forms.Label importDatLabel; - private System.Windows.Forms.Label fileOrFolderLabel; private System.Windows.Forms.TextBox importTextBox; - private System.Windows.Forms.Button exploreButton; + private System.Windows.Forms.Button fileButton; private System.Windows.Forms.Button importButton; + private System.Windows.Forms.Button folderButton; } } diff --git a/SabreToolsUI/SabreToolsUI.cs b/SabreToolsUI/SabreToolsUI.cs index 6c5be05e..088a90d5 100644 --- a/SabreToolsUI/SabreToolsUI.cs +++ b/SabreToolsUI/SabreToolsUI.cs @@ -74,25 +74,46 @@ namespace SabreTools Process.Start("DATabase.exe", "-l -ga"); } - private void exploreButton_Click(object sender, EventArgs e) + private void fileButton_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); // Set the proper starting folder if (importTextBox.Text != "") { - ofd.InitialDirectory = Path.GetDirectoryName(importTextBox.Text); + ofd.InitialDirectory = Path.GetDirectoryName(importTextBox.Text); } else { - ofd.InitialDirectory = Environment.CurrentDirectory; + ofd.InitialDirectory = Environment.CurrentDirectory; } - // Set the new folder, if applicable + // Set the new file, if applicable if (ofd.ShowDialog() == DialogResult.OK) { importTextBox.Text = ofd.FileName; } } + + private void folderButton_Click(object sender, EventArgs e) + { + FolderBrowserDialog fbd = new FolderBrowserDialog(); + + // Set the proper starting folder + if (importTextBox.Text != "") + { + fbd.SelectedPath = Path.GetDirectoryName(importTextBox.Text); + } + else + { + fbd.SelectedPath = Environment.CurrentDirectory; + } + + // Set the new folder, if applicable + if (fbd.ShowDialog() == DialogResult.OK) + { + importTextBox.Text = fbd.SelectedPath; + } + } } }