logo       

Resource IDs: msg#00082

gnome.mono.monodevelop.general

Subject: Resource IDs

Hi,

currently the resource ID of an embedded resource will be it's filename in MD (at least for c# projects, I haven't checked the others).
This is different from what Visual Studio does. What VS does is explained here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbgrffileswithoutembeddedcultureinfostrings.asp
I think this is a better way of assigning the IDs because currently in MD it can cause problems if you have two resources with the same filename (e.g. res/small/logo.png, res/big/logo.png). Besides this, it makes life easier for people that use MD and VS to work on the same project.

The patch I attached modifies the way MD assigns embedded resources' IDs (only for c# projects). It works as follows:
1. If the resource file is "inside" the project base directory then its ID will be its relative path with the directory separator character replaced with '.'.
2. Otherwise it gets the same ID as before.

Would anyone please review the patch?

Thanks,
Andras
Index:
Core/src/AddIns/BackendBindings/CSharpBinding/CSharpBindingCompilerManager.cs
===================================================================
---
Core/src/AddIns/BackendBindings/CSharpBinding/CSharpBindingCompilerManager.cs
(revision 2468)
+++
Core/src/AddIns/BackendBindings/CSharpBinding/CSharpBindingCompilerManager.cs
(working copy)
@@ -128,7 +128,13 @@
break;
case
BuildAction.EmbedAsResource:
// FIXME:
workaround 60990
-
writer.WriteLine(@"""/res:{0},{1}""", finfo.Name, Path.GetFileName
(finfo.Name));
+ string
resourceId;
+
if(finfo.RelativePath.StartsWith ("." + Path.DirectorySeparatorChar)) {
+
resourceId = finfo.RelativePath.Substring(2).Replace
(Path.DirectorySeparatorChar, '.');
+ } else {
+
resourceId = Path.GetFileName (finfo.Name);
+ }
+
writer.WriteLine(@"""/res:{0},{1}""", finfo.Name, resourceId);
break;
}
}
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise