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

标签 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 个混淆的应用程序.resources.dll - 不是 2 个(每种语言/资源 DLL 一个)。

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

我想我的项目设置没有什么特别或突出的(普通的 WinForm 应用程序,具有不止一种语言)。

我的问题是:

我必须如何配置混淆器才能正确混淆我的 app.exe 和两个 app.resources.dll 文件?

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

最佳答案

在混淆补丁列表中,它解决了您的确切问题:) 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" />

关于c# - 使用 Confuser 混淆 C# 代码不适用于语言资源文件 (DLL),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23036669/

相关文章:

c# - 附加到工厂实例化的单例事件 - 什么是干净的方法?

c# - 如何在 VS 2008 安装项目注册表编辑器中添加 reg_multi_sz 值

c# - ASP.NET 应用程序对象 getter 和 setter

winforms - DotNetBar 与 Krypton

winforms - "Illegal characters in path."Visual Studio WinForm 设计 View

Java:跨多个 GUI 对象共享本地化对象的最佳实践?

c# - 使用ASP.MVC编辑树状结构

objective-c - 没有应用程序重启,本地化图像不会加载

ubuntu - 使用 gettext 本地化文本

c# - 如何在 C# 中旋转标签?