public static DsoAmfHeader Read(AMFReader reader) { reader.Reset(); ushort nameLen = reader.ReadUInt16(); string name = reader.ReadUTF(nameLen); bool required = (reader.ReadByte() > 0); // find the must understand flag uint dataLen = reader.ReadUInt32(); object headObj = reader.ReadData(); DsoAmfHeader header = new DsoAmfHeader(name, required, headObj); return header; }
public static DsoAmfHeader Read(AMFReader reader) { reader.Reset(); ushort nameLen = reader.ReadUInt16(); string name = reader.ReadUTF(nameLen); bool required = (reader.ReadByte() > 0); // find the must understand flag uint dataLen = reader.ReadUInt32(); object headObj = reader.ReadData(); DsoAmfHeader header = new DsoAmfHeader(name, required, headObj); return(header); }
public void Read(byte[] data) { using (MemoryStream ms = new MemoryStream(data)) { using (AMFReader amf = new AMFReader(ms)) { Header = new List <object>(); Bodies = new List <object>(); // AMF0_VERSION = 0; // AMF1_VERSION = 1; // There is no AMF1 but FMS uses it for some reason, hence special casing. // AMF3_VERSION = 3; ushort version = amf.ReadUInt16(); // Number of headers ushort numHeaders = amf.ReadUInt16(); while (numHeaders-- > 0) { var head = DsoAmfHeader.Read(amf); if (head != null) { Bodies.Add(head); } } // Number of bodys ushort numBodies = amf.ReadUInt16(); while (numBodies-- > 0) { var body = DsoAmfBody.Read(amf); if (body != null) { Bodies.Add(body); } } } } }