|Dotfuscator > Configuring Dotfuscator via the GUI > The Rules Editing Interface > Creating Custom Rules > Selecting By Type|
A type rule will select differently depending on what type of rule you are creating.
If you are creating a renaming exclusion rule, the rule will select just the type name for exclusion (provided the ExcludeType checkbox is checked), leaving members alone.
If you are specifying any other kind of rule, the rule will select zero or more types and all their members. This reflects the fact that in these cases, selecting a type means that you are in fact selecting all members defined by that type.
You create a type rule by clicking the Add Type button, then typing a name in the Name field. The name will be interpreted as a regular expression if the Regular Expression checkbox is checked; otherwise the name will be interpreted literally. The name must be a fully qualified type name that includes the namespace and parent class information if it is a nested type.
In addition to type name, you can also select based on type attribute specifiers, using the values provided in the "Spec" list box. A ‘-‘ preceding an attribute specifier negates the attribute (i.e. it selects all types that do not have the specified attribute). You can select multiple attributes from the list; the criteria implied by multiple selections are logically
AND-ed together. For example, you can select types that are both public and abstract by selecting +public and +abstract from the list.
The attribute specifications are logically
AND-ed with the type name, so if you want to select all types with a specific set of attributes, you need to provide a regular expression for the type name that selects all types (i.e. "
The Exclude Type checkbox is only active if you are working with renaming exclusion rules. If checked, the rule will exclude the names of matching types from renaming and allow you to provide additional rules for selecting members of matching types. If left unchecked, the rule will still select matching types for the purposes of applying rules to members of the types, but it will not select the type name. In this manner, you can write renaming exclusion rules that exclude methods and fields, but allow type names to be obfuscated.
The Apply to Derived Types checkbox is only active if you are working with renaming or pruning rules. If checked, the rule will additionally exclude the child classes of matching types from renaming or pruning. In this manner, you can write renaming exclusion rules that exclude entire inheritance hierarchies.
The corresponding node displayed in the rule editing view has a child element that indicates whether the rule is a regular expression and whether the rule has attribute specifiers associated with it. You can preview the types selected by the rule by right clicking on the node and selecting the Preview option from the menu.
In the screen shot, a type rule is defined that selects the names of all concrete (not abstract) types for exclusion from renaming.