internal static Constant ReadConst(int constType, BinaryReader blob)
{
switch (constType) {
case ((int)ElementType.Boolean) :
return new BoolConst(blob.ReadByte() != 0);
case ((int)ElementType.Char) :
return new CharConst(blob.ReadChar());
case ((int)ElementType.I1) :
return new IntConst(blob.ReadSByte());
case ((int)ElementType.U1) :
return new UIntConst(blob.ReadByte());
case ((int)ElementType.I2) :
return new IntConst(blob.ReadInt16());
case ((int)ElementType.U2) :
return new UIntConst(blob.ReadUInt16());
case ((int)ElementType.I4) :
return new IntConst(blob.ReadInt32());
case ((int)ElementType.U4) :
return new UIntConst(blob.ReadUInt32());
case ((int)ElementType.I8) :
return new IntConst(blob.ReadInt64());
case ((int)ElementType.U8) :
return new UIntConst(blob.ReadUInt64());
case ((int)ElementType.R4) :
return new FloatConst(blob.ReadSingle());
case ((int)ElementType.R8) :
return new DoubleConst(blob.ReadDouble());
case ((int)ElementType.ClassType) :
return new ClassTypeConst(blob.ReadString()); //GetBlobString());
case ((int)ElementType.String) :
return new StringConst(blob.ReadString()); //GetBlobString());
case ((int)ElementType.Class) :
return new ClassTypeConst(blob.ReadString()); //GetBlobString());
//uint junk = blob.ReadUInt32(); // need to read name??
//return new NullRefConst();
case ((int)ElementType.ValueType) : // only const value type is enum??
return new IntConst(blob.ReadInt32());
default: return null;
}
}