Hi,

This is a bit outside of the scope of Cecil itself. At that point in
time you only need to find a way to read your resource set from
memory, and write it back to memory.

That being said, here's some code that you could use:

var resource = (EmbeddedResource) module.Resources.Single (r => r.Name
== "Foo.resources");

var reader = new ResourceReader (resource.GetResourceStream ());
foreach (DictionaryEntry kv in reader)
Console.WriteLine("Key: {0} Value: {1}", kv.Key, kv.Value);

var newResourceStream = new MemoryStream ();
var writer = new ResourceWriter (newResourceStream);

foreach (DictionaryEntry kv in reader) {
if (kv.Value is string)
writer.AddResource((string)kv.Key, (string)kv.Value);
else if (kv.Value is byte[])
writer.AddResource ((string) kv.Key, (byte[]) kv.Value);
else
writer.AddResource ((string) kv.Key, kv.Value);
}

var newResource = new EmbeddedResource (resource.Name,
resource.Attributes, newResourceStream.ToArray ());
module.Resources.Remove (resource);
module.Resources.Add (newResource);

There's probably a much simpler way.

On Sat, Mar 8, 2014 at 9:56 PM, NIkNik <[email protected]> wrote:
> Hello!
>
> if i open dll in text editor, i see System.Resources.RuntimeResourceSet.
> And than list dll.
> How get this list, and change public token dll.
>
> --
> --
> --
> mono-cecil
> ---
> You received this message because you are subscribed to the Google Groups
> "mono-cecil" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
-- 
--
mono-cecil
--- 
You received this message because you are subscribed to the Google Groups 
"mono-cecil" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to