{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/cci/issues/23","repository_url":"https://api.github.com/repos/Microsoft/cci","labels_url":"https://api.github.com/repos/Microsoft/cci/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/cci/issues/23/comments","events_url":"https://api.github.com/repos/Microsoft/cci/issues/23/events","html_url":"https://github.com/Microsoft/cci/issues/23","id":190963914,"number":23,"title":"How should resource-emitting code be translated?","user":{"login":"masonwheeler","id":7650031,"avatar_url":"https://avatars.githubusercontent.com/u/7650031?v=3","gravatar_id":"","url":"https://api.github.com/users/masonwheeler","html_url":"https://github.com/masonwheeler","followers_url":"https://api.github.com/users/masonwheeler/followers","following_url":"https://api.github.com/users/masonwheeler/following{/other_user}","gists_url":"https://api.github.com/users/masonwheeler/gists{/gist_id}","starred_url":"https://api.github.com/users/masonwheeler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masonwheeler/subscriptions","organizations_url":"https://api.github.com/users/masonwheeler/orgs","repos_url":"https://api.github.com/users/masonwheeler/repos","events_url":"https://api.github.com/users/masonwheeler/events{/privacy}","received_events_url":"https://api.github.com/users/masonwheeler/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-11-22T10:40:49Z","updated_at":"2016-11-24T07:45:17Z","closed_at":null,"body":"I'm working on porting a compiler over from Reflection.Emit to CCI.  I've got most of it figured out by this point, but I can't seem to wrap my head around the Resource class.\r\n\r\nThe CLR managed resource model defines a Resource as a thing with a name that's a key to a list of name-value pairs.  You call [`ModuleBuilder.DefineResource()`](https://msdn.microsoft.com/en-us/library/s3y2e90h(v=vs.110).aspx), passing a Name and Description, to get an `IResourceWriter`, and then call [`AddResource`](https://msdn.microsoft.com/en-us/library/system.resources.iresourcewriter.addresource(v=vs.110).aspx) 1 or more times, passing a Name for each individual resource within that `IResourceWriter`'s named group.\r\n\r\nThe `Microsoft.Cci.MutableCodeModel.Resource` class appears to correspond to the individual sub-resources written by `IResourceWriter`, as it has a Name and a byte array for contents but no Description or collection of name-value pairs for sub-resources, but it also appears to correspond to the outer-level resource group, as it can refer to an external resource file, which can contain the name-value pairs within it.  It's all very unclear as to what the correct way is to port code using the Reflection.Emit model.\r\n\r\nWhat is the idiomatic way to create managed resource groups with CCI?"},"comment":{"url":"https://api.github.com/repos/Microsoft/cci/issues/comments/262710498","html_url":"https://github.com/Microsoft/cci/issues/23#issuecomment-262710498","issue_url":"https://api.github.com/repos/Microsoft/cci/issues/23","id":262710498,"user":{"login":"MichalStrehovsky","id":13110571,"avatar_url":"https://avatars.githubusercontent.com/u/13110571?v=3","gravatar_id":"","url":"https://api.github.com/users/MichalStrehovsky","html_url":"https://github.com/MichalStrehovsky","followers_url":"https://api.github.com/users/MichalStrehovsky/followers","following_url":"https://api.github.com/users/MichalStrehovsky/following{/other_user}","gists_url":"https://api.github.com/users/MichalStrehovsky/gists{/gist_id}","starred_url":"https://api.github.com/users/MichalStrehovsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichalStrehovsky/subscriptions","organizations_url":"https://api.github.com/users/MichalStrehovsky/orgs","repos_url":"https://api.github.com/users/MichalStrehovsky/repos","events_url":"https://api.github.com/users/MichalStrehovsky/events{/privacy}","received_events_url":"https://api.github.com/users/MichalStrehovsky/received_events","type":"User","site_admin":false},"created_at":"2016-11-24T07:45:17Z","updated_at":"2016-11-24T07:45:17Z","body":"> So I just provide my own wrapper around `ResourceWriter` to the facilities in the compiler that's expecting it, and when they close it I create a `Resource` with the byte stream that it's produced?\r\n\r\nI would try it out first in a small scratch program, but that's how it should work, yes. `ResourceWriter` conveniently implements `IResourceWriter`, so maybe you don't even need much wrapping."}}
{"actor":{"display_login":"MichalStrehovsky"}}