protected void handleChatInput(String line)
{
if (line.Length > 0)
{
if (quitHelperMessageShow && (line == "q" || line == "Q"))
{
Console.WriteLine();
enqueuePluginChatMessage("If you are trying to quit, use the /quit command.", true);
quitHelperMessageShow = false;
}
if (line.ElementAt(0) == '/')
{
String line_lower = line.ToLower();
if (line_lower == "/quit")
{
intentionalConnectionEnd = true;
endSession = true;
sendConnectionEndMessage("Quit");
}
else if (line_lower == "/crash")
{
Object o = null;
o.ToString();
}
else if (line_lower == "/ping")
{
if (!pingStopwatch.IsRunning)
{
sendMessageTCP(KLFCommon.ClientMessageID.PING, null);
pingStopwatch.Start();
}
}
else if (line_lower.Length > (KLFCommon.SHARE_CRAFT_COMMAND.Length + 1)
&& line_lower.Substring(0, KLFCommon.SHARE_CRAFT_COMMAND.Length) == KLFCommon.SHARE_CRAFT_COMMAND)
{
//Share a craft file
String craft_name = line.Substring(KLFCommon.SHARE_CRAFT_COMMAND.Length + 1);
byte craft_type = 0;
String filename = findCraftFilename(craft_name, ref craft_type);
if (filename != null && filename.Length > 0)
{
try
{
byte[] craft_bytes = File.ReadAllBytes(filename);
sendShareCraftMessage(craft_name, craft_bytes, craft_type);
}
catch
{
enqueueTextMessage("Error reading craft file: " + filename);
}
}
else
enqueueTextMessage("Craft file not found: " + craft_name);
}
}
else
{
sendTextMessage(line);
}
}
}