/// <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; }
/// <summary> /// Returns a custom binding element object. /// </summary> protected override BindingElement CreateBindingElement() { var options = new AmfEncodingOptions { AmfVersion = Version, UseContextSwitch = true }; return new AmfEncodingBindingElement(options); }
/// <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); }
public Amf3Encoder(AmfEncodingOptions encodingOptions) : base(encodingOptions) { }
public Amf3Decoder(AmfEncodingOptions options) : base(options) { }
/// <summary> /// Constructor. /// </summary> /// <param name="options">Encoding options.</param> public AmfPacketEncoder(AmfEncodingOptions options) { _options = options; }
/// <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(); } }
/// <summary> /// Constructor. /// </summary> /// <param name="encodingOptions">AMF encoding options.</param> protected AbstractAmfEncoder(AmfEncodingOptions encodingOptions) { EncodingOptions = encodingOptions; }
/// <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); }
/// <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) { }
/// <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; }
/// <summary> /// Constructor. /// </summary> /// <param name="decodingOptions">AMF decoding options.</param> protected AbstractAmfDecoder(AmfEncodingOptions decodingOptions) { DecodingOptions = decodingOptions; }