AMF serialization options.
예제 #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="options">Encoding options.</param>
        public AmfPacketDecoder(AmfEncodingOptions options)
        {
            if (!options.UseContextSwitch)
                throw new ArgumentException(Errors.AmfPacketReader_AmfPacketReader_ContextSwitchRequired, "options");

            _options = options;
        }
예제 #2
0
        /// <summary>
        /// Returns a custom binding element object.
        /// </summary>
        protected override BindingElement CreateBindingElement()
        {
            var options = new AmfEncodingOptions
            {
                AmfVersion = Version,
                UseContextSwitch = true
            };

            return new AmfEncodingBindingElement(options);
        }
예제 #3
0
파일: AmfEncoder.cs 프로젝트: artema/DotAmf
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="encodingOptions">AMF encoding options.</param>
        public AmfEncoder(AmfEncodingOptions encodingOptions)
        {
            //Construct the default content type string
            _contentType = string.Format(
                "{0}; charset={1}",
                AmfEncoderFactory.DefaultAmfMediaType,
                AmfEncoderFactory.DefaultAmfCharSet
            );

            _serializer = new DataContractAmfSerializer(typeof(AmfPacket), encodingOptions);
        }
예제 #4
0
 public Amf3Encoder(AmfEncodingOptions encodingOptions)
     : base(encodingOptions)
 {
 }
예제 #5
0
 public Amf3Decoder(AmfEncodingOptions options)
     : base(options)
 {
 }
예제 #6
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="options">Encoding options.</param>
 public AmfPacketEncoder(AmfEncodingOptions options)
 {
     _options = options;
 }
예제 #7
0
        /// <summary>
        /// Create an AMF encoder.
        /// </summary>
        /// <param name="options">Encoding options.</param>
        private static IAmfEncoder CreateEncoder(AmfEncodingOptions options)
        {
            switch (options.AmfVersion)
            {
                case AmfVersion.Amf0:
                    return new Amf0Encoder(options);

                case AmfVersion.Amf3:
                    return new Amf3Encoder(options);

                default:
                    throw new NotSupportedException();
            }
        }
예제 #8
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="encodingOptions">AMF encoding options.</param>
 protected AbstractAmfEncoder(AmfEncodingOptions encodingOptions)
 {
     EncodingOptions = encodingOptions;
 }
예제 #9
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="encodingOptions">AMF encoding options.</param>
 public AmfEncoderFactory(AmfEncodingOptions encodingOptions)
 {
     //Create an encoder instance for future use
     _encoder = new AmfEncoder(encodingOptions);
 }
예제 #10
0
 /// <summary>
 /// Initializes a new instance of the DataContractAmfSerializer class to serialize or deserialize an object of the specified type.
 /// </summary>
 /// <param name="type">A Type that specifies the type of the instances that is serialized or deserialized.</param>
 /// <param name="encodingOptions">AMF encoding options.</param>
 /// <exception cref="InvalidDataContractException">At least one of the types being serialized or deserialized does not conform to data contract rules.
 /// For example, the DataContractAttribute attribute has not been applied to the type.</exception>
 public DataContractAmfSerializer(Type type, AmfEncodingOptions encodingOptions)
     : this(type, new List<Type>(), encodingOptions)
 {
 }
예제 #11
0
        /// <summary>
        /// Initializes a new instance of the DataContractAmfSerializer class to serialize or deserialize an object of the specified type, 
        /// and a collection of known types that may be present in the object graph.
        /// </summary>
        /// <param name="type">A Type that specifies the type of the instances that is serialized or deserialized.</param>
        /// <param name="knownTypes">An IEnumerable of Type that contains the types that may be present in the object graph.</param>
        /// <param name="encodingOptions">AMF encoding options.</param>
        /// <exception cref="InvalidDataContractException">At least one of the types being serialized or deserialized does not conform to data contract rules.
        /// For example, the DataContractAttribute attribute has not been applied to the type.</exception>
        public DataContractAmfSerializer(Type type, IEnumerable<Type> knownTypes, AmfEncodingOptions encodingOptions)
        {
            if (type == null) throw new ArgumentNullException("type");
            _type = PrepareDataContract(type);

            if (knownTypes == null) throw new ArgumentNullException("knownTypes");
            _knownTypes = PrepareDataContracts(knownTypes);
            _knownTypes[_type.Key] = _type.Value;

            _encodingOptions = encodingOptions;
        }
예제 #12
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="decodingOptions">AMF decoding options.</param>
 protected AbstractAmfDecoder(AmfEncodingOptions decodingOptions)
 {
     DecodingOptions = decodingOptions;
 }