diff --git a/mainWindow.cs b/mainWindow.cs index 75318bf..052cd1a 100644 --- a/mainWindow.cs +++ b/mainWindow.cs @@ -19,11 +19,17 @@ namespace Pithos InitializeComponent(); } public void display(string text, Color colour) { + /* Message Color Codes: + * Green: User Messages (Mainly Echo) + * Orange: Admin Commands + * Black: General text / Date + * Red: Error Messages + * Blue: Messages from Program + */ if (output.TextLength != 0) { output.AppendText("\n[" + DateTime.Now.ToString("hh:mm:ss") + "] "); } //so that the first line isnt a new line for no reason. (although its extra code) else { output.AppendText("[" + DateTime.Now.ToString("hh:mm:ss") + "] "); } - int length = output.TextLength; - text = decoder.injectVariables(text); //injects variables into string + text = decoder.injectVariables(text); output.AppendText(text); output.SelectionStart = length; output.SelectionLength = text.Length; @@ -33,13 +39,14 @@ namespace Pithos } private void mainWindow_Load(object sender, EventArgs e) { - display("Currently Logged in as: " + Environment.UserDomainName + "\\" + Environment.UserName, Color.Red); + display("Currently Logged in as: " + Environment.UserDomainName + "\\" + Environment.UserName, Color.Blue); } private void executeButton_Click(object sender, EventArgs e) { + bool valid = true; string input = inputBox.Text; - if (input == "") { return; } //if its empty, dont bother decoding + if (input == "") { display("Error: No command given.", Color.Red); return; } //if its empty, dont bother decoding string initChar = input.Substring(0, 1); //gets the first character in the input string[] args = input.Substring(1).Split(' '); //splits the input by spaces, and removes init character switch (initChar) @@ -54,10 +61,10 @@ namespace Pithos { } - else { decoder.command(input); } //decode other commands + else { valid = decoder.command(input); } //decode other commands break; case "¦": //admin commands - + privateFunctions.adminCommands(input); break; }