2006-04-24 Chris Toshok <toshok@ximian.com>
[mono.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / ProfilePropertySettingsCollection.cs
index 85096a5f70632b6b4c7cff7f2679b66dfa661db0..0f1a4bb7976739fa72e2c8c56aa2999341e6e002 100644 (file)
@@ -50,52 +50,48 @@ namespace System.Web.Configuration
                {
                }
 
-               [MonoTODO]
                public void Add (ProfilePropertySettings propertySettings)
                {
-                       throw new NotImplementedException ();
+                       BaseAdd (propertySettings);
                }
 
-               [MonoTODO]
                public void Clear ()
                {
-                       throw new NotImplementedException ();
+                       BaseClear ();
                }
 
-               [MonoTODO]
                protected override ConfigurationElement CreateNewElement ()
                {
-                       throw new NotImplementedException ();
+                       return new ProfilePropertySettings ();
                }
 
-               [MonoTODO]
                public ProfilePropertySettings Get (int index)
                {
-                       throw new NotImplementedException ();
+                       return (ProfilePropertySettings) BaseGet (index);
                }
 
-               [MonoTODO]
                public ProfilePropertySettings Get (string name)
                {
-                       throw new NotImplementedException ();
+                       return (ProfilePropertySettings) BaseGet (name);
                }
 
-               [MonoTODO]
                protected override object GetElementKey (ConfigurationElement element)
                {
-                       throw new NotImplementedException ();
+                       return ((ProfilePropertySettings)element).Name;
                }
 
-               [MonoTODO]
                public string GetKey (int index)
                {
-                       throw new NotImplementedException ();
+                       ProfilePropertySettings s = Get (index);
+                       if (s == null)
+                               return null;
+
+                       return s.Name;
                }
 
-               [MonoTODO]
                public int IndexOf (ProfilePropertySettings propertySettings)
                {
-                       throw new NotImplementedException ();
+                       return BaseIndexOf (propertySettings);
                }
 
                [MonoTODO]
@@ -104,28 +100,36 @@ namespace System.Web.Configuration
                        throw new NotImplementedException ();
                }
 
-               [MonoTODO]
                public void Remove (string name)
                {
-                       throw new NotImplementedException ();
+                       BaseRemove (name);
                }
 
-               [MonoTODO]
                public void RemoveAt (int index)
                {
-                       throw new NotImplementedException ();
+                       BaseRemoveAt (index);
                }
 
-               [MonoTODO]
                public void Set (ProfilePropertySettings propertySettings)
                {
-                       throw new NotImplementedException ();
+                       ProfilePropertySettings existing = Get (propertySettings.Name);
+
+                       if (existing == null) {
+                               Add (propertySettings);
+                       }
+                       else {
+                               int index = BaseIndexOf (existing);
+                               RemoveAt (index);
+                               BaseAdd (index, propertySettings);
+                       }
                }
 
-               [MonoTODO]
                public string[ ] AllKeys {
                        get {
-                               throw new NotImplementedException ();
+                               string[] keys = new string[Count];
+                               for (int i = 0; i < Count; i ++)
+                                       keys[i] = this[i].Name;
+                               return keys;
                        }
                }
 
@@ -141,22 +145,16 @@ namespace System.Web.Configuration
                }
 
                public ProfilePropertySettings this[int index] {
-                       get { return (ProfilePropertySettings) BaseGet (index); }
-                       set { if (BaseGet (index) != null) BaseRemoveAt (index); BaseAdd (index, value); }
+                       get { return Get (index); }
+                       set { if (Get (index) != null) BaseRemoveAt (index); BaseAdd (index, value); }
                }
 
-               [MonoTODO]
                public new ProfilePropertySettings this[string name] {
-                       get {
-                               throw new NotImplementedException ();
-                       }
+                       get { return Get (name); }                              
                }
 
-               [MonoTODO]
                protected override bool ThrowOnDuplicate {
-                       get {
-                               throw new NotImplementedException ();
-                       }
+                       get { return false; }
                }
 
        }