Ejemplo n.º 1
0
        /// <summary>
        ///     Returns a custom binding element object.
        /// </summary>
        /// <returns>
        ///     The <see cref="BindingElement" />.
        /// </returns>
        protected override BindingElement CreateBindingElement()
        {
            var options = new AmfEncodingOptions {
                AmfVersion = this.Version, UseContextSwitch = true
            };

            return(new AmfEncodingBindingElement(options));
        }
Ejemplo n.º 2
0
 public Amf3EncoderTest()
 {
     _options = new AmfEncodingOptions
     {
         AmfVersion       = AmfVersion.Amf3,
         UseContextSwitch = false
     };
 }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AmfEncoder"/> class.
        ///     Constructor.
        /// </summary>
        /// <param name="encodingOptions">
        /// AMF encoding options.
        /// </param>
        public AmfEncoder(AmfEncodingOptions encodingOptions)
        {
            // Construct the default content type string
            this._contentType = string.Format(
                "{0}; charset={1}",
                AmfEncoderFactory.DefaultAmfMediaType,
                AmfEncoderFactory.DefaultAmfCharSet);

            this._serializer = new DataContractAmfSerializer(typeof(AmfPacket), encodingOptions);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Create an AMF encoder.
        /// </summary>
        /// <param name="options">Encoding options.</param>
        static private 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();
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Create AMF decoder.
        /// </summary>
        /// <param name="version">AMF packet version.</param>
        /// <param name="options">Encoding options.</param>
        private static IAmfDecoder CreateDecoder(AmfVersion version, AmfEncodingOptions options)
        {
            switch (version)
            {
            case AmfVersion.Amf0:
                return(new Amf0Decoder(options));

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

            default:
                throw new NotSupportedException();
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AmfEncoderFactory"/> class.
 ///     Constructor.
 /// </summary>
 /// <param name="encodingOptions">
 /// AMF encoding options.
 /// </param>
 public AmfEncoderFactory(AmfEncodingOptions encodingOptions)
 {
     // Create an encoder instance for future use
     this._encoder = new AmfEncoder(encodingOptions);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Amf3Decoder"/> class.
 /// </summary>
 /// <param name="options">
 /// The options.
 /// </param>
 public Amf3Decoder(AmfEncodingOptions options)
     : base(options)
 {
 }
Ejemplo n.º 9
0
 public Amf0Encoder(AmfEncodingOptions encodingOptions)
     : base(encodingOptions)
 {
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AbstractAmfDecoder"/> class.
 ///     Constructor.
 /// </summary>
 /// <param name="decodingOptions">
 /// AMF decoding options.
 /// </param>
 protected AbstractAmfDecoder(AmfEncodingOptions decodingOptions)
 {
     this.DecodingOptions = decodingOptions;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="encodingOptions">AMF encoding options.</param>
 protected AbstractAmfEncoder(AmfEncodingOptions encodingOptions)
 {
     EncodingOptions = encodingOptions;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="options">Encoding options.</param>
 public AmfPacketEncoder(AmfEncodingOptions options)
 {
     _options = options;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="encodingOptions">AMF encoding options.</param>
 public AmfEncodingBindingElement(AmfEncodingOptions encodingOptions)
 {
     _encodingOptions = encodingOptions;
 }