I have a separate application (that is for the purpose of spell checking my .resx files) that runs as a pre-build event. However, if the .resx file contains a text file (xml for example) my application will load the file and attempt to spell check it. This is not really what I want it to do. Is there a way to tell from the ResXResourceReader if the resource loaded is actually a file?
Code sample looks like this:
ResXResourceReader reader = new ResXResourceReader(filename);
ResourceSet resourceset = new ResourceSet(reader);
Dictionary<DictionaryEntry, object> newvalues = new Dictionary<DictionaryEntry, object>();
foreach (DictionaryEntry entry in resourceset)
{
//Figure out in this 'if' if it is an embedded file and should be ignored.
if (entry.Key.ToString().StartsWith(">>") || !(entry.Value is string) || string.Compare((string)entry.Value, "---") == 0)
continue;
}
Yes. Setting
UseResXDataNodesonResXResourceReaderwill cause the dictionary values to be aResXDataNodeinstead of the actual value, which you can use to determine if it is a file or not. Something like this: