[Mono-bugs] [Bug 80923][Nor] New - System.Resources.ResourceReader.GetResourceData missing

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Feb 21 09:36:52 EST 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by egon.rath at gespag.at.

http://bugzilla.ximian.com/show_bug.cgi?id=80923

--- shadow/80923	2007-02-21 09:36:52.000000000 -0500
+++ shadow/80923.tmp.12780	2007-02-21 09:36:52.000000000 -0500
@@ -0,0 +1,51 @@
+Bug#: 80923
+Product: Mono: Class Libraries
+Version: 1.2
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: Egon.Rath at gespag.at               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: System.Resources.ResourceReader.GetResourceData missing
+
+The Methods "GetResourceData" from the ResourceReader Class is missing,
+even when compiled with the 2.0 Preview.
+
+Below you will find my implementation of this Method. Works in the same way
+as the original Microsoft Implementation does:
+
+----- snippet begin -----
+public void GetResourceData( string resourceName, out string resourceType,
+out byte[] resourceData )
+{
+    for( int index = 0; index < resourceCount; index ++ )
+    {
+        if( ResourceName( index ) == resourceName )
+        {
+            BinaryFormatter formatter = new BinaryFormatter();
+            MemoryStream serializedResource = new MemoryStream();
+
+            object resourceValue = ResourceValue( index );
+            formatter.Serialize( serializedResource, resourceValue );
+
+            resourceData = serializedResource.ToArray();
+            resourceType = resourceValue.GetType().ToString();
+            return;
+        }
+    }
+
+    /* No Resource with the given name has been found, throw an exception */
+    throw new ArgumentException( "Given Resource not found" );
+}
+------ snippet end ------
+
+Maybe this could be included in future versions.
+Feel free to contact me if you have any questions.


More information about the mono-bugs mailing list