Example #1
0
        public byte[] Serialize()
        {
            var result = new MemoryStream();
            var parameters = new byte[0];

            foreach (var p in Properties)
                parameters = ArrayUtil.ConcatArrays(parameters, p.Serialize());

            var resultTitle = new AMFProperty("", Name, AMF0Types.String).Serialize();

            var header = new Header()
            {
                ChunkStreamID = 3,
                Format = 0,
                StreamID = 0,
                Timestamp = 0,
                TypeID = 0x14,
                BodySize = parameters.Length + resultTitle.Length
            }.Serialize();

            result.Write(header, 0 ,header.Length);
            result.Write( resultTitle, 0, resultTitle.Length  );
            result.Write(parameters, 0, parameters.Length);

            result.Flush();

            var byteResult = result.ToArray();
            Length = byteResult.Length;
            return byteResult;
        }
Example #2
0
        public byte[] Serialize()
        {
            var result     = new MemoryStream();
            var parameters = new byte[0];

            foreach (var p in Properties)
            {
                parameters = ArrayUtil.ConcatArrays(parameters, p.Serialize());
            }

            var resultTitle = new AMFProperty("", Name, AMF0Types.String).Serialize();

            var header = new Header()
            {
                ChunkStreamID = 3,
                Format        = 0,
                StreamID      = 0,
                Timestamp     = 0,
                TypeID        = 0x14,
                BodySize      = parameters.Length + resultTitle.Length
            }.Serialize();

            result.Write(header, 0, header.Length);
            result.Write(resultTitle, 0, resultTitle.Length);
            result.Write(parameters, 0, parameters.Length);

            result.Flush();

            var byteResult = result.ToArray();

            Length = byteResult.Length;
            return(byteResult);
        }
Example #3
0
 public AMFCall(byte[] payload)
 {
     Name = "";
     _properties = new List<AMFProperty>();
     for (int i = 0; i < payload.Length; i++)
     {
         var prop = new AMFProperty(payload, i);
         _properties.Add(prop);
         i += prop.Length - 1;
     }
 }
Example #4
0
 public AMFCall(byte[] payload)
 {
     Name        = "";
     _properties = new List <AMFProperty>();
     for (int i = 0; i < payload.Length; i++)
     {
         var prop = new AMFProperty(payload, i);
         _properties.Add(prop);
         i += prop.Length - 1;
     }
 }