Changeset 1660 for trunk/sources/HeuristicLab.Persistence/3.3/Core
- Timestamp:
- 04/24/09 15:58:19 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Core/ConfigurationService.cs
r1654 r1660 37 37 } 38 38 39 protected void LoadSettings() { 39 public void LoadSettings() { 40 LoadSettings(false); 41 } 42 43 public void LoadSettings(bool throwOnError) { 40 44 try { 41 if (String.IsNullOrEmpty(Properties.Settings.Default.CustomConfigurations) || 45 TryLoadSettings(); 46 } catch (Exception e) { 47 if (throwOnError) { 48 throw new PersistenceException("Could not load persistence settings.", e); 49 } else { 50 Logger.Warn("Could not load settings.", e); 51 } 52 } 53 } 54 55 protected void TryLoadSettings() { 56 if (String.IsNullOrEmpty(Properties.Settings.Default.CustomConfigurations) || 42 57 String.IsNullOrEmpty(Properties.Settings.Default.CustomConfigurationsTypeCache)) 43 return; 44 Deserializer deSerializer = new Deserializer( 45 XmlParser.ParseTypeCache( 46 new StringReader( 47 Properties.Settings.Default.CustomConfigurationsTypeCache))); 48 XmlParser parser = new XmlParser( 49 new StringReader( 50 Properties.Settings.Default.CustomConfigurations)); 51 var newCustomConfigurations = (Dictionary<IFormat, Configuration>) 52 deSerializer.Deserialize(parser); 53 foreach (var config in newCustomConfigurations) { 54 customConfigurations[config.Key] = config.Value; 55 } 56 } catch (Exception e) { 57 Logger.Warn("Could not load settings.", e); 58 return; 59 Deserializer deSerializer = new Deserializer( 60 XmlParser.ParseTypeCache( 61 new StringReader( 62 Properties.Settings.Default.CustomConfigurationsTypeCache))); 63 XmlParser parser = new XmlParser( 64 new StringReader( 65 Properties.Settings.Default.CustomConfigurations)); 66 var newCustomConfigurations = (Dictionary<IFormat, Configuration>) 67 deSerializer.Deserialize(parser); 68 foreach (var config in newCustomConfigurations) { 69 customConfigurations[config.Key] = config.Value; 58 70 } 59 71 }
Note: See TracChangeset
for help on using the changeset viewer.