Skip to content
This repository has been archived by the owner on Jan 27, 2019. It is now read-only.

Commit

Permalink
Fix IsVisibleOutside testing
Browse files Browse the repository at this point in the history
  • Loading branch information
yck1509 committed Oct 13, 2015
1 parent 2cb8427 commit 78cb337
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
23 changes: 23 additions & 0 deletions Confuser.Core/Project/ConfuserProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,17 @@ public enum SettingItemAction {
/// </summary>
/// <typeparam name="T"><see cref="Protection" /> or <see cref="Packer" /></typeparam>
public class SettingItem<T> : Dictionary<string, string> {
/// <summary>
/// Initialize this setting item instance
/// </summary>
/// <param name="id">The protection id</param>
/// <param name="action">The action to take</param>
/// <param name="inherit">Inherits protection</param>
public SettingItem(string id = null, SettingItemAction action = SettingItemAction.Add) {
Id = id;
Action = action;
}

/// <summary>
/// The identifier of component
/// </summary>
Expand Down Expand Up @@ -239,6 +250,18 @@ internal void Load(XmlElement elem) {
/// A rule that control how <see cref="Protection" />s are applied to module
/// </summary>
public class Rule : List<SettingItem<Protection>> {
/// <summary>
/// Initialize this rule instance
/// </summary>
/// <param name="pattern">The pattern</param>
/// <param name="preset">The preset</param>
/// <param name="inherit">Inherits protection</param>
public Rule(string pattern = "true", ProtectionPreset preset = ProtectionPreset.None, bool inherit = false) {
Pattern = pattern;
Preset = preset;
Inherit = inherit;
}

/// <summary>
/// Gets or sets the pattern that determine the target components of the rule.
/// </summary>
Expand Down
8 changes: 4 additions & 4 deletions Confuser.Renamer/AnalyzePhase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void Analyze(NameService service, ConfuserContext context, ProtectionParameters
void Analyze(NameService service, ConfuserContext context, ProtectionParameters parameters, MethodDef method) {
if (method.DeclaringType.IsVisibleOutside() &&
(method.IsFamily || method.IsFamilyOrAssembly || method.IsPublic) &&
!IsVisibleOutside(context, parameters, method))
IsVisibleOutside(context, parameters, method))
service.SetCanRename(method, false);

else if (method.IsRuntimeSpecialName)
Expand All @@ -176,7 +176,7 @@ void Analyze(NameService service, ConfuserContext context, ProtectionParameters
void Analyze(NameService service, ConfuserContext context, ProtectionParameters parameters, FieldDef field) {
if (field.DeclaringType.IsVisibleOutside() &&
(field.IsFamily || field.IsFamilyOrAssembly || field.IsPublic) &&
!IsVisibleOutside(context, parameters, field))
IsVisibleOutside(context, parameters, field))
service.SetCanRename(field, false);

else if (field.IsRuntimeSpecialName)
Expand All @@ -194,7 +194,7 @@ void Analyze(NameService service, ConfuserContext context, ProtectionParameters

void Analyze(NameService service, ConfuserContext context, ProtectionParameters parameters, PropertyDef property) {
if (property.DeclaringType.IsVisibleOutside() &&
!IsVisibleOutside(context, parameters, property))
IsVisibleOutside(context, parameters, property))
service.SetCanRename(property, false);

else if (property.IsRuntimeSpecialName)
Expand All @@ -212,7 +212,7 @@ void Analyze(NameService service, ConfuserContext context, ProtectionParameters

void Analyze(NameService service, ConfuserContext context, ProtectionParameters parameters, EventDef evt) {
if (evt.DeclaringType.IsVisibleOutside() &&
!IsVisibleOutside(context, parameters, evt))
IsVisibleOutside(context, parameters, evt))
service.SetCanRename(evt, false);

else if (evt.IsRuntimeSpecialName)
Expand Down

0 comments on commit 78cb337

Please sign in to comment.