G
Guest
Hi,
I have an application for creating resource files. The application works
with it's own file format, and can be used by a translator to create
localized content. The app can then write data back to a VS solution.
I have a problem, though. I use a ResXResourceReader for reading existing
files, then a ResXResourceWriter to write the modified files. I need to read
the old file since the writer does not support updating existing entries and
will overwrite the file.
The problem is, that in the existing files I have encountered entries which
are base64 encoded. The problem occurs with a
System.Windows.Forms.ImageListStreamer for an image list. When adding it the
writer corrupts it. This is some code to illustrate what I'm doing:
ResXResourceReader reader = null;
IDictionaryEnumerator en = null;
if (File.Exists(file)) {
reader = new ResXResourceReader(file);
en = reader.GetEnumerator();
}
using (ResXResourceWriter writer = new ResXResourceWriter(file)) {
if (reader != null) {
while (en.MoveNext()) {
// Simplified, here I just add all existing
// resources...
writer.AddResource(en.Key.ToString(), en.Value);
}
reader.Close();
}
}
Can anybody help me on this? I need to write the
System.Windows.Forms.ImageListStreamer entries without corrupting them (or
any other special entries for that matter).
Thanks,
Jakob
I have an application for creating resource files. The application works
with it's own file format, and can be used by a translator to create
localized content. The app can then write data back to a VS solution.
I have a problem, though. I use a ResXResourceReader for reading existing
files, then a ResXResourceWriter to write the modified files. I need to read
the old file since the writer does not support updating existing entries and
will overwrite the file.
The problem is, that in the existing files I have encountered entries which
are base64 encoded. The problem occurs with a
System.Windows.Forms.ImageListStreamer for an image list. When adding it the
writer corrupts it. This is some code to illustrate what I'm doing:
ResXResourceReader reader = null;
IDictionaryEnumerator en = null;
if (File.Exists(file)) {
reader = new ResXResourceReader(file);
en = reader.GetEnumerator();
}
using (ResXResourceWriter writer = new ResXResourceWriter(file)) {
if (reader != null) {
while (en.MoveNext()) {
// Simplified, here I just add all existing
// resources...
writer.AddResource(en.Key.ToString(), en.Value);
}
reader.Close();
}
}
Can anybody help me on this? I need to write the
System.Windows.Forms.ImageListStreamer entries without corrupting them (or
any other special entries for that matter).
Thanks,
Jakob