protected static object ReadAmf(Stream stm, ref bool objEnd) { int type = stm.ReadByte(); bool oe = true; switch ((DataType)type) { case DataType.Number: return(CDataHelper.BE_ReadDouble(stm)); case DataType.Boolean: return(stm.ReadByte() != 0x0); case DataType.String: return(CDataHelper.BE_ReadShortStr(stm)); case DataType.Object: return(ReadHashObject(stm)); case DataType.MovieClip: break; case DataType.Null: return(null); case DataType.Undefined: return(null); case DataType.Reference: break; case DataType.MixedArray: CDataHelper.BE_ReadUInt32(stm); // highest numeric index return(ReadHashObject(stm)); case DataType.EndOfObject: objEnd = true; return(null); case DataType.Array: { uint len = CDataHelper.BE_ReadUInt32(stm); object[] ary = new object[len]; for (uint i = 0; i < len; i++) { ary[i] = ReadAmf(stm, ref oe); } return(ary); } case DataType.Date: break; case DataType.LongString: return(CDataHelper.BE_ReadLongStr(stm)); case DataType.Unsupported: return(null); case DataType.Recordset: break; case DataType.XML: break; case DataType.TypedObject: break; case DataType.AMF3data: return(CAmf3Helper.Read(stm)); default: break; } return(null); }
public static void Write3(Stream stm, object obj) { stm.WriteByte((byte)DataType.AMF3data); CAmf3Helper.Write(stm, obj); }