From ee343916c292c741041167a1a77f4b59a95002c5 Mon Sep 17 00:00:00 2001 From: TheEdgeNK Date: Sun, 26 Aug 2018 14:15:03 -0400 Subject: Ability to change chatter username, also, terminal! --- PortEngine/ChatAPI.cs | 2 +- PortEngine/PortEngine.csproj | 1 + PortEngine/Properties/Settings.Designer.cs | 14 +++++++- PortEngine/Properties/Settings.settings | 3 ++ PortEngine/TerminalAPI.cs | 55 ++++++++++++++++++++++++++++++ PortEngine/app.config | 3 ++ 6 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 PortEngine/TerminalAPI.cs (limited to 'PortEngine') 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(" " + 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 @@ True Settings.settings + Form 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 @@ False + + Player + \ 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 @@ False + + Player + \ No newline at end of file -- cgit v1.2.3