Beispiel #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));
        }
Beispiel #2
0
 public Amf3EncoderTest()
 {
     _options = new AmfEncodingOptions
     {
         AmfVersion       = AmfVersion.Amf3,
         UseContextSwitch = false
     };
 }
Beispiel #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;
        }
Beispiel #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);
        }
Beispiel #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();
            }
        }
Beispiel #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();
            }
        }
Beispiel #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);
 }
Beispiel #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)
 {
 }
Beispiel #9
0
 public Amf0Encoder(AmfEncodingOptions encodingOptions)
     : base(encodingOptions)
 {
 }
Beispiel #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;
 }
Beispiel #11
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="encodingOptions">AMF encoding options.</param>
 protected AbstractAmfEncoder(AmfEncodingOptions encodingOptions)
 {
     EncodingOptions = encodingOptions;
 }
Beispiel #12
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="options">Encoding options.</param>
 public AmfPacketEncoder(AmfEncodingOptions options)
 {
     _options = options;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="encodingOptions">AMF encoding options.</param>
 public AmfEncodingBindingElement(AmfEncodingOptions encodingOptions)
 {
     _encodingOptions = encodingOptions;
 }