コード例 #1
0
        private string Type(string typeCode, string formatControl)
        {
            switch (typeCode.ToUpperInvariant())
            {
            case "A":
                _connectionType = TransferType.Ascii;
                break;

            case "I":
                _connectionType = TransferType.Image;
                break;

            default:
                return("504 Command not implemented for that parameter");
            }

            if (!string.IsNullOrWhiteSpace(formatControl))
            {
                switch (formatControl.ToUpperInvariant())
                {
                case "N":
                    _formatControlType = FormatControlType.NonPrint;
                    break;

                default:
                    return("504 Command not implemented for that parameter");
                }
            }

            return(string.Format("200 Type set to {0}", _connectionType));
        }
コード例 #2
0
        private string Type(string typeCode, string formatControl)
        {
            switch (typeCode.ToUpperInvariant())
            {
            case "A":
                _connectionType = TransferType.Ascii;
                break;

            case "I":
                _connectionType = TransferType.Image;
                break;

            default:
                return("504 Command not implemented for that parameter");
            }

            if (!string.IsNullOrWhiteSpace(formatControl))
            {
                switch (formatControl.ToUpperInvariant())
                {
                case "N":
                    _formatControlType = FormatControlType.NonPrint;
                    break;

                default:
                    return("504 Command not implemented for that parameter");
                }
            }

            // eschew 'field assigned but its value is never used' warning
            System.Diagnostics.Debug.WriteLine($"_formatControlType = {_formatControlType}");
            return(string.Format("200 Type set to {0}", _connectionType));
        }
コード例 #3
0
        /// <summary>
        /// TYPE Command - RFC 959 - Section 4.1.2
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        private Response Type(string typeCode, string formatControl)
        {
            switch (typeCode.ToUpperInvariant())
            {
                case "A":
                    _connectionType = TransferType.Ascii;
                    break;
                case "I":
                    _connectionType = TransferType.Image;
                    break;
                default:
                    return GetResponse(FtpResponses.NOT_IMPLEMENTED_FOR_PARAMETER);
            }

            if (!string.IsNullOrWhiteSpace(formatControl))
            {
                switch (formatControl.ToUpperInvariant())
                {
                    case "N":
                        _formatControlType = FormatControlType.NonPrint;
                        break;
                    default:
                        return GetResponse(FtpResponses.NOT_IMPLEMENTED_FOR_PARAMETER);
                }
            }

            return GetResponse(FtpResponses.OK);
        }
コード例 #4
0
ファイル: ClientConnection.cs プロジェクト: Mortion/Uses
        private string Type(string typeCode, string formatControl)
        {
            switch (typeCode.ToUpperInvariant())
            {
                case "A":
                    _connectionType = TransferType.Ascii;
                    break;
                case "I":
                    _connectionType = TransferType.Image;
                    break;
                default:
                    return "504 Command not implemented for that parameter";
            }

            if (!string.IsNullOrWhiteSpace(formatControl))
            {
                switch (formatControl.ToUpperInvariant())
                {
                    case "N":
                        _formatControlType = FormatControlType.NonPrint;
                        break;
                    default:
                        return "504 Command not implemented for that parameter";
                }
            }

            return string.Format("200 Type set to {0}", _connectionType);
        }