public static Color?GetColor(this INiSettings self, string key) { return(DeserializeColor(self.GetString(key))); }
private object GetSettings(string name, MethodInfo member) { object value; if (!_cache.TryGetValue(name, out value)) { string key = _group + "." + name; var underlyingType = Nullable.GetUnderlyingType(member.ReturnType) ?? member.ReturnType; if (underlyingType == typeof(string)) { value = _settings.GetString(key); } else if (underlyingType == typeof(string[])) { value = DeserializeStringArray(_settings.GetString(key)); } else if (underlyingType == typeof(int)) { value = _settings.GetInt32(key); } else if (underlyingType == typeof(decimal)) { value = _settings.GetDecimal(key); } else if (underlyingType == typeof(Guid)) { value = _settings.GetGuid(key); } else if (underlyingType == typeof(bool)) { value = _settings.GetBool(key); } else if (underlyingType == typeof(Font)) { value = _settings.GetFont(key); } else if (underlyingType == typeof(Color)) { value = _settings.GetColor(key); } else if (typeof(Enum).IsAssignableFrom(underlyingType)) { value = GetEnum(underlyingType, key); } else { throw new InvalidOperationException(NeutralResources.InvalidRequest); } if (value == null) { value = GetDefaultValue(member); } _cache[name] = value; } return(value); }
public static Font GetFont(this INiSettings self, string key) { return(DeserializeFont(self.GetString(key))); }