Added a property Resources to IAssembly and IUnresolvedAssembly. #287

Closed
erik-kallen wants to merge 3 commits from resources into master
erik-kallen commented 2013-08-19 12:51:26 -05:00 (Migrated from github.com)

This property contains all embedded (/resource csc command line option) and linked (/linkresource option) resources. There is also something known as an "asssembly-linked" resource, but this is not supported because my Google-fu has failed me in finding out what it actually is and how to create one.

As discussed in #133, no resource data is being kept in memory unless the GetResourceStream method is used.

This property contains all embedded (/resource csc command line option) and linked (/linkresource option) resources. There is also something known as an "asssembly-linked" resource, but this is not supported because my Google-fu has failed me in finding out what it actually is and how to create one. As discussed in #133, no resource data is being kept in memory unless the `GetResourceStream` method is used.
dgrunwald commented 2013-08-19 13:27:15 -05:00 (Migrated from github.com)

You don't need to add the string fileName parameter: you can get the full path to the assembly file from ModuleDefinition.FullyQualifiedName.

You don't need to add the `string fileName` parameter: you can get the full path to the assembly file from `ModuleDefinition.FullyQualifiedName`.
erik-kallen commented 2013-08-19 13:31:05 -05:00 (Migrated from github.com)

Thanks. I was looking for that, but I just couldn't find it.

Thanks. I was looking for that, but I just couldn't find it.
dgrunwald commented 2013-08-19 13:34:49 -05:00 (Migrated from github.com)

For CSharpProjectContent, I think it's sufficient if you provide AddResource(IAssemblyResource) and RemoveResource(IAssemblyResource) methods. The concrete implementation of the interface in this case can be left to the caller (for example, the GetResourceStream method in SharpDevelop might read the resources from an open editor instead of accessing the file system).

Also, AssemblyDefinition.ReadAssembly will fail for non-primary modules; it's better to use ModuleDefinition.ReadModule

For `CSharpProjectContent`, I think it's sufficient if you provide `AddResource(IAssemblyResource)` and `RemoveResource(IAssemblyResource)` methods. The concrete implementation of the interface in this case can be left to the caller (for example, the `GetResourceStream` method in SharpDevelop might read the resources from an open editor instead of accessing the file system). Also, `AssemblyDefinition.ReadAssembly` will fail for non-primary modules; it's better to use `ModuleDefinition.ReadModule`
erik-kallen commented 2013-08-19 13:34:58 -05:00 (Migrated from github.com)

Removed the unnecessary extra fileName parameter (rebased)

Removed the unnecessary extra fileName parameter (rebased)
erik-kallen commented 2013-08-19 13:35:55 -05:00 (Migrated from github.com)

OK, I'll wait for all your comments before doing more :)

OK, I'll wait for all your comments before doing more :)
erik-kallen commented 2013-08-19 13:36:33 -05:00 (Migrated from github.com)

Should RemoveResource take an IAssemblyResource or just a resource name?

Should RemoveResource take an `IAssemblyResource` or just a resource name?
dgrunwald commented 2013-08-19 13:44:40 -05:00 (Migrated from github.com)

IAssemblyResource.
And maybe we should also support adding/removing multiple resources with a single call, as with AddAssemblyReferences?

`IAssemblyResource`. And maybe we should also support adding/removing multiple resources with a single call, as with `AddAssemblyReferences`?
erik-kallen commented 2013-08-19 13:48:36 -05:00 (Migrated from github.com)

Yes, why not? It's easy.

Yes, why not? It's easy.

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-icsharpcode/NRefactory!287
No description provided.