public static object GetValue(this ConfigValue value, Type type) { if (type.TypeEquals <string>()) { return(value.StringValue); } if (type.TypeEquals <long>()) { return(value.LongValue); } if (type.TypeEquals <int>()) { return(Convert.ToInt32(value.LongValue)); } if (type.TypeEquals <double>()) { return(value.DoubleValue); } if (type.TypeEquals <float>()) { return(Convert.ToSingle(value.DoubleValue)); } if (type.TypeEquals <bool>()) { return(value.BooleanValue); } if (type.TypeEquals <Color>()) { return(value.ColorValue(Color.white)); } if (type.TypeEquals <Color[]>()) { return(value.ColorArrayValue()); } if (type.TypeEquals <int[]>()) { return(value.IntArrayValue()); } if (type.TypeEquals <long[]>()) { return(value.LongArrayValue()); } if (type.TypeEquals <float[]>()) { return(value.FloatArrayValue()); } if (type.TypeEquals <double[]>()) { return(value.DoubleArrayValue()); } if (type.TypeEquals <string[]>()) { return(value.StringArrayValue()); } throw new Exception($"RemoteConfig got confused by {type}"); }