public AmfObject(AmfTypes type) { Type = type; if (type == AmfTypes.Object) { Trait = new AmfTrait { Name = "", IsDynamic = true, Properties = new string[0] }; } }
AmfObject ReadVector(AmfTypes type) { // Stored by ref? bool isInstance; int lengthOrIndex = ReadU29(out isInstance); if (!isInstance) { return((AmfObject)_objectLookup[lengthOrIndex]); } // Stored by value var result = new AmfObject(type); _objectLookup.Add(result); result.IsFixedVector = _reader.ReadBoolean(); if (type == AmfTypes.VectorGeneric) { result.GenericElementType = ReadString(); } for (int j = 0; j < lengthOrIndex; ++j) { switch (type) { case AmfTypes.VectorInt: result.Push(ReadI32()); break; case AmfTypes.VectorUInt: result.Push(ReadU32()); break; case AmfTypes.VectorDouble: result.Push(ReadDouble()); break; case AmfTypes.VectorGeneric: result.Push(ReadValue()); break; default: throw new NotImplementedException(); } } return(result); }
AmfObject ReadVector(AmfTypes type) { // Stored by ref? bool isInstance; int lengthOrIndex = ReadU29(out isInstance); if (!isInstance) return (AmfObject)_objectLookup[lengthOrIndex]; // Stored by value var result = new AmfObject(type); _objectLookup.Add(result); result.IsFixedVector = _reader.ReadBoolean(); if (type == AmfTypes.VectorGeneric) result.GenericElementType = ReadString(); for (int j = 0; j < lengthOrIndex; ++j) { switch (type) { case AmfTypes.VectorInt: result.Push(ReadI32()); break; case AmfTypes.VectorUInt: result.Push(ReadU32()); break; case AmfTypes.VectorDouble: result.Push(ReadDouble()); break; case AmfTypes.VectorGeneric: result.Push(ReadValue()); break; default: throw new NotImplementedException(); } } return result; }