Hey Jb, I am late in posting but I was able to do it with ResourceWriter and then write to the assembly using Cecil. You do not need to serialize it to baml but a stream must be written to the resource data.
Thanks SrcK On Feb 16, 8:50 am, srcKode <[email protected]> wrote: > Hey JB, > Well I was looking for options where I could create a > Mono.Cecil.Resource or an EmbeddedResource with Entries that hold the > binary xaml using Cecil. > What I mean is normally when you read a Resource using a Resource > Reader you could iterate through the reader to copy/view the resources > within it ... like > > EmbeddedResource r = > SourceAssembly.Module.Resources.OfType<EmbeddedResource>() > var stream = r.GetResourceStream(); > ResourceReader reader = new ResourceReader(stream); > foreach (DictionaryEntry entry in reader) > { > ///Read the values in the entry > > } > > I tried using Resource Writer to copy the existing entries and create > new ones but in vain. > > I am not sure how to do it using any other option. > > Thanks > SrcK > > On Feb 15, 3:17 pm, Jb Evain <[email protected]> wrote: > > > > > > > > > On Feb 15, 2012, at 11:11 AM, srcKode wrote: > > > > You are correct, the resource can be removed and added again.But the > > > Question is how do I write the baml to the Resource that I am going to > > > create. > > > > I can read each dictionaryentry from the resource reader but not able > > > to create a resource. > > > That I have no idea, and it's not related to Cecil at all. > > > I bet there's a BAML serializer somewhere. > > > Jb -- -- mono-cecil
