Explorar o código

2002-01-16 Duncan Mak <[email protected]>

    * ResourceManager.cs: After reading the tutorial from the SDK,
      finished all the ResourceManager constructors and removed those
      MonoTODO tags. Updated fields after reading the new docs from the
      final SDK.

    * ResXFileRef.cs, ResXResourceReader.cs: Removed. They are part of
      Windows.Forms and require System.Xml, which we don't have access to.

2002-01-13  Duncan Mak  <[email protected]>

    * ResourceManager.cs: Added more MonoTODOs and cleaned up some
      indenting.

svn path=/trunk/mcs/; revision=2005
Duncan Mak %!s(int64=24) %!d(string=hai) anos
pai
achega
3c2865bb5e

+ 16 - 0
mcs/class/corlib/System.Resources/ChangeLog

@@ -1,3 +1,19 @@
+2002-01-16  Duncan Mak  <[email protected]>
+
+	* ResourceManager.cs: After reading the tutorial from the SDK,
+	finished all the ResourceManager constructors and removed those
+	MonoTODO tags.
+
+	Updated fields after reading the new docs from the final SDK.
+
+	* ResXFileRef.cs, ResXResourceReader.cs: Removed. They are part of
+	Windows.Forms and require System.Xml, which we don't have access to.
+
+2002-01-13  Duncan Mak  <[email protected]>
+
+	* ResourceManager.cs: Added more MonoTODOs and cleaned up some 
+	indenting.
+
 2002-01-09  Duncan Mak  <[email protected]>
 
 	* ResourceManager.cs: Fixed the GetSatelliteContractVersion()

+ 0 - 17
mcs/class/corlib/System.Resources/ResXFileRef.cs

@@ -1,17 +0,0 @@
-//
-// System.Resources.ResXFileRef.cs
-//
-// Author:
-//	Duncan Mak <[email protected]>
-//
-// 2001 (C) Ximian, Inc.		http://www.ximian.com
-//
-
-namespace System.Resources {
-	   public class ResXFileRef {
-
-			 public ResXFileRef (string fileName, string typeName) {}
-			 [MonoTODO]
-			 public override string ToString () { return ""; } // LAMESPEC, not specified.
-	   }
-}

+ 0 - 26
mcs/class/corlib/System.Resources/ResXResourceReader.cs

@@ -1,26 +0,0 @@
-//
-// System.Resources.ResXResourcereader.cs
-//
-// Author:
-//	Duncan Mak <[email protected]>
-//
-// 2001(C) Ximian, Inc.		http://www.ximian.com
-//
-
-using System.Collections;
-
-namespace System.Resources {
-	   public class ResXResourceReader : IResourceReader, IEnumerable, IDisposable {
-			public ResXResourceReader () {}
-	
-			// TODO:
-			public void Close () {}
-			IDictionaryEnumerator IResourceReader.GetEnumerator () { return null; }
-			IEnumerator IEnumerable.GetEnumerator () { return null; }
-			[MonoTODO]
-			protected virtual void Dispose (bool disposing) {}
-
-			[MonoTODO]
-			public void Dispose () {}
-	   	}
-}

+ 27 - 11
mcs/class/corlib/System.Resources/ResourceManager.cs

@@ -14,7 +14,7 @@ using System.Globalization;
 namespace System.Resources {
 	   public class ResourceManager {
 			 public static readonly int HeaderVersionNumber;
-			 public static readonly int MagicNumber;
+			 public static readonly int MagicNumber = 0xBEEFCACE;
 
 			 protected string BaseNameField;
 			 protected Assembly MainAssembly;
@@ -26,33 +26,49 @@ namespace System.Resources {
 			 // constructors
 			 public ResourceManager () {}
 
-		         [MonoTODO]
 			 public ResourceManager (Type resourceSource) {
 				    if (resourceSource == null)
 						  throw new ArgumentNullException ("resourceSource is null.");
-				    resourceSetType = resourceSource; // TODO Incomplete
+
+				    BaseNameField = resourceSource.FullName;
+				    MainAssembly = resourceSource.Assembly;
+
+				    ignoreCase = false;
+				    resourceSetType = typeof (resourceSource);
 			 }
 
-		         [MonoTODO]
 			 public ResourceManager (string baseName, Assembly assembly) {
 				    if (baseName == null || assembly == null)
 						  throw new ArgumentNullException ("The arguments are null.");
-				    // TODO
+
+				    BaseNameField = baseName;
+				    MainAssembly = assembly;
+				    ignoreCase = false;
+				    resourceSetType = typeof (ResourceSet);
 			 }
+			 
 			 public ResourceManager (string baseName, Assembly assembly, Type usingResourceSet) {
 				    if (baseName == null || assembly == null)
 						  throw new ArgumentNullException ("The arguments are null.");
 
-				    if (usingResourceSet != null)
-						  if (!usingResourceSet.IsSubclassOf (typeof(ResourceSet)))
-							 throw new ArgumentException ("Type must be derived from ResourceSet.");
+				    BaseNameField = baseName;
+				    Assembly = assembly;
+
+				    if (usingResourceSet == null) // defaults resourceSet type.
+						  resourceSetType = typeof (ResourceSet);
+				    else {
+						  if (!usingResourceSet.IsSubclassOf (typeof (ResourceSet)))
+								throw new ArgumentException ("Type must be from ResourceSet.");
+						  
+						  resourceSetType = typeof (usingResourceSet); // must be a subclass of ResourceSet
+				    }
 			 }
 
 			 [MonoTODO]
 			 public static ResourceManager CreateFileBasedResourceManager (string baseName,
 															   string resourceDir,
 															   Type usingResourceSet) {
-				return null;
+				    return null;
 			 }
 
 			 public virtual string BaseName { get { return BaseNameField; }}
@@ -75,6 +91,7 @@ namespace System.Resources {
 				return null;
 			 }
 
+			 [MonoTODO]
 			 public virtual string GetString (string name) {
 				    if (name == null)
 						  throw new ArgumentNullException ("Name is null.");
@@ -94,7 +111,7 @@ namespace System.Resources {
 				    return null;
 			 }
 
-		         [MonoTODO]
+			 [MonoTODO]
 			 protected virtual string GetResourceFileName (CultureInfo culture) {
 				    return culture.Name + ".resources"; // TODO check for correctness.
 			 }
@@ -127,7 +144,6 @@ namespace System.Resources {
 			 }
 
 			 public static Version GetSatelliteContractVersion (Assembly a) {
-
 				    foreach (Attribute attribute in a.GetCustomAttributes (false)) {
 						  if (attribute is SatelliteContractVersionAttribute)
 								return new Version ((attribute as SatelliteContractVersionAttribute).Version);