Пример #1
0
        /// <summary>
        /// Opens a data stream using the format and mode specified
        /// </summary>
        /// <param name="type">Type of data channel to use</param>
        /// <returns>Data Stream Object</returns>
        public FtpDataStream OpenDataStream(FtpDataType type)
        {
            FtpDataStream stream = null;

            this.SetDataType(type);

            switch (this.DataChannelType)
            {
            case FtpDataChannelType.Passive:
            case FtpDataChannelType.ExtendedPassive:
                stream = new FtpPassiveStream(this);
                break;

            case FtpDataChannelType.Active:
            case FtpDataChannelType.ExtendedActive:
                stream = new FtpActiveStream(this);
                break;
            }

            if (stream != null)
            {
                stream.ReadTimeout = this.DataChannelReadTimeout;
            }

            return(stream);
        }
        /// <summary>
        /// Opens a data stream using the format and mode specified
        /// </summary>
        /// <param name="type">Type of data channel to use</param>
        /// <returns>Data Stream Object</returns>
        public FtpDataStream OpenDataStream(FtpDataType type) {
            FtpDataStream stream = null;

            this.SetDataType(type);

            switch (this.DataChannelType) {
                case FtpDataChannelType.Passive:
                case FtpDataChannelType.ExtendedPassive:
                    stream = new FtpPassiveStream(this);
                    break;
                case FtpDataChannelType.Active:
                case FtpDataChannelType.ExtendedActive:
                    stream = new FtpActiveStream(this);
                    break;
            }

            if (stream != null) {
                stream.ReadTimeout = this.DataChannelReadTimeout;
            }

            return stream;
        }