Save GenericResource
Hello,
I try to change a .png-File in a ressource. I'm really sure, that the choosen ressource is a correct png resource. I also exported the resource. All ok. But wenn I change the data with some other .png data, it crashes with an Win32 Exception. (Translated from german to english it means something like "This requirement/request is not supported.")
It crashs at the last line (saveTo()) from my example.
filename = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "imageres.dll");
using (ResourceInfo vi = new ResourceInfo())
{
vi.Load(filename);
//Take a png resource
GenericResource res = (vi.Resources[vi.ResourceTypes[2]][14] as GenericResource);
Image imageIn = Image.FromFile(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "import.png"));
MemoryStream ms = new MemoryStream();
imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
res.Data = ms.ToArray();
//Win32 Exception. Why?
res.SaveTo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "imageres.dll"));
}
Greets, Raffael
Did you ever solve this? Ca you post the entire stack please and maybe write this repro as a unit test within the project? Thx.
You're trying to save a GenericResource, this looks like the same issue as #75. @dblock are there any plans to fix this?
@yoshiask I don't have any plans to fix it, but you're welcome to please contribute!