浏览代码

2001-12-17 Gaurav Vaish <[email protected]>

* PropertyConverter   -- Made compilable. Minor errors corrected
* Utils               -- Minor error

svn path=/trunk/mcs/; revision=1601
Gaurav Vaish 24 年之前
父节点
当前提交
4626ddbcb8

+ 1 - 1
mcs/class/System.Web/System.Web.UI/ChangeLog

@@ -2,7 +2,7 @@
 
 	* PropertyConverter.cs    - Undocumented class. Completed.
 	* Utils.cs                - Undocumented, private class.
-				    Initital implementation
+				    Initial implementation
 
 2001-08-28  Bob Smith  <[email protected]>
         * Control.cs: Figured out some undocumented API.

+ 15 - 15
mcs/class/System.Web/System.Web.UI/PropertyConverter.cs

@@ -1,13 +1,13 @@
 /**
  * Namespace: System.Web.UI
  * Class:     PropertyConverter
- * 
+ *
  * Author:  Gaurav Vaish
  * Maintainer: [email protected]
  * Implementation: yes
  * Contact: <[email protected]>
  * Status:  100%
- * 
+ *
  * (C) Gaurav Vaish (2001)
  */
 
@@ -22,8 +22,8 @@ namespace System.Web.UI
 	{
 		private static Type[] parseMethodTypes;
 		private static Type[] parseMethodTypesWithSOP;
-		
-		private static PropertyConverter()
+
+		static PropertyConverter()
 		{
 			parseMethodTypes = new Type[1];
 			parseMethodTypes[0] = typeof(string);
@@ -31,12 +31,12 @@ namespace System.Web.UI
 			parseMethodTypesWithSOP[0] = typeof(string);
 			parseMethodTypesWithSOP[1] = typeof(IServiceProvider);
 		}
-		
+
 		private PropertyConverter()
 		{
 			// Prevent any instance
 		}
-		
+
 		public static object EnumFromString(Type enumType, string enumValue)
 		{
 			object retVal = null;
@@ -49,13 +49,13 @@ namespace System.Web.UI
 			}
 			return retVal;
 		}
-		
+
 		public static string EnumToString(Type enumType, object enumValue)
 		{
 			string retVal = Enum.Format(enumType, enumValue, "G");
 			return retVal.Replace('_','-');
 		}
-		
+
 		public static object ObjectFromString(Type objType, MemberInfo propertyInfo, string objValue)
 		{
 			if(objValue == null)
@@ -64,23 +64,23 @@ namespace System.Web.UI
 			{
 				return null;
 			}
-			if(enumType.IsEnum)
+			if(objType.IsEnum)
 			{
 				return EnumFromString(objType, objValue);
 			}
-			if(enumType.Equals(typeof(string)))
+			if(objType.Equals(typeof(string)))
 			{
 				return objValue;
 			}
 			PropertyDescriptor pc = null;
 			if(propertyInfo != null)
 			{
-				pc = (TypeDesctiptor.GetProperties(propertyInfo.ReflectedType))[propertyInfo.Name];
+				pc = (TypeDescriptor.GetProperties(propertyInfo.ReflectedType))[propertyInfo.Name];
 			}
 			if(pc != null)
 			{
 				TypeConverter converter = pc.Converter;
-				if(converter!=null && conveter.CanConverFrom(typeof(string)))
+				if(converter!=null && converter.CanConvertFrom(typeof(string)))
 				{
 					return converter.ConvertFromInvariantString(objValue);
 				}
@@ -94,7 +94,7 @@ namespace System.Web.UI
 				parameters[1] = CultureInfo.InvariantCulture;
 				try
 				{
-					o = Util.InvokeMethod(propertyInfo, null, parameters);
+					o = Utils.InvokeMethod(mi, null, parameters);
 				} catch(Exception e)
 				{
 				}
@@ -108,7 +108,7 @@ namespace System.Web.UI
 					parameters[0] = objValue;
 					try
 					{
-						o = Util.InvokeMethod(propertyInfo, null, parameters);
+						o = Utils.InvokeMethod(mi, null, parameters);
 					} catch(Exception e)
 					{
 					}
@@ -116,7 +116,7 @@ namespace System.Web.UI
 			}
 			if(o == null)
 			{
-				throw new HttpException(HttpRuntime.FormatResourceString("Type_not_creatable_from_string", objType.FullName, objValue, propertyInfo.Name);
+				throw new HttpException(/*HttpRuntime.FormatResourceString(*/"Type_not_creatable_from_string"/*, objType.FullName, objValue, propertyInfo.Name)*/);
 			}
 			return o;
 		}

+ 3 - 3
mcs/class/System.Web/System.Web.UI/Utils.cs

@@ -1,13 +1,13 @@
 /**
  * Namespace: System.Web.UI
  * Class:     Utils
- * 
+ *
  * Author:  Gaurav Vaish
  * Maintainer: [email protected]
  * Implementation: yes
  * Contact: <[email protected]>
  * Status:  ?%
- * 
+ *
  * (C) Gaurav Vaish (2001)
  */
 
@@ -16,7 +16,7 @@ using System.Reflection;
 
 namespace System.Web.UI
 {
-	private class Utils
+	internal class Utils
 	{
 		internal static object InvokeMethod(MethodInfo info, object obj, object[] parameters)
 		{