• 导出resource文件的的资源


    写个小工具,方便一次性将resource文件中的资源导出,不然反编译后一个个找,真是太麻烦了。
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Resources;
    using System.Collections;
    using System.IO;

    namespace ResExport
    {
        class Program
        {
            static void Main(string[] args)
            {
                ResourceReader res = new ResourceReader("MSVirtualEvent.g.resources");//该文件放到bin
                IDictionaryEnumerator dics = res.GetEnumerator();
                while (dics.MoveNext())
                {
                    Stream s = (Stream)dics.Value;
                    int fileSize = (int)s.Length;
                    byte[] fileContent = new byte[fileSize];
                    s.Read(fileContent, 0, fileSize);
                    FileStream fs;
                    string filepath = dics.Key.ToString();
                    filepath=Path.Combine("C://",filepath); //保存到指定目录
                    filepath = Path.GetFullPath(filepath);
                    var   p = Path.GetDirectoryName(filepath);//要创建的目录
                    if (!Directory.Exists(p))
                    {
                        Directory.CreateDirectory(p);
                    }

                    FileInfo fi = new System.IO.FileInfo(filepath);
                    fs = fi.OpenWrite();
                    fs.Write(fileContent, 0, fileSize);
                    fs.Close();
                }

                res.Close();

            }
  • 相关阅读:
    系统分析师考试
    系统分析师
    软件设计师考试
    海恩法则”的启示:制度不落到实处事故必发
    eclipse下生成Java类图和时序图,生成UML图
    bzoj4010【HNOI2015】菜肴制作
    atitit.提升开发效率---MDA 软件开发方式的革命(5)----列表查询建模
    【数据结构和算法16】堆排序
    这一路走来,冷暖自知 (附算法demos)
    c++实现二叉搜索树
  • 原文地址:https://www.cnblogs.com/chengulv/p/4190164.html
Copyright © 2020-2023  润新知