SmtpServer.Protocol.SmtpCommandFactory.TryMakeNoop C# (CSharp) 메소드

TryMakeNoop() 공개 메소드

Make an NOOP command from the given enumerator.
public TryMakeNoop ( TokenEnumerator enumerator, SmtpCommand &command, SmtpResponse &errorResponse ) : bool
enumerator SmtpServer.Protocol.Text.TokenEnumerator The enumerator to create the command from.
command SmtpCommand The NOOP command that is defined within the token enumerator.
errorResponse SmtpResponse The error that indicates why the command could not be made.
리턴 bool
        public bool TryMakeNoop(TokenEnumerator enumerator, out SmtpCommand command, out SmtpResponse errorResponse)
        {
            Debug.Assert(enumerator.Peek() == new Token(TokenKind.Text, "NOOP"));

            command = null;
            errorResponse = null;

            enumerator.Take();
            enumerator.TakeWhile(TokenKind.Space);

            if (enumerator.Count > 1)
            {
                _logger.LogVerbose("NOOP command can not have parameters (found {0} parameters).", enumerator.Count);

                errorResponse = SmtpResponse.SyntaxError;
                return false;
            }

            command = NoopCommand.Instance;
            return true;
        }