如何从程序集中读取资源

首先使用反编译工具查看程序集中的资源

成都创新互联公司专注于吉木乃企业网站建设,成都响应式网站建设公司,商城网站定制开发。吉木乃网站建设公司,为吉木乃等地区提供建站服务。全流程按需制作网站,专业设计,全程项目跟踪,成都创新互联公司专业和态度为您提供的服务

如何从程序集中读取资源

代码如下:

Assembly myAssembly;
myAssembly = System.Reflection.Assembly.Load("SQLEditor2"); //不要加程序集扩展名
System.Resources.ResourceManager myManager = new System.Resources.ResourceManager("SQLEditor2.FrmEditor", myAssembly); //不要加.resources
var icon = (System.Drawing.Icon)myManager.GetObject("$this.Icon");
using (var f = File.Create("C:\\$this.Icon.ico"))
{
    icon.Save(f);
}
string[] bmpNames = new string[]{
                               "tsbsel.Image",
                               "toolStripButton1.Image",
                               "toolStripSplitButton1.Image"
                            };
System.Drawing.Image myImage;
foreach (string bmpName in bmpNames)
{
    myImage = (System.Drawing.Image)myManager.GetObject(bmpName);
    myImage.Save(String.Format("C:\\{0}.bmp", bmpName));
}

这样就可以得到程序集中的Icon和Bitmap了,string类型的内容直接从反编译工具中获得就可以了。


当前文章:如何从程序集中读取资源
URL网址:http://lszwz.com/article/jehsjo.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款