/// <summary> /// Ensures that the next byte is an EndOfObject type code and consumes it. /// </summary> private void ConsumeEndOfObject() { AMF0ObjectTypeCode typeCode = (AMF0ObjectTypeCode)input.ReadByte(); if (typeCode != AMF0ObjectTypeCode.EndOfObject) { throw new AMFException(String.Format(CultureInfo.CurrentCulture, ExceptionPrefix + "Expected EndOfObject token but encountered '{0}' instead.", typeCode)); } }
public IASValue ReadObject() { if (!isAMF3) { // Decide what to do based on the type code. AMF0ObjectTypeCode typeCode = (AMF0ObjectTypeCode)input.ReadByte(); switch (typeCode) { case AMF0ObjectTypeCode.AMF3Data: isAMF3 = true; return(amf3ObjectReader.ReadObject()); case AMF0ObjectTypeCode.Array: return(ReadArray()); case AMF0ObjectTypeCode.Boolean: return(ReadBoolean()); case AMF0ObjectTypeCode.Date: return(ReadDate()); case AMF0ObjectTypeCode.LongString: return(ReadLongString()); case AMF0ObjectTypeCode.MixedArray: return(ReadMixedArray()); case AMF0ObjectTypeCode.Null: return(null); case AMF0ObjectTypeCode.Number: return(ReadNumber()); case AMF0ObjectTypeCode.Object: return(ReadObjectValue()); case AMF0ObjectTypeCode.Reference: return(ReadReference()); case AMF0ObjectTypeCode.ShortString: return(ReadShortString()); case AMF0ObjectTypeCode.TypedObject: return(ReadTypedObject()); case AMF0ObjectTypeCode.Undefined: return(ASUndefined.Value); case AMF0ObjectTypeCode.Unsupported: return(ASUnsupported.Value); case AMF0ObjectTypeCode.Xml: return(ReadXml()); default: throw new AMFException(String.Format(CultureInfo.CurrentCulture, ExceptionPrefix + "Encountered unexpected or unsupported token '{0}'.", typeCode)); } } // Delegate to AMF3 object reader. return(amf3ObjectReader.ReadObject()); }