Пример #1
0
        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]);
                }
            }
        }
Пример #2
0
 private void AddCommand(FtpCommand handler)
 {
     m_theCommandHashTable.Add(handler.Command, handler);
 }