Description about an option
Exemplo n.º 1
0
        /// <summary>
        /// Deserialise FileZilla binary data into object
        /// </summary>
        /// <param name="reader">Binary reader to read data from</param>
        /// <param name="protocolVersion">Current FileZilla protocol version</param>
        /// <param name="index">The 0 based index of this item in relation to any parent list</param>
        public void Deserialize(BinaryReader reader, int protocolVersion, int index)
        {
            OptionType = (OptionType)reader.ReadByte();
            switch (OptionType)
            {
                case OptionType.Text:
                    TextValue = reader.ReadText24();
                    break;
                case OptionType.Numeric:
                    NumericValue = reader.ReadInt64();
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }
            _optionInfo = GetOptionInfo(protocolVersion, index);
#if DEBUG
            if (_optionInfo.OptionType != OptionType)
                throw new ProtocolException("OptionType mismatch at index " + index);
#endif
        }
Exemplo n.º 2
0
        /// <summary>
        /// Deserialise FileZilla binary data into object
        /// </summary>
        /// <param name="reader">Binary reader to read data from</param>
        /// <param name="protocolVersion">Current FileZilla protocol version</param>
        /// <param name="index">The 0 based index of this item in relation to any parent list</param>
        public void Deserialize(BinaryReader reader, int protocolVersion, int index)
        {
            OptionType = (OptionType)reader.ReadByte();
            switch (OptionType)
            {
            case OptionType.Text:
                TextValue = reader.ReadText24();
                break;

            case OptionType.Numeric:
                NumericValue = reader.ReadInt64();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            _optionInfo = GetOptionInfo(protocolVersion, index);
#if DEBUG
            if (_optionInfo.OptionType != OptionType)
            {
                throw new ProtocolException("OptionType mismatch at index " + index);
            }
#endif
        }