Generate DAT and Generate All work

Check boxes not hooked up yet
This commit is contained in:
Matt Nadareski
2016-03-29 21:46:27 -07:00
parent ac03051e04
commit 3ef696b48c
3 changed files with 78 additions and 65 deletions

View File

@@ -116,6 +116,8 @@ namespace SabreTools
if (_sources != "") if (_sources != "")
{ {
string query = "SELECT name FROM sources WHERE id in (" + _sources + ")"; string query = "SELECT name FROM sources WHERE id in (" + _sources + ")";
Console.WriteLine(query);
using (SQLiteConnection dbc = new SQLiteConnection(_connectionString)) using (SQLiteConnection dbc = new SQLiteConnection(_connectionString))
{ {
dbc.Open(); dbc.Open();

View File

@@ -34,15 +34,16 @@
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.label1 = new System.Windows.Forms.Label(); this.generateDatLabel = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.systemsLabel = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label(); this.systemsCheckedListBox = new System.Windows.Forms.CheckedListBox();
this.checkedListBox1 = new System.Windows.Forms.CheckedListBox(); this.sourcesCheckedListBox = new System.Windows.Forms.CheckedListBox();
this.checkedListBox2 = new System.Windows.Forms.CheckedListBox();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@@ -95,51 +96,41 @@
this.aboutToolStripMenuItem.Text = "About"; this.aboutToolStripMenuItem.Text = "About";
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
// //
// label1 // generateDatLabel
// //
this.label1.AutoSize = true; this.generateDatLabel.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.generateDatLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(12, 34); this.generateDatLabel.Location = new System.Drawing.Point(12, 34);
this.label1.Name = "label1"; this.generateDatLabel.Name = "generateDatLabel";
this.label1.Size = new System.Drawing.Size(112, 17); this.generateDatLabel.Size = new System.Drawing.Size(112, 17);
this.label1.TabIndex = 1; this.generateDatLabel.TabIndex = 1;
this.label1.Text = "Generate DAT"; this.generateDatLabel.Text = "Generate DAT";
// //
// label2 // systemsLabel
// //
this.label2.AutoSize = true; this.systemsLabel.AutoSize = true;
this.label2.Location = new System.Drawing.Point(15, 65); this.systemsLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Name = "label2"; this.systemsLabel.Location = new System.Drawing.Point(15, 65);
this.label2.Size = new System.Drawing.Size(0, 13); this.systemsLabel.Name = "systemsLabel";
this.label2.TabIndex = 2; this.systemsLabel.Size = new System.Drawing.Size(56, 15);
this.systemsLabel.TabIndex = 3;
this.systemsLabel.Text = "Systems:";
// //
// label3 // systemsCheckedListBox
// //
this.label3.AutoSize = true; this.systemsCheckedListBox.FormattingEnabled = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.systemsCheckedListBox.Location = new System.Drawing.Point(77, 65);
this.label3.Location = new System.Drawing.Point(15, 65); this.systemsCheckedListBox.Name = "systemsCheckedListBox";
this.label3.Name = "label3"; this.systemsCheckedListBox.Size = new System.Drawing.Size(260, 34);
this.label3.Size = new System.Drawing.Size(56, 15); this.systemsCheckedListBox.TabIndex = 4;
this.label3.TabIndex = 3;
this.label3.Text = "Systems:";
// //
// checkedListBox1 // sourcesCheckedListBox
// //
this.checkedListBox1.FormattingEnabled = true; this.sourcesCheckedListBox.FormattingEnabled = true;
this.checkedListBox1.Items.AddRange(GetAllSystems()); this.sourcesCheckedListBox.Location = new System.Drawing.Point(415, 65);
this.checkedListBox1.Location = new System.Drawing.Point(77, 65); this.sourcesCheckedListBox.Name = "sourcesCheckedListBox";
this.checkedListBox1.Name = "checkedListBox1"; this.sourcesCheckedListBox.Size = new System.Drawing.Size(244, 34);
this.checkedListBox1.Size = new System.Drawing.Size(260, 34); this.sourcesCheckedListBox.TabIndex = 7;
this.checkedListBox1.TabIndex = 4;
//
// checkedListBox2
//
this.checkedListBox2.FormattingEnabled = true;
this.checkedListBox2.Items.AddRange(GetAllSources());
this.checkedListBox2.Location = new System.Drawing.Point(415, 65);
this.checkedListBox2.Name = "checkedListBox2";
this.checkedListBox2.Size = new System.Drawing.Size(244, 34);
this.checkedListBox2.TabIndex = 7;
// //
// label4 // label4
// //
@@ -161,7 +152,7 @@
// //
// button1 // button1
// //
this.button1.Location = new System.Drawing.Point(18, 107); this.button1.Location = new System.Drawing.Point(18, 145);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23); this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 8; this.button1.TabIndex = 8;
@@ -171,7 +162,7 @@
// //
// button2 // button2
// //
this.button2.Location = new System.Drawing.Point(100, 107); this.button2.Location = new System.Drawing.Point(100, 145);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(97, 23); this.button2.Size = new System.Drawing.Size(97, 23);
this.button2.TabIndex = 9; this.button2.TabIndex = 9;
@@ -179,20 +170,43 @@
this.button2.UseVisualStyleBackColor = true; this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click); this.button2.Click += new System.EventHandler(this.button2_Click);
// //
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(18, 105);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(129, 17);
this.checkBox1.TabIndex = 10;
this.checkBox1.Text = "Use RomVault Format";
this.checkBox1.UseVisualStyleBackColor = true;
//
// checkBox2
//
this.checkBox2.AutoSize = true;
this.checkBox2.Checked = true;
this.checkBox2.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox2.Location = new System.Drawing.Point(154, 105);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(102, 17);
this.checkBox2.TabIndex = 11;
this.checkBox2.Text = "Rename Games";
this.checkBox2.UseVisualStyleBackColor = true;
//
// SabreToolsUI // SabreToolsUI
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(681, 477); this.ClientSize = new System.Drawing.Size(681, 477);
this.Controls.Add(this.checkBox2);
this.Controls.Add(this.checkBox1);
this.Controls.Add(this.button2); this.Controls.Add(this.button2);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
this.Controls.Add(this.checkedListBox2); this.Controls.Add(this.sourcesCheckedListBox);
this.Controls.Add(this.label4); this.Controls.Add(this.label4);
this.Controls.Add(this.label5); this.Controls.Add(this.label5);
this.Controls.Add(this.checkedListBox1); this.Controls.Add(this.systemsCheckedListBox);
this.Controls.Add(this.label3); this.Controls.Add(this.systemsLabel);
this.Controls.Add(this.label2); this.Controls.Add(this.generateDatLabel);
this.Controls.Add(this.label1);
this.Controls.Add(this.menuStrip1); this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1; this.MainMenuStrip = this.menuStrip1;
this.Name = "SabreToolsUI"; this.Name = "SabreToolsUI";
@@ -212,15 +226,16 @@
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label generateDatLabel;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label systemsLabel;
private System.Windows.Forms.Label label3; private System.Windows.Forms.CheckedListBox systemsCheckedListBox;
private System.Windows.Forms.CheckedListBox checkedListBox1; private System.Windows.Forms.CheckedListBox sourcesCheckedListBox;
private System.Windows.Forms.CheckedListBox checkedListBox2;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button2;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.CheckBox checkBox2;
} }
} }

View File

@@ -108,32 +108,28 @@ ORDER BY sources.name COLLATE NOCASE";
string systems = ""; string systems = "";
string sources = ""; string sources = "";
CheckedListBox.CheckedItemCollection cil = this.checkedListBox1.CheckedItems; CheckedListBox.CheckedItemCollection cil = this.systemsCheckedListBox.CheckedItems;
Console.WriteLine(cil.Count);
foreach (object ci in cil) foreach (object ci in cil)
{ {
string id = Regex.Match(ci.ToString(), @".*? \((.*?)\)").Groups[1].Value; string id = Regex.Match(ci.ToString(), @".*? \((.*?)\)").Groups[1].Value;
systems += (systems == "" ? id : "," + id); systems += (systems == "" ? id : "," + id);
Console.WriteLine(systems);
} }
cil = this.checkedListBox2.CheckedItems; cil = this.sourcesCheckedListBox.CheckedItems;
Console.WriteLine(cil.Count);
foreach (object ci in cil) foreach (object ci in cil)
{ {
string id = Regex.Match(ci.ToString(), @".*? \((.*?)\)").Groups[1].Value; string id = Regex.Match(ci.ToString(), @".*? \((.*?)\)").Groups[1].Value;
sources += (sources == "" ? id : "," + id); sources += (sources == "" ? id : "," + id);
Console.WriteLine(systems);
} }
Process.Start("DATabase.exe", "-g" + (systems != "" ? " systems=" + systems : "") + (sources != "" ? " sources=" + sources : "")); Process.Start("DATabase.exe", "-l -g" + (systems != "" ? " system=" + systems : "") + (sources != "" ? " source=" + sources : ""));
} }
private void button2_Click(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e)
{ {
Process.Start("DATabase.exe", "-ga"); Process.Start("DATabase.exe", "-l -ga");
} }
} }
} }