19 using System.Collections.Generic;
20 using System.Globalization;
25 namespace Deveel.Data.Configuration {
32 return Convert.ChangeType(value, valueType, CultureInfo.InvariantCulture);
36 if (inputStream == null)
37 throw new ArgumentNullException(
"inputStream");
41 properties.Load(inputStream);
43 foreach (var entry
in properties) {
44 var propKey = (string) entry.Key;
45 SetValue(config, propKey, (
string) entry.Value);
49 }
catch (Exception ex) {
56 var keys = config.
GetKeys(level);
59 foreach (var configKey
in keys) {
60 var configValue = config.
GetValue(configKey);
61 if (configValue != null) {
62 var stringValue = Convert.ToString(configValue, CultureInfo.InvariantCulture);
63 properties.SetProperty(configKey, stringValue);
67 properties.Store(outputStream, String.Empty);
70 }
catch (Exception ex) {
object GetValue(string key)
Gets a configuration setting for the given key.
ConfigurationLevel
Defines the level of configuration settings to save or read
void SetValue(string key, object value)
Sets a given value for a key defined by this object.
Defines the contract for the configuration node of a component within the system or of the system its...
IEnumerable< string > GetKeys(ConfigurationLevel level)
Enumerates the keys that can be obtained by the object, at the given ConfigurationLevel.