private Stream CaseInsensitiveManifestResourceStreamLookup(Assembly satellite, string name)
{
CompareInfo comparer = CultureInfo.InvariantCulture.CompareInfo;
//loop through the resource names in the assembly
// we try to handle the case where the assembly file name has been renamed
// by trying to guess the original file name based on the assembly name...
string assemblyShortName = satellite.GetName().Name;
foreach (string existingName in satellite.GetManifestResourceNames())
{
if (comparer.Compare(existingName, name, CompareOptions.IgnoreCase) == 0 ||
comparer.Compare(existingName, assemblyShortName + ".exe.licenses") == 0 ||
comparer.Compare(existingName, assemblyShortName + ".dll.licenses") == 0)
{
name = existingName;
break;
}
}
//finally, attempt to return our stream based on the
//case insensitive match we found
//
return satellite.GetManifestResourceStream(name);
}