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...
This commit is contained in:
yankejustin 2015-05-27 15:11:44 -04:00
parent 39a717c626
commit 320172a126
1 changed files with 7 additions and 3 deletions

View File

@ -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