|Dotfuscator > Configuring Dotfuscator via the GUI > The Rules Editing Interface > Creating Custom Rules > Selecting By Field|
Field rules are qualified by type rules, so they appear in the rules view as children of type nodes. A field rule will select all fields (in all types matched by the parent type rule) that match your criteria. Supported matching criteria include field name and field attributes.
You create a field rule by right clicking on the parent type rule’s node and selecting Add Field, 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.
In addition to field name, you can also select based on field attribute specifiers, using the values provided in the Attribute Specifier list box. A ‘-‘ preceding an attribute specifier negates the attribute (i.e. it selects all fields 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 (that is, the set of selected fields is the intersection of all fields that match each attribute specifier.). For example, you can select fields that are both public and static by selecting +public and +static from the list.
The attribute specifications are logically
AND-ed with the field name, so if you want to select all fields with a specific set of attributes, you need to provide a regular expression for the field name that selects all fields (i.e. ".*").
You can also select fields by signature. A signature specifies the type of the field. The field signature reduces the scope of the field rule, so if you want to create a rule that selects fields regardless of type, you need to provide a regular expression for the signature that selects all signatures (i.e. ".*"). This is the default value.
The corresponding field 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, and/or a signature associated with it. You can preview the fields selected by the rule by right clicking on the node and selecting the Preview option from the menu.
In the screen shot, a field rule is defined that selects the names of all fields (in all types) with names that start with “my”.