public override object Read <T>(ES3Reader reader) { if (underlyingType == typeof(int)) { return(Enum.ToObject(type, reader.Read_int())); } else if (underlyingType == typeof(bool)) { return(Enum.ToObject(type, reader.Read_bool())); } else if (underlyingType == typeof(byte)) { return(Enum.ToObject(type, reader.Read_byte())); } else if (underlyingType == typeof(char)) { return(Enum.ToObject(type, reader.Read_char())); } else if (underlyingType == typeof(decimal)) { return(Enum.ToObject(type, reader.Read_decimal())); } else if (underlyingType == typeof(double)) { return(Enum.ToObject(type, reader.Read_double())); } else if (underlyingType == typeof(float)) { return(Enum.ToObject(type, reader.Read_float())); } else if (underlyingType == typeof(long)) { return(Enum.ToObject(type, reader.Read_long())); } else if (underlyingType == typeof(sbyte)) { return(Enum.ToObject(type, reader.Read_sbyte())); } else if (underlyingType == typeof(short)) { return(Enum.ToObject(type, reader.Read_short())); } else if (underlyingType == typeof(uint)) { return(Enum.ToObject(type, reader.Read_uint())); } else if (underlyingType == typeof(ulong)) { return(Enum.ToObject(type, reader.Read_ulong())); } else if (underlyingType == typeof(ushort)) { return(Enum.ToObject(type, reader.Read_ushort())); } else { throw new System.InvalidCastException("The underlying type " + underlyingType + " of Enum " + type + " is not supported"); } }
public override object Read <T>(ES3Reader reader) { return((T)(object)reader.Read_byte()); }