internal override object ReadObjectValue(RSBinaryReader _binaryReader, out Type _objectType, object _object = null) { BinaryElement _curBinaryElement; while ((_curBinaryElement = _binaryReader.ReadBinaryElement()) != BinaryElement.OBJECT_DATA) { TypeMetadata.ReadTypeMetaData(_binaryReader, _curBinaryElement); } if (_curBinaryElement != BinaryElement.OBJECT_DATA) { throw new Exception(string.Format("[RS] Parsing error. BinaryElement={0}.", _curBinaryElement)); } // Deserialize based on value eTypeTag _typeTag = _binaryReader.ReadTypeTag(); object _objectValue = null; switch (_typeTag) { case eTypeTag.NULL: case eTypeTag.UNSUPPORTED: _objectType = null; _objectValue = null; break; case eTypeTag.PRIMITIVE: _objectValue = ReadPrimitiveTypeValue(_binaryReader, out _objectType); break; case eTypeTag.STRUCT: _objectValue = ReadStructTypeValue(_binaryReader, out _objectType, _object); break; case eTypeTag.STRING: _objectValue = ReadStringTypeValue(_binaryReader, out _objectType); break; case eTypeTag.CLASS: _objectValue = ReadClassTypeValue(_binaryReader, out _objectType, _object); break; case eTypeTag.OBJECT_REFERENCE: _objectValue = ReadObjectReferenceValue(_binaryReader, out _objectType); break; default: throw new Exception(string.Format("[RS] Unsupported type tag{0}. For more supported types, Purchase full version http://u3d.as/g8b", _typeTag)); } return(_objectValue); }