导出已安装app资源_从仅资源的装配中导出资源

导出已安装app资源

导出已安装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资源

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值