* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / System / System.Configuration / LocalFileSettingsProvider.cs
index 26b770b1a2fc2d24483f7d1a33a0b99a3ec2b265..2233341b9ca4212ca4e32f500f72c5aa99de105b 100644 (file)
@@ -1,5 +1,5 @@
 //
-// System.Web.UI.WebControls.LocalFileSettingsProvider.cs
+// System.Configuration.LocalFileSettingsProvider.cs
 //
 // Authors:
 //     Chris Toshok (toshok@ximian.com)
 //
 
 #if NET_2_0
+#if CONFIGURATION_DEP
+extern alias PrebuiltSystem;
+using NameValueCollection = PrebuiltSystem.System.Collections.Specialized.NameValueCollection;
+#endif
+
 using System;
 using System.Collections.Specialized;
 
@@ -38,6 +43,7 @@ namespace System.Configuration
                {
                }
 
+               [MonoTODO]
                public SettingsPropertyValue GetPreviousVersion (SettingsContext context,
                                                                 SettingsProperty property)
                {
@@ -45,49 +51,71 @@ namespace System.Configuration
                }
 
 
+               [MonoTODO]
                public override SettingsPropertyValueCollection GetPropertyValues (SettingsContext context,
                                                                                   SettingsPropertyCollection properties)
                {
-                       throw new NotImplementedException ();
+                       SettingsPropertyValueCollection pv = new SettingsPropertyValueCollection ();
+                       foreach (SettingsProperty prop in properties)
+                               pv.Add (new SettingsPropertyValue (prop));
+
+                       return pv;
                }
 
-#if notyet
+#if CONFIGURATION_DEP
                public override void Initialize (string name,
                                                 NameValueCollection values)
                {
-                       applicationName = values["applicationName"];
+                       if (name == null)
+                               name = "LocalFileSettingsProvider";
+                       if (values != null)
+                               applicationName = values["applicationName"];
 
                        base.Initialize (name, values);
                }
 #endif
 
+               [MonoTODO]
                public void Reset (SettingsContext context)
                {
                        throw new NotImplementedException ();
                }
 
+               [MonoTODO]
                public override void SetPropertyValues (SettingsContext context,
                                                        SettingsPropertyValueCollection values)
                {
                        throw new NotImplementedException ();
                }
 
+               [MonoTODO]
                public void Upgrade (SettingsContext context,
                                     SettingsPropertyCollection properties)
                {
                        throw new NotImplementedException ();
                }
 
+               string applicationName = "";
                public override string ApplicationName {
-                       get {
-                               return applicationName;
-                       }
-                       set {
-                               applicationName = value;
-                       }
+                       get { return applicationName; }
+                       set { applicationName = value; }
                }
 
-               string applicationName = "";
+               bool IsUserSetting (SettingsProperty prop)
+               {
+#if CONFIGURATION_DEP
+                       if (prop.Attributes.ContainsKey (typeof (UserScopedSettingAttribute)))
+                               return true;
+                       else if (prop.Attributes.ContainsKey (typeof (ApplicationScopedSettingAttribute)))
+                               return false;
+                       else
+                               throw new ConfigurationErrorsException (
+                                                       String.Format ("The setting '{0}' does not have either an ApplicationScopedSettingAttribute or UserScopedSettingAttribute.",
+                                                                      prop.Name));
+#else
+                       return false;
+#endif
+               }
        }
 
 }