From a0f1d623e432257c64b990d26704c8c6528f541e Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Wed, 9 Nov 2005 21:03:18 +0000 Subject: [PATCH] 2005-11-09 Chris Toshok * ConfigurationSettings.cs (AppSettings): remove the #if NET_2_0 block breaks this. (ReadSectionGroup): allow the "type" atrribute so we don't break when reading a 2.0 config file using the 1.0 stuff. svn path=/trunk/mcs/; revision=52797 --- .../System/System.Configuration/ChangeLog | 7 +++++ .../ConfigurationSettings.cs | 30 ++++++++++--------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/mcs/class/System/System.Configuration/ChangeLog b/mcs/class/System/System.Configuration/ChangeLog index c012aac173917..5e88058dcc6db 100644 --- a/mcs/class/System/System.Configuration/ChangeLog +++ b/mcs/class/System/System.Configuration/ChangeLog @@ -1,3 +1,10 @@ +2005-11-09 Chris Toshok + + * ConfigurationSettings.cs (AppSettings): remove the #if NET_2_0 + block breaks this. + (ReadSectionGroup): allow the "type" atrribute so we don't break + when reading a 2.0 config file using the 1.0 stuff. + 2005-11-04 Chris Toshok * SettingsProvider.cs, SettingsPropertyValueCollection.cs, diff --git a/mcs/class/System/System.Configuration/ConfigurationSettings.cs b/mcs/class/System/System.Configuration/ConfigurationSettings.cs index ae1aa1584f8e2..3127120afc920 100644 --- a/mcs/class/System/System.Configuration/ConfigurationSettings.cs +++ b/mcs/class/System/System.Configuration/ConfigurationSettings.cs @@ -63,20 +63,11 @@ public static object GetConfig (string sectionName) public static NameValueCollection AppSettings { get { -#if NET_2_0 - /* XXX figure out the cyclic - * dependency foo between System and - * System.Configuration so this will - * work */ -// return ConfigurationManager.AppSettings; - return new NameValueCollection (); -#else object appSettings = GetConfig ("appSettings"); if (appSettings == null) appSettings = new NameValueCollection (); return (NameValueCollection) appSettings; -#endif } } @@ -225,6 +216,7 @@ public ConfigurationData (ConfigurationData parent) public bool Load (string fileName) { + Console.WriteLine ("ConfigurationData.Load ({0})\n{1}", fileName, Environment.StackTrace); this.fileName = fileName; if (fileName == null || !File.Exists (fileName)) return false; @@ -514,13 +506,23 @@ private void ReadSectionGroup (XmlTextReader reader, string configSection) if (!reader.MoveToNextAttribute ()) ThrowException ("sectionGroup must have a 'name' attribute.", reader); - if (reader.Name != "name") - ThrowException ("Unrecognized attribute.", reader); + string value = null; + do { + if (reader.Name == "name") { + if (value != null) + ThrowException ("Duplicate 'name' attribute.", reader); + value = reader.Value; + } + else +#if NET_2_0 + if (reader.Name != "type") +#endif + ThrowException ("Unrecognized attribute.", reader); + } while (reader.MoveToNextAttribute ()); - if (reader.MoveToNextAttribute ()) - ThrowException ("Unrecognized attribute.", reader); + if (value == null) + ThrowException ("No 'name' attribute.", reader); - string value = reader.Value; if (value == "location") ThrowException ("location is a reserved section name", reader);