private Type ReadType(DataKind kind) { switch (kind) { case DataKind.TypeRef_B: return((Type)dataMap.GetValue(reader.ReadByte())); case DataKind.TypeRef_S: return((Type)dataMap.GetValue(reader.ReadUInt16())); case DataKind.TypeRef: return((Type)dataMap.GetValue(reader.ReadInt32())); case DataKind.Type: int id = dataMap.GetNextId(); var assemblyName = this.ReadString(); var typeName = this.ReadString(); if (this.binder == null) { throw NoBinderException(typeName); } var type = this.binder.GetType(assemblyName, typeName); dataMap.AddValue(id, type); return(type); default: throw ExceptionUtilities.UnexpectedValue(kind); } }
private string ReadString(DataKind kind) { switch (kind) { case DataKind.StringRef_B: return((string)_dataMap.GetValue(_reader.ReadByte())); case DataKind.StringRef_S: return((string)_dataMap.GetValue(_reader.ReadUInt16())); case DataKind.StringRef: return((string)_dataMap.GetValue(_reader.ReadInt32())); case DataKind.StringUtf16: case DataKind.StringUtf8: return(ReadStringLiteral(kind)); default: throw ExceptionUtilities.UnexpectedValue(kind); } }
public object GetValue(int id) { if (_baseData != null) { if (id < _baseDataCount) { return(_baseData.GetValue(id)); } else { return(_values[id - _baseDataCount]); } } else { return(_values[id]); } }