Prechádzať zdrojové kódy

two methods implemented

svn path=/trunk/mcs/; revision=69921
Marek Habersack 19 rokov pred
rodič
commit
ecd1522dce

+ 4 - 0
mcs/class/System.Web/System.Web.Hosting/ChangeLog

@@ -1,3 +1,7 @@
+2006-12-22  Marek Habersack  <[email protected]>
+
+	* HostingEnvironment.cs: implemented the SetCultures methods.
+
 2006-12-19 Igor Zelmanovich <[email protected]>
 
 	* ServletWorkerRequest.cs: fixed:

+ 10 - 4
mcs/class/System.Web/System.Web.Hosting/HostingEnvironment.cs

@@ -32,8 +32,10 @@
 #if NET_2_0
 
 using System;
+using System.Globalization;
 using System.Security.Permissions;
 using System.Threading;
+using System.Web.Configuration;
 using System.Web.Caching;
 using System.Web.Util;
 
@@ -168,16 +170,20 @@ namespace System.Web.Hosting {
 			vpath_provider = virtualPathProvider;
 		}
 		
-		[MonoTODO ("Not implemented")]
 		public static IDisposable SetCultures (string virtualPath)
 		{
-			throw new NotImplementedException ();
+			GlobalizationSection gs = WebConfigurationManager.GetSection ("system.web/globalization", virtualPath) as GlobalizationSection;
+			IDisposable ret = Thread.CurrentThread.CurrentCulture as IDisposable;
+			string culture = gs.Culture;
+			if (String.IsNullOrEmpty (culture))
+				return ret;
+			Thread.CurrentThread.CurrentCulture = new CultureInfo (culture);
+			return ret;
 		}
 
-		[MonoTODO ("Not implemented")]
 		public static IDisposable SetCultures ()
 		{
-			throw new NotImplementedException ();
+			return SetCultures ("~/");
 		}
 
 		public static void UnregisterObject (IRegisteredObject obj)