Skip to content

Commit

Permalink
2005-11-09 Chris Toshok <toshok@ximian.com>
Browse files Browse the repository at this point in the history
	* 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
  • Loading branch information
Chris Toshok committed Nov 9, 2005
1 parent 79f6e3d commit a0f1d62
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
7 changes: 7 additions & 0 deletions mcs/class/System/System.Configuration/ChangeLog
@@ -1,3 +1,10 @@
2005-11-09 Chris Toshok <toshok@ximian.com>

* 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 <toshok@ximian.com>

* SettingsProvider.cs, SettingsPropertyValueCollection.cs,
Expand Down
30 changes: 16 additions & 14 deletions mcs/class/System/System.Configuration/ConfigurationSettings.cs
Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit a0f1d62

Please sign in to comment.