【问题标题】:Confusing C# code with Confuser does not work with language resource files (DLLs)使用 Confuser 混淆 C# 代码不适用于语言资源文件 (DLL)
【发布时间】:2014-05-27 00:43:40
【问题描述】:

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

我的 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(不是两者)。

我想我的项目设置并没有什么特别或出色的(使用一种以上语言的普通 olde WinForm 应用程序)。

我的问题是:

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

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

【问题讨论】:

  • 它是开源的,所以看代码。
  • 我知道,它是开源的——但我们德国人目前在摆弄开源软件方面的记录很糟糕;-) 所以我宁愿不要自己弄乱 Confuser 的源代码...

标签: c# winforms localization obfuscation


【解决方案1】:

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

【讨论】:

    【解决方案2】:

    你不能只重命名 DLL 吗?

    • de-DE\app.resources.dll => de-DE_app.resources.dll
    • en-GB\app.resources.dll => en-GB_app.resources.dll

    【讨论】:

    • DLL 是从我的 lang.resx 和 lang.en-GB.resx 文件生成的,并自动命名为“app.resouces.dll” - 我在 Visual Studio 中对此进行了研究,但我无法找到任何设置来控制嵌入资源的 DLL 名称。只是在资源管理器中重命名它们,是你的意思吗?我想这行不通,因为我的 .exe 文件引用了它们。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-02-10
    • 1970-01-01
    • 1970-01-01
    • 2013-03-24
    • 2011-08-05
    • 1970-01-01
    • 2020-03-06
    相关资源
    最近更新 更多