コード例 #1
0
        bool ReadCommand()
        {
            if (!ReceiveBuffer.Contains(new byte[] { 13, 10 }))
            {
                return(false);
            }

            string     line    = reader.ReadLine();
            FtpCommand command = line.BeforeFirst(' ').ToUpperInvariant().Parse((FtpCommand)0);

            Trace.TraceInformation("{0}-> {1}", RemoteEndPoint, line);
            if (!commands.TryGetValue(command, out Action <string> action))
            {
                SendAnswer("502 Command not implemented.");
            }
            else
            {
                action(line.AfterFirst(' '));
            }
            return(true);
        }