From 320172a12642674a1e4095cef3f1acc0be87b123 Mon Sep 17 00:00:00 2001 From: yankejustin Date: Wed, 27 May 2015 15:11:44 -0400 Subject: [PATCH] Perfected handling of exiting Perfected how handling an exit command is determined. Also removed a command to execute an "exit" command on the client because we call "this.Close()". On FormClosing(object, FormClosingEventArgs), we send an "exit" command anyways. Two of them should not be sent to close the client's shell... --- Server/Forms/FrmRemoteShell.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Server/Forms/FrmRemoteShell.cs b/Server/Forms/FrmRemoteShell.cs index 4578c4e0..da0e2e68 100644 --- a/Server/Forms/FrmRemoteShell.cs +++ b/Server/Forms/FrmRemoteShell.cs @@ -70,12 +70,16 @@ namespace xServer.Forms string input = txtConsoleInput.Text; txtConsoleInput.Text = string.Empty; + // Split based on the space key. + string[] splitSpaceInput = input.Split(' '); + // Split based on the null key. + string[] splitNullInput = input.Split(' '); + // We have an exit command. if (input == "exit" || input.Trim() == "exit" || - // Space character null-character - input.Split(' ').Contains("exit") || input.Split(' ').Contains("exit")) + ((splitSpaceInput.Length > 0) && splitSpaceInput.Contains("exit")) || + ((splitNullInput.Length > 0) && splitNullInput.Contains("exit"))) { - new Core.Packets.ServerPackets.ShellCommand("exit").Execute(_connectClient); this.Close(); } else