diff options
author | Elie Rodrigue <elie.rodrigue@nubik.ca> | 2017-05-09 18:16:18 +0300 |
---|---|---|
committer | Elie Rodrigue <elie.rodrigue@nubik.ca> | 2017-05-09 18:16:18 +0300 |
commit | 7174d150f4c2bed268dc9385d6d3cc4feb0f7af1 (patch) | |
tree | 2259f10257dfce788f8952a5994b056d1a6f3307 | |
parent | 7e13b4c8f0aa672b8f859585d8a5b966559f97eb (diff) |
Components
-rw-r--r-- | UI/Components/GameDetail.Designer.cs | 322 | ||||
-rw-r--r-- | UI/Components/GameDetail.cs | 142 | ||||
-rw-r--r-- | UI/Components/GameDetail.resx | 120 | ||||
-rw-r--r-- | UI/Components/GameSelecter.Designer.cs | 58 | ||||
-rw-r--r-- | UI/Components/GameSelecter.cs | 119 | ||||
-rw-r--r-- | UI/Components/GameSelecter.resx | 120 | ||||
-rw-r--r-- | hakchi_gui.csproj.user | 13 |
7 files changed, 894 insertions, 0 deletions
diff --git a/UI/Components/GameDetail.Designer.cs b/UI/Components/GameDetail.Designer.cs new file mode 100644 index 00000000..7f46a324 --- /dev/null +++ b/UI/Components/GameDetail.Designer.cs @@ -0,0 +1,322 @@ +namespace com.clusterrr.hakchi_gui.UI.Components +{ + partial class GameDetail + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.groupBoxOptions = new System.Windows.Forms.GroupBox(); + this.buttonShowGameGenieDatabase = new System.Windows.Forms.Button(); + this.maskedTextBoxReleaseDate = new System.Windows.Forms.MaskedTextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.textBoxGameGenie = new System.Windows.Forms.TextBox(); + this.label7 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.radioButtonTwoSim = new System.Windows.Forms.RadioButton(); + this.buttonGoogle = new System.Windows.Forms.Button(); + this.buttonBrowseImage = new System.Windows.Forms.Button(); + this.pictureBoxArt = new System.Windows.Forms.PictureBox(); + this.label4 = new System.Windows.Forms.Label(); + this.textBoxArguments = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.textBoxPublisher = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.radioButtonTwo = new System.Windows.Forms.RadioButton(); + this.radioButtonOne = new System.Windows.Forms.RadioButton(); + this.textBoxName = new System.Windows.Forms.TextBox(); + this.labelName = new System.Windows.Forms.Label(); + this.labelID = new System.Windows.Forms.Label(); + this.groupBoxOptions.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxArt)).BeginInit(); + this.SuspendLayout(); + // + // groupBoxOptions + // + this.groupBoxOptions.Controls.Add(this.buttonShowGameGenieDatabase); + this.groupBoxOptions.Controls.Add(this.maskedTextBoxReleaseDate); + this.groupBoxOptions.Controls.Add(this.label1); + this.groupBoxOptions.Controls.Add(this.textBoxGameGenie); + this.groupBoxOptions.Controls.Add(this.label7); + this.groupBoxOptions.Controls.Add(this.label6); + this.groupBoxOptions.Controls.Add(this.radioButtonTwoSim); + this.groupBoxOptions.Controls.Add(this.buttonGoogle); + this.groupBoxOptions.Controls.Add(this.buttonBrowseImage); + this.groupBoxOptions.Controls.Add(this.pictureBoxArt); + this.groupBoxOptions.Controls.Add(this.label4); + this.groupBoxOptions.Controls.Add(this.textBoxArguments); + this.groupBoxOptions.Controls.Add(this.label3); + this.groupBoxOptions.Controls.Add(this.textBoxPublisher); + this.groupBoxOptions.Controls.Add(this.label2); + this.groupBoxOptions.Controls.Add(this.radioButtonTwo); + this.groupBoxOptions.Controls.Add(this.radioButtonOne); + this.groupBoxOptions.Controls.Add(this.textBoxName); + this.groupBoxOptions.Controls.Add(this.labelName); + this.groupBoxOptions.Controls.Add(this.labelID); + this.groupBoxOptions.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBoxOptions.Location = new System.Drawing.Point(0, 0); + this.groupBoxOptions.Name = "groupBoxOptions"; + this.groupBoxOptions.Size = new System.Drawing.Size(309, 538); + this.groupBoxOptions.TabIndex = 5; + this.groupBoxOptions.TabStop = false; + this.groupBoxOptions.Text = "Game options"; + // + // buttonShowGameGenieDatabase + // + this.buttonShowGameGenieDatabase.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonShowGameGenieDatabase.Location = new System.Drawing.Point(252, 286); + this.buttonShowGameGenieDatabase.Name = "buttonShowGameGenieDatabase"; + this.buttonShowGameGenieDatabase.Size = new System.Drawing.Size(25, 20); + this.buttonShowGameGenieDatabase.TabIndex = 12; + this.buttonShowGameGenieDatabase.Text = "+"; + this.buttonShowGameGenieDatabase.UseVisualStyleBackColor = true; + this.buttonShowGameGenieDatabase.Click += new System.EventHandler(this.buttonShowGameGenieDatabase_Click); + // + // maskedTextBoxReleaseDate + // + this.maskedTextBoxReleaseDate.Location = new System.Drawing.Point(210, 154); + this.maskedTextBoxReleaseDate.Mask = "0000-00-00"; + this.maskedTextBoxReleaseDate.Name = "maskedTextBoxReleaseDate"; + this.maskedTextBoxReleaseDate.Size = new System.Drawing.Size(65, 20); + this.maskedTextBoxReleaseDate.TabIndex = 6; + this.maskedTextBoxReleaseDate.TextChanged += new System.EventHandler(this.maskedTextBoxReleaseDate_TextChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label1.Location = new System.Drawing.Point(15, 157); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(150, 13); + this.label1.TabIndex = 5; + this.label1.Text = "Release date (YYYY-MM-DD):"; + // + // textBoxGameGenie + // + this.textBoxGameGenie.Location = new System.Drawing.Point(19, 286); + this.textBoxGameGenie.Name = "textBoxGameGenie"; + this.textBoxGameGenie.Size = new System.Drawing.Size(227, 20); + this.textBoxGameGenie.TabIndex = 11; + this.textBoxGameGenie.TextChanged += new System.EventHandler(this.textBoxGameGenie_TextChanged); + // + // label7 + // + this.label7.AutoSize = true; + this.label7.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label7.Location = new System.Drawing.Point(16, 269); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(194, 13); + this.label7.TabIndex = 17; + this.label7.Text = "Game Genie codes (comma separated):"; + // + // label6 + // + this.label6.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label6.Location = new System.Drawing.Point(15, 76); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(82, 63); + this.label6.TabIndex = 16; + this.label6.Text = "Max players:"; + this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // radioButtonTwoSim + // + this.radioButtonTwoSim.AutoSize = true; + this.radioButtonTwoSim.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.radioButtonTwoSim.Location = new System.Drawing.Point(103, 122); + this.radioButtonTwoSim.Name = "radioButtonTwoSim"; + this.radioButtonTwoSim.Size = new System.Drawing.Size(156, 17); + this.radioButtonTwoSim.TabIndex = 5; + this.radioButtonTwoSim.Text = "Two players, simultaneously"; + this.radioButtonTwoSim.UseVisualStyleBackColor = true; + // + // buttonGoogle + // + this.buttonGoogle.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonGoogle.Location = new System.Drawing.Point(219, 427); + this.buttonGoogle.Name = "buttonGoogle"; + this.buttonGoogle.Size = new System.Drawing.Size(61, 23); + this.buttonGoogle.TabIndex = 15; + this.buttonGoogle.Text = "Google"; + this.buttonGoogle.UseVisualStyleBackColor = true; + // + // buttonBrowseImage + // + this.buttonBrowseImage.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonBrowseImage.Location = new System.Drawing.Point(219, 384); + this.buttonBrowseImage.Name = "buttonBrowseImage"; + this.buttonBrowseImage.Size = new System.Drawing.Size(61, 23); + this.buttonBrowseImage.TabIndex = 13; + this.buttonBrowseImage.Text = "Browse"; + this.buttonBrowseImage.UseVisualStyleBackColor = true; + // + // pictureBoxArt + // + this.pictureBoxArt.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.pictureBoxArt.Location = new System.Drawing.Point(71, 316); + this.pictureBoxArt.Name = "pictureBoxArt"; + this.pictureBoxArt.Size = new System.Drawing.Size(140, 204); + this.pictureBoxArt.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBoxArt.TabIndex = 12; + this.pictureBoxArt.TabStop = false; + // + // label4 + // + this.label4.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label4.Location = new System.Drawing.Point(15, 316); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(53, 204); + this.label4.TabIndex = 11; + this.label4.Text = "Box art:"; + this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // textBoxArguments + // + this.textBoxArguments.Location = new System.Drawing.Point(18, 237); + this.textBoxArguments.Name = "textBoxArguments"; + this.textBoxArguments.Size = new System.Drawing.Size(257, 20); + this.textBoxArguments.TabIndex = 10; + this.textBoxArguments.TextChanged += new System.EventHandler(this.textBoxArguments_TextChanged); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label3.Location = new System.Drawing.Point(15, 220); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(253, 13); + this.label3.TabIndex = 9; + this.label3.Text = "Command line arguments (for advanced users only!):"; + // + // textBoxPublisher + // + this.textBoxPublisher.Location = new System.Drawing.Point(71, 186); + this.textBoxPublisher.Name = "textBoxPublisher"; + this.textBoxPublisher.Size = new System.Drawing.Size(204, 20); + this.textBoxPublisher.TabIndex = 8; + this.textBoxPublisher.TextChanged += new System.EventHandler(this.textBoxPublisher_TextChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label2.Location = new System.Drawing.Point(15, 189); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(53, 13); + this.label2.TabIndex = 7; + this.label2.Text = "Publisher:"; + // + // radioButtonTwo + // + this.radioButtonTwo.AutoSize = true; + this.radioButtonTwo.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.radioButtonTwo.Location = new System.Drawing.Point(103, 99); + this.radioButtonTwo.Name = "radioButtonTwo"; + this.radioButtonTwo.Size = new System.Drawing.Size(174, 17); + this.radioButtonTwo.TabIndex = 4; + this.radioButtonTwo.Text = "Two players, not simultaneously"; + this.radioButtonTwo.UseVisualStyleBackColor = true; + // + // radioButtonOne + // + this.radioButtonOne.AutoSize = true; + this.radioButtonOne.Checked = true; + this.radioButtonOne.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.radioButtonOne.Location = new System.Drawing.Point(103, 76); + this.radioButtonOne.Name = "radioButtonOne"; + this.radioButtonOne.Size = new System.Drawing.Size(76, 17); + this.radioButtonOne.TabIndex = 3; + this.radioButtonOne.TabStop = true; + this.radioButtonOne.Text = "One player"; + this.radioButtonOne.UseVisualStyleBackColor = true; + this.radioButtonOne.CheckedChanged += new System.EventHandler(this.radioButtonOne_CheckedChanged); + // + // textBoxName + // + this.textBoxName.Location = new System.Drawing.Point(59, 46); + this.textBoxName.Name = "textBoxName"; + this.textBoxName.Size = new System.Drawing.Size(216, 20); + this.textBoxName.TabIndex = 2; + this.textBoxName.TextChanged += new System.EventHandler(this.textBoxName_TextChanged); + // + // labelName + // + this.labelName.AutoSize = true; + this.labelName.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.labelName.Location = new System.Drawing.Point(15, 49); + this.labelName.Name = "labelName"; + this.labelName.Size = new System.Drawing.Size(38, 13); + this.labelName.TabIndex = 1; + this.labelName.Text = "Name:"; + // + // labelID + // + this.labelID.AutoSize = true; + this.labelID.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.labelID.Location = new System.Drawing.Point(15, 21); + this.labelID.Name = "labelID"; + this.labelID.Size = new System.Drawing.Size(21, 13); + this.labelID.TabIndex = 0; + this.labelID.Text = "ID:"; + // + // GameDetail + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.groupBoxOptions); + this.Name = "GameDetail"; + this.Size = new System.Drawing.Size(309, 538); + this.groupBoxOptions.ResumeLayout(false); + this.groupBoxOptions.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxArt)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBoxOptions; + private System.Windows.Forms.Button buttonShowGameGenieDatabase; + private System.Windows.Forms.MaskedTextBox maskedTextBoxReleaseDate; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBoxGameGenie; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.RadioButton radioButtonTwoSim; + private System.Windows.Forms.Button buttonGoogle; + private System.Windows.Forms.Button buttonBrowseImage; + private System.Windows.Forms.PictureBox pictureBoxArt; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox textBoxArguments; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox textBoxPublisher; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.RadioButton radioButtonTwo; + private System.Windows.Forms.RadioButton radioButtonOne; + private System.Windows.Forms.TextBox textBoxName; + private System.Windows.Forms.Label labelName; + private System.Windows.Forms.Label labelID; + } +} diff --git a/UI/Components/GameDetail.cs b/UI/Components/GameDetail.cs new file mode 100644 index 00000000..ad278430 --- /dev/null +++ b/UI/Components/GameDetail.cs @@ -0,0 +1,142 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace com.clusterrr.hakchi_gui.UI.Components +{ + public partial class GameDetail : UserControl + { + public GameDetail() + { + InitializeComponent(); + + // Little tweak for easy translation + var tbl = textBoxName.Left; + textBoxName.Left = labelName.Left + labelName.Width; + textBoxName.Width -= textBoxName.Left - tbl; + maskedTextBoxReleaseDate.Left = label1.Left + label1.Width + 3; + tbl = textBoxPublisher.Left; + textBoxPublisher.Left = label2.Left + label2.Width; + textBoxPublisher.Width -= textBoxPublisher.Left - tbl; + } + private NesMiniApplication currentApp; + public void SetGame(NesMiniApplication app) + { + currentApp = app; + ReloadInfo(); + } + private void ReloadInfo() + { + if (currentApp == null) + { + + groupBoxOptions.Visible = true; + groupBoxOptions.Enabled = false; + labelID.Text = "ID: "; + textBoxName.Text = ""; + radioButtonOne.Checked = true; + radioButtonTwo.Checked = false; + radioButtonTwoSim.Checked = false; + maskedTextBoxReleaseDate.Text = ""; + textBoxPublisher.Text = ""; + textBoxArguments.Text = ""; + pictureBoxArt.Image = null; + } + else + { + + + groupBoxOptions.Visible = true; + labelID.Text = "ID: " + currentApp.Code; + textBoxName.Text = currentApp.Name; + if (currentApp.Simultaneous && currentApp.Players == 2) + radioButtonTwoSim.Checked = true; + else if (currentApp.Players == 2) + radioButtonTwo.Checked = true; + else + radioButtonOne.Checked = true; + maskedTextBoxReleaseDate.Text = currentApp.ReleaseDate; + textBoxPublisher.Text = currentApp.Publisher; + if (currentApp is NesGame) + textBoxArguments.Text = (currentApp as NesGame).Args; + else if (currentApp is FdsGame) + textBoxArguments.Text = (currentApp as FdsGame).Args; + else + textBoxArguments.Text = currentApp.Command; + if (System.IO.File.Exists(currentApp.IconPath)) + pictureBoxArt.Image = NesMiniApplication.LoadBitmap(currentApp.IconPath); + else + pictureBoxArt.Image = null; + buttonShowGameGenieDatabase.Enabled = textBoxGameGenie.Enabled = currentApp is NesGame; + textBoxGameGenie.Text = (currentApp is NesGame) ? (currentApp as NesGame).GameGenie : ""; + groupBoxOptions.Enabled = true; + } + } + + private void textBoxName_TextChanged(object sender, EventArgs e) + { + + if (currentApp == null || !(currentApp is NesMiniApplication)) return; + var game = (currentApp as NesMiniApplication); + game.Name = textBoxName.Text; + } + + private void radioButtonOne_CheckedChanged(object sender, EventArgs e) + { + + if (currentApp == null || !(currentApp is NesMiniApplication)) return; + var game = (currentApp as NesMiniApplication); + game.Players = (byte)(radioButtonOne.Checked ? 1 : 2); + game.Simultaneous = radioButtonTwoSim.Checked; + } + + private void textBoxPublisher_TextChanged(object sender, EventArgs e) + { + + if (currentApp == null || !(currentApp is NesMiniApplication)) return; + var game = (currentApp as NesMiniApplication); + game.Publisher = textBoxPublisher.Text.ToUpper(); + } + + private void textBoxArguments_TextChanged(object sender, EventArgs e) + { + + if (currentApp == null || !(currentApp is NesMiniApplication)) return; + var game = (currentApp as NesMiniApplication); + if (game is NesGame) + (game as NesGame).Args = textBoxArguments.Text; + else if (game is FdsGame) + (game as FdsGame).Args = textBoxArguments.Text; + else + game.Command = textBoxArguments.Text; + } + + private void maskedTextBoxReleaseDate_TextChanged(object sender, EventArgs e) + { + if (currentApp == null || !(currentApp is NesMiniApplication)) return; + var game = (currentApp as NesMiniApplication); + game.ReleaseDate = maskedTextBoxReleaseDate.Text; + } + + private void textBoxGameGenie_TextChanged(object sender, EventArgs e) + { + if (currentApp == null || !(currentApp is NesGame)) return; + var game = (currentApp as NesGame); + game.GameGenie = textBoxGameGenie.Text; + } + + private void buttonShowGameGenieDatabase_Click(object sender, EventArgs e) + { + if (!(currentApp is NesGame)) return; + NesGame nesGame = currentApp as NesGame; + GameGenieCodeForm lFrm = new GameGenieCodeForm(nesGame); + if (lFrm.ShowDialog() == System.Windows.Forms.DialogResult.OK) + textBoxGameGenie.Text = nesGame.GameGenie; + } + } +} diff --git a/UI/Components/GameDetail.resx b/UI/Components/GameDetail.resx new file mode 100644 index 00000000..7080a7d1 --- /dev/null +++ b/UI/Components/GameDetail.resx @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/UI/Components/GameSelecter.Designer.cs b/UI/Components/GameSelecter.Designer.cs new file mode 100644 index 00000000..d10f7a79 --- /dev/null +++ b/UI/Components/GameSelecter.Designer.cs @@ -0,0 +1,58 @@ +namespace com.clusterrr.hakchi_gui.UI.Components +{ + partial class GameSelecter + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.tvGameSelecter = new System.Windows.Forms.TreeView(); + this.SuspendLayout(); + // + // tvGameSelecter + // + this.tvGameSelecter.CheckBoxes = true; + this.tvGameSelecter.Dock = System.Windows.Forms.DockStyle.Fill; + this.tvGameSelecter.Location = new System.Drawing.Point(0, 0); + this.tvGameSelecter.Name = "tvGameSelecter"; + this.tvGameSelecter.Size = new System.Drawing.Size(495, 607); + this.tvGameSelecter.TabIndex = 0; + // + // GameSelecter + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.tvGameSelecter); + this.Name = "GameSelecter"; + this.Size = new System.Drawing.Size(495, 607); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TreeView tvGameSelecter; + } +} diff --git a/UI/Components/GameSelecter.cs b/UI/Components/GameSelecter.cs new file mode 100644 index 00000000..749dfde6 --- /dev/null +++ b/UI/Components/GameSelecter.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.IO; +using System.Diagnostics; +using com.clusterrr.hakchi_gui.Properties; +namespace com.clusterrr.hakchi_gui.UI.Components +{ + public partial class GameSelecter : UserControl + { + public GameSelecter() + { + InitializeComponent(); + + } + public void RefreshGames() + { + string[] selectedGames = ConfigIni.SelectedGames.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); + if(!System.IO.Directory.Exists(NesMiniApplication.GamesDirectory)) + { + Directory.CreateDirectory(NesMiniApplication.GamesDirectory); + } + var gameDirs = Directory.GetDirectories(NesMiniApplication.GamesDirectory); + var games = new List<NesMiniApplication>(); + foreach (var gameDir in gameDirs) + { + try + { + // Removing empty directories without errors + try + { + var game = NesMiniApplication.FromDirectory(gameDir); + games.Add(game); + } + catch (FileNotFoundException ex) // Remove bad directories if any + { + Debug.WriteLine(ex.Message + ex.StackTrace); + Directory.Delete(gameDir, true); + } + } + catch (Exception ex) + { + Debug.WriteLine(ex.Message + ex.StackTrace); + MessageBox.Show(this, ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); + continue; + } + } + var gamesSorted = games.OrderBy(o => o.Name); + + tvGameSelecter.Nodes.Clear(); + TreeNode tn = new TreeNode(Resources.Default30games); + tn.Checked = selectedGames.Contains("default"); + tvGameSelecter.Nodes.Add(tn); + Dictionary<string, TreeNode> consolesTreeNode = new Dictionary<string, TreeNode>(); + foreach (var game in gamesSorted) + { + if(!consolesTreeNode.ContainsKey(AppTypeCollection.GetAppByClass(game.GetType()).SystemName)) + { + AppTypeCollection.AppInfo inf = AppTypeCollection.GetAppByClass(game.GetType()); + TreeNode systemNode = new TreeNode(inf.SystemName); + systemNode.Tag = inf; + consolesTreeNode[inf.SystemName]= systemNode; + tvGameSelecter.Nodes.Add(systemNode); + + } + TreeNode gameNode = new TreeNode(game.Name); + gameNode.Tag = game; + gameNode.Checked = selectedGames.Contains(game.Code); + consolesTreeNode[AppTypeCollection.GetAppByClass(game.GetType()).SystemName].Nodes.Add(gameNode); + + } + // RecalculateSelectedGames(); + // ShowSelected(); + } + /* Debug.WriteLine("Loading games"); + var selected = ConfigIni.SelectedGames.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); + Directory.CreateDirectory(NesMiniApplication.GamesDirectory); + var gameDirs = Directory.GetDirectories(NesMiniApplication.GamesDirectory); + var games = new List<NesMiniApplication>(); + foreach (var gameDir in gameDirs) + { + try + { + // Removing empty directories without errors + try + { + var game = NesMiniApplication.FromDirectory(gameDir); + games.Add(game); + } + catch (FileNotFoundException ex) // Remove bad directories if any + { + Debug.WriteLine(ex.Message + ex.StackTrace); + Directory.Delete(gameDir, true); + } + } + catch (Exception ex) + { + Debug.WriteLine(ex.Message + ex.StackTrace); + MessageBox.Show(this, ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); + continue; + } + } + + var gamesSorted = games.OrderBy(o => o.Name); + checkedListBoxGames.Items.Clear(); + checkedListBoxGames.Items.Add(Resources.Default30games, selected.Contains("default")); + foreach (var game in gamesSorted) + { + checkedListBoxGames.Items.Add(game, selected.Contains(game.Code)); + } + RecalculateSelectedGames(); + ShowSelected();*/ + } +} diff --git a/UI/Components/GameSelecter.resx b/UI/Components/GameSelecter.resx new file mode 100644 index 00000000..7080a7d1 --- /dev/null +++ b/UI/Components/GameSelecter.resx @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/hakchi_gui.csproj.user b/hakchi_gui.csproj.user new file mode 100644 index 00000000..dea172c8 --- /dev/null +++ b/hakchi_gui.csproj.user @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <PublishUrlHistory /> + <InstallUrlHistory /> + <SupportUrlHistory /> + <UpdateUrlHistory /> + <BootstrapperUrlHistory /> + <ErrorReportUrlHistory /> + <FallbackCulture>en-US</FallbackCulture> + <VerifyUploadedFiles>false</VerifyUploadedFiles> + </PropertyGroup> +</Project>
\ No newline at end of file |