Parcourir la source

2005-12-06 Chris Toshok <[email protected]>

	* CodeSubDirectory.cs (DirectoryName): don't use an private field,
	but base[directoyNameProp].

	* AuthorizationRuleCollection.cs (Add): use BaseAdd (rule, false),
	so we can insert duplicates.
	(GetKey): nuke.
	(GetElementKey): MS for some reason just uses the action for the
	key, ToString()'ed.
	(Remove): pass the correct key.

	* ProfileGroupSettings.cs (GetHashCode): implement.

	* GlobalizationSection.cs (GetEncoding): for the utf-8 case, just
	use Encoding.UTF8.

	* AssemblyCollection.cs (Add): use BaseAdd (info, false) so we can
	insert duplicates.

	* CacheSection.cs (.cctor): make privateByteLimit's default 0L so
	we don't get a invalid cast exception later on.

	* AuthorizationRule.cs (VerifyData): split out the verification
	foo from PreSerialize.
	(PostDeserialize): so we can call it from here.
	(PreSerialize): and here.


svn path=/trunk/mcs/; revision=54006
Chris Toshok il y a 20 ans
Parent
commit
d03dd7f5fc

+ 1 - 1
mcs/class/System.Web/System.Web.Configuration_2.0/AssemblyCollection.cs

@@ -48,7 +48,7 @@ namespace System.Web.Configuration
 
 		public void Add (AssemblyInfo info)
 		{
-			BaseAdd (info);
+			BaseAdd (info, false);
 		}
 		
 		public void Clear ()

+ 9 - 3
mcs/class/System.Web/System.Web.Configuration_2.0/AuthorizationRule.cs

@@ -130,18 +130,24 @@ namespace System.Web.Configuration {
 			throw new NotImplementedException ();
 		}
 
-		[MonoTODO]
+		void VerifyData ()
+		{
+			if (Roles.Count == 0 && Users.Count == 0)
+				throw new ConfigurationErrorsException ("You must supply either a list of users or roles when creating an AuthorizationRule");
+		}
+
 		protected override void PostDeserialize ()
 		{
 			base.PostDeserialize();
+
+			VerifyData ();
 		}
 
 		protected override void PreSerialize (XmlWriter writer)
 		{
 			base.PreSerialize (writer);
 
-			if (Roles.Count == 0 && Users.Count == 0)
-				throw new ConfigurationErrorsException ("You must supply either a list of users or roles when creating an AuthorizationRule");
+			VerifyData ();
 		}
 
 		[MonoTODO]

+ 3 - 9
mcs/class/System.Web/System.Web.Configuration_2.0/AuthorizationRuleCollection.cs

@@ -47,7 +47,7 @@ namespace System.Web.Configuration {
 
 		public void Add (AuthorizationRule rule)
 		{
-			BaseAdd (rule);
+			BaseAdd (rule, false);
 		}
 
 		public void Clear ()
@@ -70,17 +70,11 @@ namespace System.Web.Configuration {
 			return (AuthorizationRule) BaseGet (index);
 		}
 
-		string GetKey (AuthorizationRule rule)
-		{
-			return String.Format ("{0}-{1}-{2}-{3}", rule.Action, rule.Roles, rule.Users, rule.Verbs);
-		}
-
-		[MonoTODO ("this should work, right?")]
 		protected override object GetElementKey (ConfigurationElement element)
 		{
 			AuthorizationRule rule = (AuthorizationRule)element;
 
-			return GetKey (rule);
+			return rule.Action.ToString();
 		}
 
 		public int IndexOf (AuthorizationRule rule)
@@ -95,7 +89,7 @@ namespace System.Web.Configuration {
 
 		public void Remove (AuthorizationRule rule)
 		{
-			BaseRemove (GetKey (rule));
+			BaseRemove (rule.Action.ToString());
 		}
 
 		public void RemoveAt (int index)

+ 1 - 1
mcs/class/System.Web/System.Web.Configuration_2.0/CacheSection.cs

@@ -53,7 +53,7 @@ namespace System.Web.Configuration {
 											  TypeDescriptor.GetConverter (typeof (int)),
 											  PropertyHelper.IntFromZeroToMaxValidator,
 											  ConfigurationPropertyOptions.None);
-			privateBytesLimitProp = new ConfigurationProperty("privateBytesLimit", typeof (long), 0,
+			privateBytesLimitProp = new ConfigurationProperty("privateBytesLimit", typeof (long), 0L,
 									  TypeDescriptor.GetConverter (typeof (long)),
 									  new LongValidator (0, Int64.MaxValue),
 									  ConfigurationPropertyOptions.None);

+ 28 - 0
mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog

@@ -1,3 +1,31 @@
+2005-12-06  Chris Toshok  <[email protected]>
+
+	* CodeSubDirectory.cs (DirectoryName): don't use an private field,
+	but base[directoyNameProp].
+
+	* AuthorizationRuleCollection.cs (Add): use BaseAdd (rule, false),
+	so we can insert duplicates.
+	(GetKey): nuke.
+	(GetElementKey): MS for some reason just uses the action for the
+	key, ToString()'ed.
+	(Remove): pass the correct key.
+
+	* ProfileGroupSettings.cs (GetHashCode): implement.
+
+	* GlobalizationSection.cs (GetEncoding): for the utf-8 case, just
+	use Encoding.UTF8.
+
+	* AssemblyCollection.cs (Add): use BaseAdd (info, false) so we can
+	insert duplicates.
+
+	* CacheSection.cs (.cctor): make privateByteLimit's default 0L so
+	we don't get a invalid cast exception later on.
+
+	* AuthorizationRule.cs (VerifyData): split out the verification
+	foo from PreSerialize.
+	(PostDeserialize): so we can call it from here.
+	(PreSerialize): and here.
+
 2005-12-05  Chris Toshok  <[email protected]>
 
 	* AuthorizationRuleCollection.cs (GetKey): split out the logic for

+ 3 - 4
mcs/class/System.Web/System.Web.Configuration_2.0/CodeSubDirectory.cs

@@ -38,7 +38,6 @@ namespace System.Web.Configuration
 	{
 		static ConfigurationProperty directoryNameProp;
 		static ConfigurationPropertyCollection properties;
-		string directoryName;
 
 		static CodeSubDirectory ()
 		{
@@ -53,15 +52,15 @@ namespace System.Web.Configuration
 
 		public CodeSubDirectory (string directoryName)
 		{
-			this.directoryName = directoryName;
+			this.DirectoryName = directoryName;
 		}
 
 		[TypeConverter (typeof (WhiteSpaceTrimStringConverter))]
 		[ConfigurationProperty ("directoryName", DefaultValue = "", Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]
 		// LAMESPEC: MS lists no validator here but provides one in Properties.
 		public string DirectoryName {
-			get { return directoryName; }
-			set { directoryName = value; }
+			get { return (string) base[directoryNameProp]; }
+			set { base[directoryNameProp] = value; }
 		}
 
 		protected override ConfigurationPropertyCollection Properties {

+ 1 - 1
mcs/class/System.Web/System.Web.Configuration_2.0/GlobalizationSection.cs

@@ -241,7 +241,7 @@ namespace System.Web.Configuration {
 					case "unicode-2-0-utf-8":
 					case "x-unicode-1-1-utf-8":
 					case "x-unicode-2-0-utf-8":
-						encoding = new UTF8Encoding (false, false);
+						encoding = Encoding.UTF8;
 						break;
 					default:
 						encoding = Encoding.GetEncoding (cached_encoding_name);

+ 1 - 2
mcs/class/System.Web/System.Web.Configuration_2.0/ProfileGroupSettings.cs

@@ -73,10 +73,9 @@ namespace System.Web.Configuration
 			throw new NotImplementedException ();
 		}
 
-		[MonoTODO]
 		public override int GetHashCode ()
 		{
-			throw new NotImplementedException ();
+			return Name.GetHashCode ();
 		}
 
 		[ConfigurationProperty ("name", Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]