public void Execute(string[] param, Client client) { FtpCommand command = m_theCommandHashTable[param[0]] as FtpCommand; if (command == null) { SocketHelpers.Send(client.client, "550 Unknown command\r\n"); serverControl.serverForm.Invoke((MethodInvoker) delegate { Font font = new Font("Tahoma", 8, FontStyle.Regular); serverControl.serverForm.textBox1.SelectionFont = font; serverControl.serverForm.textBox1.SelectionColor = Color.Green; serverControl.serverForm.textBox1.SelectedText = "550 Unknown command" + Environment.NewLine; }); } else { serverControl.serverForm.Invoke((MethodInvoker) delegate { Font font = new Font("Tahoma", 8, FontStyle.Regular); serverControl.serverForm.textBox1.SelectionFont = font; serverControl.serverForm.textBox1.SelectionColor = Color.Green; serverControl.serverForm.textBox1.SelectedText = "FtpClent command " + param[0] + Environment.NewLine; }); string arg = param.Length < 2 ? "" : param[1]; for (int i = 2; i < param.Length; i++) { arg += " " + param[i]; } string Mes = command.OnProcess(arg, client); string[] items = Mes.Split('^'); SocketHelpers.Send(client.client, items[0]); if (items.Length > 1) { SocketHelpers.Send(client.client, items[1]); } } }
public bool Send(char[] abChars, int nSize) { return(SocketHelpers.Send(m_theSocket, Encoding.ASCII.GetBytes(abChars), 0, nSize)); }
public void Close() { SocketHelpers.Close(m_theSocket); m_theSocket = null; }
public bool Send(byte[] abData, int nSize) { return(SocketHelpers.Send(m_theSocket, abData, 0, nSize)); }