导出已安装app资源
I needed to compare two resource-only satellite assemblies to see what strings had changed. Sometimes we need to update a string here and there and QA needs to know exactly what changed. Here's a quick "ResourceExporter." It will export stuff in a name=value format, which can, by the way, be turned back into RESX files using resgen.exe. No warrenty express or implied. I've run it successfully on the two assemblies I was comparing. Your Mileage May Vary.
我需要比较两个仅资源的附属程序集,以查看更改了哪些字符串。 有时我们需要在此处和此处更新字符串,而QA需要确切地知道更改了什么。 这是一个快速的“ ResourceExporter”。 它将以name = value格式导出内容,顺便说一句,可以使用resgen.exe将其转换回RESX文件。 没有明示或暗示的担保。 我已经在我正在比较的两个程序集上成功运行了它。 你的旅费可能会改变。
1 static void Main(string[] args)
2 {
3 Assembly a = Assembly.LoadFile(Path.Combine(System.Environment.CurrentDirectory,args[0]));
4 string[] resources = a.GetManifestResourceNames();
5 using (StreamWriter strWriter = File.CreateText(
Path.Combine(System.Environment.CurrentDirectory,args[0]+".txt")))
6 {
7 foreach(string resourceName in resources)
8 {
9 using(Stream str = a.GetManifestResourceStream(resourceName))
10 {
11 using(ResourceReader reader = new ResourceReader(str))
12 {
13 foreach(DictionaryEntry entry in reader)
14 {
15 strWriter.WriteLine(String.Format("{0}={1}", entry.Key, entry.Value));
16 }
17 }
18 }
19 }
20 }
21 }
翻译自: https://www.hanselman.com/blog/exporting-resources-from-a-resourceonly-assembly
导出已安装app资源