diff options
| author | TheEdgeNK <trey6979@gmail.com> | 2018-08-26 14:15:03 -0400 |
|---|---|---|
| committer | TheEdgeNK <trey6979@gmail.com> | 2018-08-26 14:15:03 -0400 |
| commit | ee343916c292c741041167a1a77f4b59a95002c5 (patch) | |
| tree | 1ad04a230aadc311041d78cc3a54e5f1c93a03d2 | |
| parent | 4800d7686b470b3a39314e76ea02daee790078b7 (diff) | |
| download | Project-Silicon-ee343916c292c741041167a1a77f4b59a95002c5.tar.gz Project-Silicon-ee343916c292c741041167a1a77f4b59a95002c5.tar.bz2 Project-Silicon-ee343916c292c741041167a1a77f4b59a95002c5.zip | |
Ability to change chatter username, also, terminal!
| -rw-r--r-- | PortEngine/ChatAPI.cs | 2 | ||||
| -rw-r--r-- | PortEngine/PortEngine.csproj | 1 | ||||
| -rw-r--r-- | PortEngine/Properties/Settings.Designer.cs | 14 | ||||
| -rw-r--r-- | PortEngine/Properties/Settings.settings | 3 | ||||
| -rw-r--r-- | PortEngine/TerminalAPI.cs | 55 | ||||
| -rw-r--r-- | PortEngine/app.config | 3 | ||||
| -rw-r--r-- | Project Ports/About.Designer.cs | 78 | ||||
| -rw-r--r-- | Project Ports/About.cs | 44 | ||||
| -rw-r--r-- | Project Ports/About.resx | 138 | ||||
| -rw-r--r-- | Project Ports/Programs/ChatApp.Designer.cs | 1 | ||||
| -rw-r--r-- | Project Ports/Programs/ChatApp.cs | 11 | ||||
| -rw-r--r-- | Project Ports/Programs/Terminal.Designer.cs | 45 | ||||
| -rw-r--r-- | Project Ports/Programs/Terminal.cs | 10 | ||||
| -rw-r--r-- | Project Ports/Project Ports.csproj | 9 |
14 files changed, 127 insertions, 287 deletions
diff --git a/PortEngine/ChatAPI.cs b/PortEngine/ChatAPI.cs index 667a016..ae1f27b 100644 --- a/PortEngine/ChatAPI.cs +++ b/PortEngine/ChatAPI.cs @@ -12,7 +12,7 @@ namespace PortEngine { public static void SendMessage(TextBox txtPending, TextBox txtDestination) { - txtDestination.AppendText("<Player> " + txtPending.Text + Environment.NewLine); + txtDestination.AppendText("<" + Properties.Settings.Default.userDisplayName + "> " + txtPending.Text + Environment.NewLine); txtPending.Clear(); } } diff --git a/PortEngine/PortEngine.csproj b/PortEngine/PortEngine.csproj index e5ff357..dbea034 100644 --- a/PortEngine/PortEngine.csproj +++ b/PortEngine/PortEngine.csproj @@ -49,6 +49,7 @@ <DesignTimeSharedInput>True</DesignTimeSharedInput> <DependentUpon>Settings.settings</DependentUpon> </Compile> + <Compile Include="TerminalAPI.cs" /> <Compile Include="WindowManager\base.cs"> <SubType>Form</SubType> </Compile> diff --git a/PortEngine/Properties/Settings.Designer.cs b/PortEngine/Properties/Settings.Designer.cs index b3cd482..6462222 100644 --- a/PortEngine/Properties/Settings.Designer.cs +++ b/PortEngine/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace PortEngine.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -34,5 +34,17 @@ namespace PortEngine.Properties { this["graphicsFriendly"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Player")] + public string userDisplayName { + get { + return ((string)(this["userDisplayName"])); + } + set { + this["userDisplayName"] = value; + } + } } } diff --git a/PortEngine/Properties/Settings.settings b/PortEngine/Properties/Settings.settings index 66e581e..14e29c9 100644 --- a/PortEngine/Properties/Settings.settings +++ b/PortEngine/Properties/Settings.settings @@ -5,5 +5,8 @@ <Setting Name="graphicsFriendly" Type="System.Boolean" Scope="User"> <Value Profile="(Default)">False</Value> </Setting> + <Setting Name="userDisplayName" Type="System.String" Scope="User"> + <Value Profile="(Default)">Player</Value> + </Setting> </Settings> </SettingsFile>
\ No newline at end of file diff --git a/PortEngine/TerminalAPI.cs b/PortEngine/TerminalAPI.cs new file mode 100644 index 0000000..4c09dad --- /dev/null +++ b/PortEngine/TerminalAPI.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace PortEngine +{ + public class TerminalAPI + { + public static void RunCommand(TextBox txtConsoleInput, TextBox txtConsoleOutput) + { + bool LastCommandWasClear = false; + + + switch (txtConsoleInput.Text.ToLower()) + { + + + case "help": + txtConsoleOutput.AppendText("help - lists the commands\r\ntest - displays a test message\r\nclear - clears the terminal\r\nchangeusername - changes your username for use with the Chatter application\r\n example: changeusername --TheBestUser" + Environment.NewLine); + break; + case "clear": + txtConsoleOutput.Clear(); + LastCommandWasClear = true; + break; + case "test": + txtConsoleOutput.AppendText("This is a test!\r\nof the EBS!" + Environment.NewLine); + break; + default: + if (txtConsoleInput.Text.StartsWith("changeusername --")) + { + txtConsoleOutput.AppendText("You have changed your username to " + txtConsoleInput.Text.Substring(17)); + Properties.Settings.Default.userDisplayName = txtConsoleInput.Text.Substring(17); + } + else + { + txtConsoleOutput.AppendText("Bad command. Reference the command list for commands that exist." + Environment.NewLine); + } + break; + } + + if (LastCommandWasClear == true) + { + LastCommandWasClear = false; + } + else + { + txtConsoleOutput.AppendText(Environment.NewLine); + } + + } + } +} diff --git a/PortEngine/app.config b/PortEngine/app.config index e543569..cb6d547 100644 --- a/PortEngine/app.config +++ b/PortEngine/app.config @@ -10,6 +10,9 @@ <setting name="graphicsFriendly" serializeAs="String"> <value>False</value> </setting> + <setting name="userDisplayName" serializeAs="String"> + <value>Player</value> + </setting> </PortEngine.Properties.Settings> </userSettings> </configuration>
\ No newline at end of file diff --git a/Project Ports/About.Designer.cs b/Project Ports/About.Designer.cs deleted file mode 100644 index 85a9a7d..0000000 --- a/Project Ports/About.Designer.cs +++ /dev/null @@ -1,78 +0,0 @@ -namespace Project_Ports -{ - partial class About - { - /// <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() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(About)); - this.richTextBox1 = new System.Windows.Forms.RichTextBox(); - this.button1 = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // richTextBox1 - // - this.richTextBox1.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.richTextBox1.Enabled = false; - this.richTextBox1.Location = new System.Drawing.Point(12, 31); - this.richTextBox1.Name = "richTextBox1"; - this.richTextBox1.Size = new System.Drawing.Size(416, 311); - this.richTextBox1.TabIndex = 0; - this.richTextBox1.Text = resources.GetString("richTextBox1.Text"); - // - // button1 - // - this.button1.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.button1.Location = new System.Drawing.Point(165, 362); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(97, 44); - this.button1.TabIndex = 1; - this.button1.Text = "Close"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // About - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(440, 418); - this.ControlBox = false; - this.Controls.Add(this.button1); - this.Controls.Add(this.richTextBox1); - this.Name = "About"; - this.Text = "About"; - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.RichTextBox richTextBox1; - private System.Windows.Forms.Button button1; - } -}
\ No newline at end of file diff --git a/Project Ports/About.cs b/Project Ports/About.cs deleted file mode 100644 index 3ab8ac1..0000000 --- a/Project Ports/About.cs +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************ - * - * Project Ports - * Copyright (C) 2018 AleeCorp - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - * - **************************************************************************/ -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; - -namespace Project_Ports -{ - public partial class About : Form - { - public About() - { - InitializeComponent(); - } - - private void button1_Click(object sender, EventArgs e) - { - this.Close(); - } - } -} diff --git a/Project Ports/About.resx b/Project Ports/About.resx deleted file mode 100644 index f4b7cd6..0000000 --- a/Project Ports/About.resx +++ /dev/null @@ -1,138 +0,0 @@ -<?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> - <data name="richTextBox1.Text" xml:space="preserve"> - <value> - Project Ports - Copyright (C) 2018 AleeCorp - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <https://www.gnu.org/licenses/></value> - </data> -</root>
\ No newline at end of file diff --git a/Project Ports/Programs/ChatApp.Designer.cs b/Project Ports/Programs/ChatApp.Designer.cs index c2200c1..f6a3dbd 100644 --- a/Project Ports/Programs/ChatApp.Designer.cs +++ b/Project Ports/Programs/ChatApp.Designer.cs @@ -57,6 +57,7 @@ this.txtMsgContents.Name = "txtMsgContents"; this.txtMsgContents.Size = new System.Drawing.Size(384, 18); this.txtMsgContents.TabIndex = 1; + this.txtMsgContents.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtMsgContents_KeyDown); // // listBox1 // diff --git a/Project Ports/Programs/ChatApp.cs b/Project Ports/Programs/ChatApp.cs index 593fa17..0e89077 100644 --- a/Project Ports/Programs/ChatApp.cs +++ b/Project Ports/Programs/ChatApp.cs @@ -21,7 +21,16 @@ namespace Project_Ports private void btnSendMSG_Click(object sender, EventArgs e) { - PortEngine.ChatAPI.SendMessage(txtMsgContents, txtSentMessages); + ChatAPI.SendMessage(txtMsgContents, txtSentMessages); + } + + private void txtMsgContents_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + ChatAPI.SendMessage(txtMsgContents, txtSentMessages); + e.SuppressKeyPress = true; + } } } } diff --git a/Project Ports/Programs/Terminal.Designer.cs b/Project Ports/Programs/Terminal.Designer.cs index 48e3ee4..c5c2807 100644 --- a/Project Ports/Programs/Terminal.Designer.cs +++ b/Project Ports/Programs/Terminal.Designer.cs @@ -28,30 +28,44 @@ /// </summary> private void InitializeComponent() { - this.textBox1 = new System.Windows.Forms.TextBox(); + this.txtConsole = new System.Windows.Forms.TextBox(); + this.txtInput = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // - // textBox1 + // txtConsole // - this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.txtConsole.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.BackColor = System.Drawing.Color.Black; - this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.textBox1.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.textBox1.ForeColor = System.Drawing.Color.White; - this.textBox1.Location = new System.Drawing.Point(0, 0); - this.textBox1.Multiline = true; - this.textBox1.Name = "textBox1"; - this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.textBox1.Size = new System.Drawing.Size(456, 337); - this.textBox1.TabIndex = 0; + this.txtConsole.BackColor = System.Drawing.Color.Black; + this.txtConsole.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.txtConsole.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txtConsole.ForeColor = System.Drawing.Color.White; + this.txtConsole.Location = new System.Drawing.Point(-3, 0); + this.txtConsole.Multiline = true; + this.txtConsole.Name = "txtConsole"; + this.txtConsole.ReadOnly = true; + this.txtConsole.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtConsole.Size = new System.Drawing.Size(456, 321); + this.txtConsole.TabIndex = 3; + // + // txtInput + // + this.txtInput.BackColor = System.Drawing.SystemColors.WindowText; + this.txtInput.Font = new System.Drawing.Font("Lucida Console", 8F); + this.txtInput.ForeColor = System.Drawing.SystemColors.Window; + this.txtInput.Location = new System.Drawing.Point(0, 319); + this.txtInput.Name = "txtInput"; + this.txtInput.Size = new System.Drawing.Size(456, 18); + this.txtInput.TabIndex = 4; + this.txtInput.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtInput_KeyDown); // // Terminal // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.textBox1); + this.Controls.Add(this.txtInput); + this.Controls.Add(this.txtConsole); this.Name = "Terminal"; this.Size = new System.Drawing.Size(456, 337); this.Load += new System.EventHandler(this.Terminal_Load); @@ -62,6 +76,7 @@ #endregion - private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox txtConsole; + public System.Windows.Forms.TextBox txtInput; } } diff --git a/Project Ports/Programs/Terminal.cs b/Project Ports/Programs/Terminal.cs index c878c32..55cf8ed 100644 --- a/Project Ports/Programs/Terminal.cs +++ b/Project Ports/Programs/Terminal.cs @@ -23,5 +23,15 @@ namespace Project_Ports { WindowManager wm = new WindowManager(); } + + private void txtInput_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + TerminalAPI.RunCommand(txtInput, txtConsole); + e.SuppressKeyPress = true; + txtInput.Clear(); + } + } } } diff --git a/Project Ports/Project Ports.csproj b/Project Ports/Project Ports.csproj index ee43be4..b33ed52 100644 --- a/Project Ports/Project Ports.csproj +++ b/Project Ports/Project Ports.csproj @@ -45,12 +45,6 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> - <Compile Include="About.cs"> - <SubType>Form</SubType> - </Compile> - <Compile Include="About.Designer.cs"> - <DependentUpon>About.cs</DependentUpon> - </Compile> <Compile Include="AboutPorts.cs"> <SubType>UserControl</SubType> </Compile> @@ -106,9 +100,6 @@ <Compile Include="Programs\TestWindow.Designer.cs"> <DependentUpon>TestWindow.cs</DependentUpon> </Compile> - <EmbeddedResource Include="About.resx"> - <DependentUpon>About.cs</DependentUpon> - </EmbeddedResource> <EmbeddedResource Include="AboutPorts.resx"> <DependentUpon>AboutPorts.cs</DependentUpon> </EmbeddedResource> |
