导出resource文件的的资源

本文介绍了一个简单的小工具,能够批量导出资源文件中的资源,避免了反编译后逐个查找的繁琐过程。通过使用C#编程语言,此工具可以读取指定的资源文件并将其内容保存到指定的目录下。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

namespaceResExport
{
classProgram
{
staticvoidMain(string[]args)
{
ResourceReaderres=newResourceReader("MSVirtualEvent.g.resources");//该文件放到bin
IDictionaryEnumeratordics=res.GetEnumerator();
while(dics.MoveNext())
{
Streams=(Stream)dics.Value;
intfileSize=(int)s.Length;
byte[]fileContent=newbyte[fileSize];
s.Read(fileContent,0,fileSize);
FileStreamfs;
stringfilepath=dics.Key.ToString();
filepath=Path.Combine("C:\\",filepath);//保存到指定目录
filepath=Path.GetFullPath(filepath);
varp=Path.GetDirectoryName(filepath);//要创建的目录
if(!Directory.Exists(p))
{
Directory.CreateDirectory(p);
}

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

res.Close();

}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值