private static object ReadValue(MetafileReader reader, DataTypeIndex type) { switch (type) { case DataTypeIndex.StructuredDataRecord: return(ReadStructuredDataRecord(reader)); case DataTypeIndex.ColorIndex: return(reader.ReadIndexedColor()); case DataTypeIndex.ColorDirect: return(reader.ReadDirectColor()); case DataTypeIndex.Name: return(reader.ReadName()); case DataTypeIndex.Enumerated: return(reader.ReadEnum()); case DataTypeIndex.Integer: return(reader.ReadInteger()); case DataTypeIndex.Reserved: // TODO: what exactly does reserved mean in terms of advancing position? return(null); case DataTypeIndex.SignedInteger8bit: return(reader.ReadInteger(1, false)); case DataTypeIndex.SignedInteger16bit: return(reader.ReadInteger(2, false)); case DataTypeIndex.SignedInteger32bit: return(reader.ReadInteger(4, false)); case DataTypeIndex.Index: return(reader.ReadIndex()); case DataTypeIndex.Real: return(reader.ReadReal()); case DataTypeIndex.String: case DataTypeIndex.StringFixed: // TODO: difference between S and SF? charset/escape code handling? return(reader.ReadString()); case DataTypeIndex.ViewportCoordinate: return(reader.ReadViewportCoordinate()); case DataTypeIndex.VDC: return(reader.ReadVdc()); case DataTypeIndex.ColorComponent: return(reader.ReadColorValue()); case DataTypeIndex.UnsignedInteger8bit: return(reader.ReadInteger(1, true)); case DataTypeIndex.UnsignedInteger32Bit: return(reader.ReadInteger(4, true)); case DataTypeIndex.UnsignedInteger16bit: return(reader.ReadInteger(2, true)); case DataTypeIndex.BitStream: case DataTypeIndex.ColorList: default: // FIXME: how are those implemented? return(null); } }