使用Confuser混淆C#代码不适用于语言资源文件(DLL)

时间:2014-04-12 22:02:51

标签: c# winforms localization obfuscation

我在Visual Studio 2012中有一个C#项目(WinForms),运行Windows 7 Professional 64位。

我的WinForms应用程序有两种语言 - 英语和德语。 因此,在我的Visual Studio项目中,我有两个资源文件(.resx) lang.resx (包含我的默认语言,德语)和 lang.en-GB.resx (包含我的可选语言,英语)。

当我编译.NET 3.5的项目时,VS在我的应用程序项目文件夹中创建了两个文件夹," de_DE" " en_GB" ,并将包含语言内容的DLL文件复制到这两个文件夹中(两个文件都命名为" app.resources.dll")。

到目前为止,这么好。我的应用程序运行良好,当没有"困惑"。当在Windows的英文版本上运行时,它显示英文文本,当在德语或Windows的任何其他语言版本上运行时,它显示德语文本......正如预期的那样。

现在,我使用Confusor 1.9版(最新的,预编译的,可下载的.exe版本)将我的代码与Confuser(在CodePlex:https://confuser.codeplex.com/上找到)混淆。

当我添加我的" app.exe"和" de-DE \ app.resources.dll"和" en-GB \ app.resources.dll"混淆,混淆只会生成1个混淆app.resources.dll - 而不是2(每个语言/资源DLL一个)。

这意味着,我无法在语言之间切换,因为confuser(而非两者)似乎只考虑了一个app.resources.dll。

我想我的项目设置没什么特别或优秀的(使用多种语言的普通的WinForm应用程序)。

我的问题是:

如何配置confuser以便正确地混淆app.exe和两个app.resources.dll文件?

非常感谢任何帮助(甚至提示)!

2 个答案:

答案 0 :(得分:1)

在confuser补丁列表中,它解决了您的确切问题:) http://confuser.codeplex.com/sourcecontrol/list/patches

补丁ID 14664与您的问题有关,看起来您需要在项目文件中设置条目(摘录自己的网站):

An example with language files, showing what the output should be:

Executables\Common.resources.dll -> targetfolder\common.resources.dll
Executables\de\Common.resources.dll -> targetfolder\de\common.resources.dll
Executables\fi\Common.resources.dll -> targetfolder\fi\common.resources.dll

etc.

After patching this can now be achieved with the following kind of project file:

...
<assembly path="..\Executables\Common.resources.dll" />
<assembly path="..\Executables\de\Common.resources.dll" toSubFolder="de" />
<assembly path="..\Executables\fi\Common.resources.dll" toSubFolder="fi" />

答案 1 :(得分:0)

难道你不能只重命名DLL吗?

  • de-DE \ app.resources.dll =&gt;脱DE_app.resources.dll
  • zh-CN \ app.resources.dll =&gt;烯GB_app.resources.dll