diff options
| author | lempamo <[email protected]> | 2017-08-23 13:38:40 -0400 |
|---|---|---|
| committer | lempamo <[email protected]> | 2017-08-23 13:38:40 -0400 |
| commit | 3306d36ecbc024775972e5cf7971b2a7a70671d0 (patch) | |
| tree | 0a79e67b6723a8c75ffd66c7828bdd0ebb1bf74d /Histacom2/SaveDialogs | |
| parent | 99fef5c57360f07259fc86f433bed8a9ab59c48e (diff) | |
| download | histacom2-3306d36ecbc024775972e5cf7971b2a7a70671d0.tar.gz histacom2-3306d36ecbc024775972e5cf7971b2a7a70671d0.tar.bz2 histacom2-3306d36ecbc024775972e5cf7971b2a7a70671d0.zip | |
Renaming the game!
Diffstat (limited to 'Histacom2/SaveDialogs')
| -rw-r--r-- | Histacom2/SaveDialogs/LoadGameDialog.Designer.cs | 103 | ||||
| -rw-r--r-- | Histacom2/SaveDialogs/LoadGameDialog.cs | 57 | ||||
| -rw-r--r-- | Histacom2/SaveDialogs/LoadGameDialog.resx | 120 | ||||
| -rw-r--r-- | Histacom2/SaveDialogs/LoadGameProfileItem.Designer.cs | 190 | ||||
| -rw-r--r-- | Histacom2/SaveDialogs/LoadGameProfileItem.cs | 152 | ||||
| -rw-r--r-- | Histacom2/SaveDialogs/LoadGameProfileItem.resx | 120 | ||||
| -rw-r--r-- | Histacom2/SaveDialogs/NewGameDialog.Designer.cs | 141 | ||||
| -rw-r--r-- | Histacom2/SaveDialogs/NewGameDialog.cs | 99 | ||||
| -rw-r--r-- | Histacom2/SaveDialogs/NewGameDialog.resx | 120 | ||||
| -rw-r--r-- | Histacom2/SaveDialogs/SaveFileTroubleShooter.Designer.cs | 147 | ||||
| -rw-r--r-- | Histacom2/SaveDialogs/SaveFileTroubleShooter.cs | 145 | ||||
| -rw-r--r-- | Histacom2/SaveDialogs/SaveFileTroubleShooter.resx | 120 |
12 files changed, 1514 insertions, 0 deletions
diff --git a/Histacom2/SaveDialogs/LoadGameDialog.Designer.cs b/Histacom2/SaveDialogs/LoadGameDialog.Designer.cs new file mode 100644 index 0000000..4dd8a30 --- /dev/null +++ b/Histacom2/SaveDialogs/LoadGameDialog.Designer.cs @@ -0,0 +1,103 @@ +namespace Histacom2 +{ + partial class LoadGameDialog + { + /// <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 Windows Form 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.panel1 = new System.Windows.Forms.Panel(); + this.button3 = new System.Windows.Forms.Button(); + this.button1 = new System.Windows.Forms.Button(); + this.Profiles = new System.Windows.Forms.Panel(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // panel1 + // + this.panel1.BackColor = System.Drawing.Color.Silver; + this.panel1.Controls.Add(this.button3); + this.panel1.Controls.Add(this.button1); + this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.panel1.Location = new System.Drawing.Point(0, 340); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(516, 25); + this.panel1.TabIndex = 0; + // + // button3 + // + this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.button3.Location = new System.Drawing.Point(364, 0); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(75, 23); + this.button3.TabIndex = 0; + this.button3.Text = "Help"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button1 + // + this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.button1.Location = new System.Drawing.Point(441, 0); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 0; + this.button1.Text = "OK"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // Profiles + // + this.Profiles.AutoScroll = true; + this.Profiles.Dock = System.Windows.Forms.DockStyle.Fill; + this.Profiles.Location = new System.Drawing.Point(0, 0); + this.Profiles.Name = "Profiles"; + this.Profiles.Size = new System.Drawing.Size(516, 340); + this.Profiles.TabIndex = 2; + // + // LoadGameDialog + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.ClientSize = new System.Drawing.Size(516, 365); + this.Controls.Add(this.Profiles); + this.Controls.Add(this.panel1); + this.Name = "LoadGameDialog"; + this.Text = "Profiles"; + this.Load += new System.EventHandler(this.LoadGameDialog_Load); + this.panel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Panel Profiles; + } +}
\ No newline at end of file diff --git a/Histacom2/SaveDialogs/LoadGameDialog.cs b/Histacom2/SaveDialogs/LoadGameDialog.cs new file mode 100644 index 0000000..9cea1b9 --- /dev/null +++ b/Histacom2/SaveDialogs/LoadGameDialog.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.IO; +using static Histacom2.Engine.SaveSystem; + +namespace Histacom2 +{ + public partial class LoadGameDialog : Form + { + public bool successful = false; + public LoadGameDialog() + { + InitializeComponent(); + } + + public void ChooseProfile(string SelectedProfile) + { + ProfileName = SelectedProfile; + successful = true; + this.Close(); + } + + private void button2_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void button1_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void button3_Click(object sender, EventArgs e) + { + MessageBox.Show("Here you can control all your profiles! Use can open a profile by hovering over it and clicking 'Load Profile!'"); + } + + private void LoadGameDialog_Load(object sender, EventArgs e) + { + foreach (string dir in Directory.GetDirectories(AllProfilesDirectory)) + { + LoadGameProfileItem newItem = new LoadGameProfileItem(); + newItem.Tag = Path.GetFileName(dir); + newItem.Dock = DockStyle.Top; + Profiles.Controls.Add(newItem); + newItem.Show(); + } + } + } +} diff --git a/Histacom2/SaveDialogs/LoadGameDialog.resx b/Histacom2/SaveDialogs/LoadGameDialog.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Histacom2/SaveDialogs/LoadGameDialog.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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/Histacom2/SaveDialogs/LoadGameProfileItem.Designer.cs b/Histacom2/SaveDialogs/LoadGameProfileItem.Designer.cs new file mode 100644 index 0000000..7a59037 --- /dev/null +++ b/Histacom2/SaveDialogs/LoadGameProfileItem.Designer.cs @@ -0,0 +1,190 @@ +namespace Histacom2 +{ + partial class LoadGameProfileItem + { + /// <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.sidebar = new System.Windows.Forms.Panel(); + this.exampleLoadProfile = new System.Windows.Forms.Button(); + this.exampleDelete = new System.Windows.Forms.Button(); + this.exampleNameBtn = new System.Windows.Forms.Button(); + this.profileName = new System.Windows.Forms.Label(); + this.pnlConfirm = new System.Windows.Forms.Panel(); + this.label1 = new System.Windows.Forms.Label(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.sidebar.SuspendLayout(); + this.pnlConfirm.SuspendLayout(); + this.SuspendLayout(); + // + // sidebar + // + this.sidebar.BackColor = System.Drawing.Color.Gray; + this.sidebar.Controls.Add(this.exampleLoadProfile); + this.sidebar.Controls.Add(this.exampleDelete); + this.sidebar.Controls.Add(this.exampleNameBtn); + this.sidebar.Dock = System.Windows.Forms.DockStyle.Right; + this.sidebar.Location = new System.Drawing.Point(245, 0); + this.sidebar.Name = "sidebar"; + this.sidebar.Size = new System.Drawing.Size(102, 82); + this.sidebar.TabIndex = 2; + this.sidebar.Visible = false; + // + // exampleLoadProfile + // + this.exampleLoadProfile.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192))))); + this.exampleLoadProfile.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.exampleLoadProfile.Location = new System.Drawing.Point(3, 1); + this.exampleLoadProfile.Name = "exampleLoadProfile"; + this.exampleLoadProfile.Size = new System.Drawing.Size(94, 23); + this.exampleLoadProfile.TabIndex = 0; + this.exampleLoadProfile.Text = "Load Profile!"; + this.exampleLoadProfile.UseVisualStyleBackColor = false; + this.exampleLoadProfile.Click += new System.EventHandler(this.exampleLoadProfile_Click); + // + // exampleDelete + // + this.exampleDelete.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.exampleDelete.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.exampleDelete.Location = new System.Drawing.Point(3, 54); + this.exampleDelete.Name = "exampleDelete"; + this.exampleDelete.Size = new System.Drawing.Size(93, 23); + this.exampleDelete.TabIndex = 0; + this.exampleDelete.Text = "Delete"; + this.exampleDelete.UseVisualStyleBackColor = false; + this.exampleDelete.Click += new System.EventHandler(this.exampleDelete_Click); + // + // exampleNameBtn + // + this.exampleNameBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192))))); + this.exampleNameBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.exampleNameBtn.Location = new System.Drawing.Point(3, 27); + this.exampleNameBtn.Name = "exampleNameBtn"; + this.exampleNameBtn.Size = new System.Drawing.Size(93, 23); + this.exampleNameBtn.TabIndex = 0; + this.exampleNameBtn.Text = "Change Name"; + this.exampleNameBtn.UseVisualStyleBackColor = false; + this.exampleNameBtn.Click += new System.EventHandler(this.exampleNameBtn_Click); + // + // profileName + // + this.profileName.BackColor = System.Drawing.Color.Gray; + this.profileName.Dock = System.Windows.Forms.DockStyle.Fill; + this.profileName.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.profileName.Location = new System.Drawing.Point(0, 0); + this.profileName.Name = "profileName"; + this.profileName.Size = new System.Drawing.Size(245, 82); + this.profileName.TabIndex = 1; + this.profileName.Text = "Profile Name"; + // + // pnlConfirm + // + this.pnlConfirm.BackColor = System.Drawing.Color.Gray; + this.pnlConfirm.Controls.Add(this.button2); + this.pnlConfirm.Controls.Add(this.button1); + this.pnlConfirm.Controls.Add(this.label1); + this.pnlConfirm.Controls.Add(this.textBox1); + this.pnlConfirm.Dock = System.Windows.Forms.DockStyle.Bottom; + this.pnlConfirm.Location = new System.Drawing.Point(0, 32); + this.pnlConfirm.Name = "pnlConfirm"; + this.pnlConfirm.Size = new System.Drawing.Size(245, 50); + this.pnlConfirm.TabIndex = 1; + this.pnlConfirm.Visible = false; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(3, 5); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(240, 13); + this.label1.TabIndex = 1; + this.label1.Text = "Are you really sure you want to delete this Profile?"; + // + // button1 + // + this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button1.Location = new System.Drawing.Point(10, 20); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(109, 22); + this.button1.TabIndex = 1; + this.button1.Text = "Yes"; + this.button1.UseVisualStyleBackColor = false; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // cancelButton + // + this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); + this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button2.Location = new System.Drawing.Point(136, 20); + this.button2.Name = "cancelButton"; + this.button2.Size = new System.Drawing.Size(109, 23); + this.button2.TabIndex = 1; + this.button2.Text = "No"; + this.button2.UseVisualStyleBackColor = false; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(3, 22); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(130, 20); + this.textBox1.TabIndex = 1; + this.textBox1.Visible = false; + // + // LoadGameProfileItem + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.pnlConfirm); + this.Controls.Add(this.profileName); + this.Controls.Add(this.sidebar); + this.Name = "LoadGameProfileItem"; + this.Size = new System.Drawing.Size(347, 82); + this.Paint += new System.Windows.Forms.PaintEventHandler(this.LoadGameProfileItem_Paint); + this.sidebar.ResumeLayout(false); + this.pnlConfirm.ResumeLayout(false); + this.pnlConfirm.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel sidebar; + private System.Windows.Forms.Button exampleLoadProfile; + private System.Windows.Forms.Button exampleDelete; + private System.Windows.Forms.Button exampleNameBtn; + private System.Windows.Forms.Label profileName; + private System.Windows.Forms.Panel pnlConfirm; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.TextBox textBox1; + } +} diff --git a/Histacom2/SaveDialogs/LoadGameProfileItem.cs b/Histacom2/SaveDialogs/LoadGameProfileItem.cs new file mode 100644 index 0000000..bdc0b7c --- /dev/null +++ b/Histacom2/SaveDialogs/LoadGameProfileItem.cs @@ -0,0 +1,152 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using static Histacom2.Engine.SaveSystem; +using System.IO; + +namespace Histacom2 +{ + public partial class LoadGameProfileItem : UserControl, IMessageFilter + { + public bool OnceRemoveHeight = false; + public bool OnceAddHeight = false; + public bool RequestingNewName = false; + public LoadGameProfileItem() + { + InitializeComponent(); + Application.AddMessageFilter(this); + } + + //private void LoadGameProfileItem_MouseHover(object sender, EventArgs e) + //{ + // exampleTop.Show(); + // this.Height += 28; + // OnceRemoveHeight = false; + //} + + public bool PreFilterMessage(ref Message m) + { + var mouseLocation = Cursor.Position; + + if (!ClientRectangle.Contains(PointToClient(Control.MousePosition))) + { + sidebar.Hide(); + if (OnceRemoveHeight == false) + { + this.Height -= 28; + OnceRemoveHeight = true; + profileName.BackColor = Color.Gray; + sidebar.BackColor = Color.Gray; + pnlConfirm.BackColor = Color.Gray; + } + OnceAddHeight = false; + } else + { + sidebar.Show(); + if (OnceAddHeight == false) + { + this.Height += 28; + OnceAddHeight = true; + profileName.BackColor = Color.LightGray; + sidebar.BackColor = Color.LightGray; + pnlConfirm.BackColor = Color.LightGray; + } + OnceRemoveHeight = false; + } + + if (m.Msg != 0x20a) // Scrolling Message + { + return false;//ignore message + } + return false; + } + + private void LoadGameProfileItem_Paint(object sender, PaintEventArgs e) + { + profileName.Text = this.Tag.ToString(); + } + + private void exampleLoadProfile_Click(object sender, EventArgs e) + { + ((LoadGameDialog)this.TopLevelControl).ChooseProfile(this.Tag.ToString()); + } + + private void button1_Click(object sender, EventArgs e) + { + DeleteProfile(); + } + + void DeleteProfile() + { + if (Directory.Exists(Path.Combine(AllProfilesDirectory, this.Tag.ToString()))) + { + Directory.Delete(Path.Combine(AllProfilesDirectory, this.Tag.ToString()), true); + this.Hide(); + } + } + + private void button2_Click(object sender, EventArgs e) + { + try + { + if (!RequestingNewName == false) + { + if (textBox1.Text == "") + { + MessageBox.Show("New profile name cannot be empty!"); + } + else + { + if (textBox1.Text.Length > 20) + { + MessageBox.Show("The profile name cannot be longer than 20 characters"); + } + else + { + if (Directory.Exists(Path.Combine(AllProfilesDirectory, textBox1.Text))) + { + MessageBox.Show("That profile already exists"); + } + else + { + Directory.Move(Path.Combine(AllProfilesDirectory, this.Tag.ToString()), Path.Combine(AllProfilesDirectory, textBox1.Text)); + this.Tag = textBox1.Text; + this.Invalidate(); + } + } + } + } + pnlConfirm.Hide(); + } catch + { + + } + } + + private void exampleDelete_Click(object sender, EventArgs e) + { + label1.Text = "Are you really sure you want to delete this Profile?"; + button1.Show(); + textBox1.Hide(); + button2.Text = "No"; + RequestingNewName = false; + pnlConfirm.Show(); + } + + private void exampleNameBtn_Click(object sender, EventArgs e) + { + label1.Text = "Enter a new profile name: "; + button1.Hide(); + textBox1.Show(); + button2.Text = "OK"; + RequestingNewName = true; + pnlConfirm.Show(); + } + } +} diff --git a/Histacom2/SaveDialogs/LoadGameProfileItem.resx b/Histacom2/SaveDialogs/LoadGameProfileItem.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Histacom2/SaveDialogs/LoadGameProfileItem.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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/Histacom2/SaveDialogs/NewGameDialog.Designer.cs b/Histacom2/SaveDialogs/NewGameDialog.Designer.cs new file mode 100644 index 0000000..266061b --- /dev/null +++ b/Histacom2/SaveDialogs/NewGameDialog.Designer.cs @@ -0,0 +1,141 @@ +namespace Histacom2 +{ + partial class NewGameDialog + { + /// <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 Windows Form 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.txtProfName = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.btnOk = new System.Windows.Forms.Button(); + this.btnHelp = new System.Windows.Forms.Button(); + this.btnCancl = new System.Windows.Forms.Button(); + this.btnInfo = new System.Windows.Forms.Button(); + this.btnDevMode = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // txtProfName + // + this.txtProfName.Location = new System.Drawing.Point(143, 12); + this.txtProfName.Name = "txtProfName"; + this.txtProfName.Size = new System.Drawing.Size(314, 20); + this.txtProfName.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 15); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(125, 13); + this.label1.TabIndex = 1; + this.label1.Text = "Profile Name (username):"; + // + // btnOk + // + this.btnOk.Location = new System.Drawing.Point(382, 70); + this.btnOk.Name = "btnOk"; + this.btnOk.Size = new System.Drawing.Size(75, 23); + this.btnOk.TabIndex = 2; + this.btnOk.Text = "OK"; + this.btnOk.UseVisualStyleBackColor = true; + this.btnOk.Click += new System.EventHandler(this.btnOk_Click); + // + // btnHelp + // + this.btnHelp.Location = new System.Drawing.Point(301, 70); + this.btnHelp.Name = "btnHelp"; + this.btnHelp.Size = new System.Drawing.Size(75, 23); + this.btnHelp.TabIndex = 2; + this.btnHelp.Text = "Help"; + this.btnHelp.UseVisualStyleBackColor = true; + this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click); + // + // btnCancl + // + this.btnCancl.Location = new System.Drawing.Point(220, 70); + this.btnCancl.Name = "btnCancl"; + this.btnCancl.Size = new System.Drawing.Size(75, 23); + this.btnCancl.TabIndex = 2; + this.btnCancl.Text = "Cancel"; + this.btnCancl.UseVisualStyleBackColor = true; + this.btnCancl.Click += new System.EventHandler(this.btnCancl_Click); + // + // btnInfo + // + this.btnInfo.Location = new System.Drawing.Point(7, 70); + this.btnInfo.Name = "btnInfo"; + this.btnInfo.Size = new System.Drawing.Size(121, 23); + this.btnInfo.TabIndex = 2; + this.btnInfo.Text = "Technical Info"; + this.btnInfo.UseVisualStyleBackColor = true; + this.btnInfo.Click += new System.EventHandler(this.btnInfo_Click); + // + // btnDevMode + // + this.btnDevMode.Location = new System.Drawing.Point(7, 41); + this.btnDevMode.Name = "btnDevMode"; + this.btnDevMode.Size = new System.Drawing.Size(121, 23); + this.btnDevMode.TabIndex = 3; + this.btnDevMode.Text = "What is DevMode?"; + this.btnDevMode.UseVisualStyleBackColor = true; + this.btnDevMode.Visible = false; + this.btnDevMode.Click += new System.EventHandler(this.btnDevMode_Click); + // + // NewGameDialog + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(469, 96); + this.Controls.Add(this.btnDevMode); + this.Controls.Add(this.btnInfo); + this.Controls.Add(this.btnCancl); + this.Controls.Add(this.btnHelp); + this.Controls.Add(this.btnOk); + this.Controls.Add(this.label1); + this.Controls.Add(this.txtProfName); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "NewGameDialog"; + this.Tag = "ignoreFormOnTaskbar"; + this.Text = "New Game"; + this.Load += new System.EventHandler(this.NewGameDialog_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox txtProfName; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button btnOk; + private System.Windows.Forms.Button btnHelp; + private System.Windows.Forms.Button btnCancl; + private System.Windows.Forms.Button btnInfo; + private System.Windows.Forms.Button btnDevMode; + } +}
\ No newline at end of file diff --git a/Histacom2/SaveDialogs/NewGameDialog.cs b/Histacom2/SaveDialogs/NewGameDialog.cs new file mode 100644 index 0000000..7609d5d --- /dev/null +++ b/Histacom2/SaveDialogs/NewGameDialog.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Histacom2.Engine; +using Newtonsoft.Json; +using static Histacom2.Engine.SaveSystem; +using System.IO; + +namespace Histacom2 +{ + public partial class NewGameDialog : Form + { + public bool Successful = false; + public NewGameDialog() + { + InitializeComponent(); + } + + private void btnHelp_Click(object sender, EventArgs e) + { + MessageBox.Show("You can choose a profile name - this will create a new profile! Whenever you want to Load a game, click 'Load Game' and then choose a profile (You can have as many profiles as you want)"); + } + + private void btnCancl_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void btnInfo_Click(object sender, EventArgs e) + { + MessageBox.Show("The game's profiles are stored in your AppData /Histacom2/Profiles - the rest is for you to figure out!"); + } + + private void btnOk_Click(object sender, EventArgs e) + { + try + { + if (txtProfName.Text != "") + { + if (!(txtProfName.Text.Length > 20)) + { + ProfileName = txtProfName.Text; + if (DevMode == true) + { + if (Directory.Exists(ProfileDirectory)) + { + Directory.Delete(ProfileDirectory, true); + Successful = true; + this.Close(); + } + } + + if (!Directory.Exists(ProfileDirectory)) + { + Successful = true; + this.Close(); + } + else + { + MessageBox.Show("That profile already exists! \n USEFUL INFO: Use 'Load Game' to manage your profiles - from there you can delete the profile!"); + } + } + else + { + MessageBox.Show("The profile name cannot be longer than 20 characters"); + } + + } + else + { + MessageBox.Show("You must enter a profile name!"); + } + } catch + { + + } + } + + private void NewGameDialog_Load(object sender, EventArgs e) + { + if (DevMode == true) + { + btnDevMode.Show(); + } + } + + private void btnDevMode_Click(object sender, EventArgs e) + { + MessageBox.Show("DevMode is a mode Designed for Development of the game, if you are seeing this that means it is activated! All DevMode does is if a Profile already exists then rather than asking you to choose a different name it just " + + "deletes the old one! This means that you won't have 1 million profiles everytime you want to test something in the game!"); + } + } +} diff --git a/Histacom2/SaveDialogs/NewGameDialog.resx b/Histacom2/SaveDialogs/NewGameDialog.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Histacom2/SaveDialogs/NewGameDialog.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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/Histacom2/SaveDialogs/SaveFileTroubleShooter.Designer.cs b/Histacom2/SaveDialogs/SaveFileTroubleShooter.Designer.cs new file mode 100644 index 0000000..4c11576 --- /dev/null +++ b/Histacom2/SaveDialogs/SaveFileTroubleShooter.Designer.cs @@ -0,0 +1,147 @@ +namespace Histacom2.SaveDialogs +{ + partial class SaveFileTroubleShooter + { + /// <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 Windows Form 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.label1 = new System.Windows.Forms.Label(); + this.pnlResolved = new System.Windows.Forms.Panel(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.panel2 = new System.Windows.Forms.Panel(); + this.btnClose = new System.Windows.Forms.Button(); + this.pnlResolved.SuspendLayout(); + this.panel2.SuspendLayout(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(393, 20); + this.label1.TabIndex = 0; + this.label1.Text = "Please wait while we check the state of your Save file..."; + // + // pnlResolved + // + this.pnlResolved.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.pnlResolved.Controls.Add(this.textBox1); + this.pnlResolved.Controls.Add(this.label3); + this.pnlResolved.Controls.Add(this.label2); + this.pnlResolved.Location = new System.Drawing.Point(12, 38); + this.pnlResolved.Name = "pnlResolved"; + this.pnlResolved.Size = new System.Drawing.Size(589, 146); + this.pnlResolved.TabIndex = 1; + this.pnlResolved.Visible = false; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.Location = new System.Drawing.Point(8, 11); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(210, 20); + this.label2.TabIndex = 0; + this.label2.Text = "The issue has been resolved"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(9, 31); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(24, 13); + this.label3.TabIndex = 2; + this.label3.Text = "log:"; + // + // textBox1 + // + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox1.Location = new System.Drawing.Point(10, 55); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.ReadOnly = true; + this.textBox1.Size = new System.Drawing.Size(567, 79); + this.textBox1.TabIndex = 3; + // + // panel2 + // + this.panel2.BackColor = System.Drawing.SystemColors.ControlDark; + this.panel2.Controls.Add(this.btnClose); + this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom; + this.panel2.Location = new System.Drawing.Point(0, 217); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(612, 30); + this.panel2.TabIndex = 2; + // + // btnClose + // + this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnClose.Location = new System.Drawing.Point(526, 4); + this.btnClose.Name = "btnClose"; + this.btnClose.Size = new System.Drawing.Size(75, 23); + this.btnClose.TabIndex = 0; + this.btnClose.Text = "Close"; + this.btnClose.UseVisualStyleBackColor = true; + this.btnClose.Click += new System.EventHandler(this.btnClose_Click); + // + // SaveFileTroubleShooter + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(612, 247); + this.Controls.Add(this.panel2); + this.Controls.Add(this.pnlResolved); + this.Controls.Add(this.label1); + this.Name = "SaveFileTroubleShooter"; + this.Text = "Save File Troubleshooter"; + this.Load += new System.EventHandler(this.SaveFileTroubleShooter_Load); + this.pnlResolved.ResumeLayout(false); + this.pnlResolved.PerformLayout(); + this.panel2.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Panel pnlResolved; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Button btnClose; + } +}
\ No newline at end of file diff --git a/Histacom2/SaveDialogs/SaveFileTroubleShooter.cs b/Histacom2/SaveDialogs/SaveFileTroubleShooter.cs new file mode 100644 index 0000000..f094640 --- /dev/null +++ b/Histacom2/SaveDialogs/SaveFileTroubleShooter.cs @@ -0,0 +1,145 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Histacom2.Engine; +using System.IO; + +namespace Histacom2.SaveDialogs +{ + public partial class SaveFileTroubleShooter : Form + { + public string log; + Save savedata; + string json; + public SaveFileTroubleShooter() + { + InitializeComponent(); + } + + private void btnClose_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void SaveFileTroubleShooter_Load(object sender, EventArgs e) + { + BeginScan(); + } + + void WriteToLog(string toWrite) + { + log += toWrite + Environment.NewLine; + } + + void BeginScan() + { + WriteToLog("Started scanning profile: " + SaveSystem.ProfileName); + + // Check if the main.save file exists + + string savefile = Path.Combine(SaveSystem.ProfileDirectory, "main.save"); + + if (!File.Exists(savefile)) + { + WriteToLog("ISSUE FOUND! File main.save doesn't exist"); + + WriteToLog("Creating one..."); + + SaveSystem.NewGame(); + + WriteToLog("Created one!"); + + EndScan(true); + return; + } else { + WriteToLog("File main.save does exist - checking contents"); + + try + { + savedata = SaveSystem.ReadSave(savefile); + + } catch + { + WriteToLog("ISSUE FOUND! File main.save is unreadable"); + + WriteToLog("Sorry, there is no repairing it easily, your data will be lost"); + + string backupfile = Path.Combine(SaveSystem.ProfileDirectory, "main.backup"); + + if (Directory.Exists(backupfile)) Directory.Delete(backupfile); + + File.Copy(savefile, backupfile); + SaveSystem.NewGame(); + + // Make sure the username is set + + SaveSystem.CurrentSave.Username = SaveSystem.ProfileName; + + WriteToLog($"The corrupt file has been stored in {backupfile}"); + + EndScan(true); + } + + + // Check the values + + if (savedata.CurrentOS == null || savedata.CurrentOS == "") + { + WriteToLog("ISSUE FOUND! Data for CurrentOS is null! Giving default value..."); + savedata.CurrentOS = "95"; + EndScan(true); + } + + if (savedata.ExperiencedStories == null) + { + WriteToLog("ISSUE FOUND! Data for ExperiencedStories is null! Giving default value..."); + savedata.ExperiencedStories = new List<string>(); + } + + if (savedata.ThemeName == null || savedata.ThemeName == "") + { + WriteToLog("ISSUE FOUND! Data for ThemeName is null! Giving default value..."); + savedata.ThemeName = "95normal"; + } + } + + string folderspath = Path.Combine(SaveSystem.ProfileDirectory, "folders"); + + if (!Directory.Exists(folderspath)) + { + WriteToLog("ISSUE FOUND! Directory 'folders' doesn't exist! Creating one..."); + Directory.CreateDirectory(folderspath); + SaveSystem.CheckFiles(); + } + + + } + + void EndScan(bool successful) + { + pnlResolved.Visible = true; + if (successful == true) + { + label2.Text = "The issue has been resolved."; + // Set CurrentSave to the resolved one + + SaveSystem.CurrentSave = savedata; + + // Set the main.save file to the resolved one + + SaveSystem.WriteSave(Path.Combine(SaveSystem.ProfileDirectory, "main.save"), savedata); + + textBox1.Text = log; + } else { + label2.Text = "The issue has not been resolved, sorry"; + textBox1.Text = log; + } + } + } +} diff --git a/Histacom2/SaveDialogs/SaveFileTroubleShooter.resx b/Histacom2/SaveDialogs/SaveFileTroubleShooter.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Histacom2/SaveDialogs/SaveFileTroubleShooter.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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file |
