-1

我正在使用配置文件从命令行运行 dotfuscator 5。这工作正常,或多或少,除了刚刚出现的一个新要求。

我有一个类有少量(少于六个)需要从重命名中排除的 void 方法(对于按名称调用反射方法的迂回系统;不要问......)

他们的签名是(改名以保护无辜者)void Method(System.Xml.XmlNode xnode, ref System.String str)

我的问题有两个:

  • 如何在 dotfuscator 配置语法中表达 ref 参数?
  • 为什么不使用 Map 文件中引用的方法的签名?

映射文件包含<signature>void(System.Xml.XmlNode, string&amp;)</signature>重命名这些方法时的元素。因此,我希望能够在配置文件中指定:

<type name="ParentClass" excludetype="false">
<method signature="void(System.Xml.XmlNode, string&amp;)"/>
</type>

这行不通。命令行实用程序的输出声称配置文件无效。

如果我包含 syntax name=".*" regex="true",则该类型中的所有方法都将被排除。我不想要那个。我理解为什么会这样 - 规则是 ORed 在一起的 - 但是该实用程序通过拒绝指定我的实际要求的配置文件来强制我使用我不想要的选项。

是什么赋予了?

我觉得 - 因为我开始对此感到恼火 - 我应该指出我发现 Dotfuscator 文档......不是很好。

4

1 回答 1

1

The config file is invalid because the method node has no "name".

If you're just trying to exclude one particular method, you can use the UI to actually click the checkbox next to that method in the Renaming -> Excludes treeview on the left, which will generate the correct XML for you. If you decide to go this route, delete your existing <type> node first.

If you want it to match any method in ParentClass with that signature (even if there's only one), the xml should be (substitute in the correct value for <Namespace>):

 <type name="<Namespace>.ParentClass" excludetype="false">
    <method name=".*" regex="true" signature="void(System.Xml.XmlNode, string&amp;)"/>
 </type>

With the rule created, you can use the UI to navigate to the Rename -> Exclude tab, right click the method node in the Custom Rules treeview on the right and click Preview. It should highlight the method you're looking for. Here's a screenshot of what it should look like in the UI when Preview is clicked: http://files.preemptive.com/Support/CustomRuleRefParam.png

于 2012-01-23T16:16:57.903 回答