コード例 #1
0
        private Task <IFtpResponse> HandleAdatAsync(string argument, CancellationToken cancellationToken)
        {
            if (_filteredAuthenticationMechanism is null)
            {
                return(Task.FromResult <IFtpResponse>(new FtpResponse(503, T("Bad sequence of commands"))));
            }

            byte[] data;
            if (string.IsNullOrWhiteSpace(argument))
            {
                data = new byte[0];
            }
            else
            {
                try
                {
                    data = Convert.FromBase64String(argument);
                }
                catch (FormatException)
                {
                    return(Task.FromResult <IFtpResponse>(new FtpResponse(501, T("Syntax error in parameters or arguments."))));
                }
            }

            return(_filteredAuthenticationMechanism.HandleAdatAsync(data, cancellationToken));
        }