Browse Source

2003-05-20 Zoltan Varga <[email protected]>

	* Assembly.cs (GetManifestResourceStream): Moved handling of
	linked resources into managed code using the newly implemented
	GetManifestResourceInfo () method.

svn path=/trunk/mcs/; revision=14717
Zoltan Varga 22 years ago
parent
commit
559cc6ec9f

+ 6 - 8
mcs/class/corlib/System.Reflection/Assembly.cs

@@ -159,19 +159,17 @@ namespace System.Reflection {
 
 			if (info.ReferencedAssembly != null)
 				return info.ReferencedAssembly.GetManifestResourceStream (name);
+			if (info.FileName != null) {
+				string filename = Path.Combine (Path.GetDirectoryName (Location),
+											info.FileName);
+				return new FileStream (filename, FileMode.Open, FileAccess.Read);
+			}
 
 			object data = GetManifestResourceInternal (name);
-			string filename = data as string;
 			if (data == null)
 				return null;
-			if (filename != null) {
-				if ((info.ResourceLocation & ResourceLocation.Embedded) != 0)
-					throw new NotImplementedException ("Reading from modules is not implemented");
-				else
-					return new FileStream (filename, FileMode.Open, FileAccess.Read);
-			} else {
+			else
 				return new MemoryStream ((byte[])data, false);
-			}
 		}
 
 		public virtual Stream GetManifestResourceStream (Type type, String name)

+ 6 - 0
mcs/class/corlib/System.Reflection/ChangeLog

@@ -1,3 +1,9 @@
+2003-05-20  Zoltan Varga  <[email protected]>
+
+	* Assembly.cs (GetManifestResourceStream): Moved handling of 
+	linked resources into managed code using the newly implemented
+	GetManifestResourceInfo () method.
+
 2003-05-19  Zoltan Varga  <[email protected]>
 
 	* Module.cs: Implemented IsResource.