void ApplyInfo(IDnlibDef context, ProtectionSettings settings, IEnumerable <ProtectionSettingsInfo> infos, bool current) { foreach (var info in infos) { if (info.Condition != null && !(bool)info.Condition.Evaluate(context)) { continue; } if (info.Exclude) { if (current) { settings.Clear(); } else if (info.ApplyToMember) { settings.Clear(); } continue; } if ((info.ApplyToMember || current || info.Condition != null) && !string.IsNullOrEmpty(info.Settings)) { parser.ParseProtectionString(settings, info.Settings); } } }
void ApplyInfo(IDnlibDef context, ProtectionSettings settings, IEnumerable <ProtectionSettingsInfo> infos, ApplyInfoType type) { foreach (var info in infos) { if (info.Condition != null && !(bool)info.Condition.Evaluate(context)) { continue; } if (info.Condition == null && info.Exclude) { if (type == ApplyInfoType.CurrentInfoOnly || (type == ApplyInfoType.CurrentInfoInherits && info.ApplyToMember)) { settings.Clear(); } } if (!string.IsNullOrEmpty(info.Settings)) { if ((type == ApplyInfoType.ParentInfo && info.ApplyToMember) || type == ApplyInfoType.CurrentInfoOnly || (type == ApplyInfoType.CurrentInfoInherits && info.Condition == null && info.ApplyToMember)) { parser.ParseProtectionString(settings, info.Settings); } } } }
/// <summary> /// Applies the rules to the target definition. /// </summary> /// <param name="context">The working context.</param> /// <param name="target">The target definition.</param> /// <param name="rules">The rules.</param> protected void ApplyRules(ConfuserContext context, IDnlibDef target, Rules rules) { var ret = new ProtectionSettings(); foreach (var i in rules) { if (!(bool)i.Value.Evaluate(target)) { continue; } if (!i.Key.Inherit) { ret.Clear(); } FillPreset(i.Key.Preset, ret); foreach (var prot in i.Key) { if (prot.Action == SettingItemAction.Add) { ret[protections[prot.Id]] = new Dictionary <string, string>(prot, StringComparer.OrdinalIgnoreCase); } else { ret.Remove(protections[prot.Id]); } } } ProtectionParameters.SetParameters(context, target, ret); }
/// <summary> /// Applies the rules to the target definition. /// </summary> /// <param name="context">The working context.</param> /// <param name="target">The target definition.</param> /// <param name="rules">The rules.</param> /// <param name="baseSettings">The base settings.</param> // Token: 0x06000196 RID: 406 RVA: 0x0000D45C File Offset: 0x0000B65C protected void ApplyRules(ConfuserContext context, IDnlibDef target, Dictionary <Rule, PatternExpression> rules, ProtectionSettings baseSettings = null) { ProtectionSettings ret = (baseSettings == null) ? new ProtectionSettings() : new ProtectionSettings(baseSettings); foreach (KeyValuePair <Rule, PatternExpression> i in rules) { if ((bool)i.Value.Evaluate(target)) { if (!i.Key.Inherit) { ret.Clear(); } this.FillPreset(i.Key.Preset, ret); foreach (SettingItem <Protection> prot in i.Key) { if (prot.Action == SettingItemAction.Add) { ret[this.protections[prot.Id]] = new Dictionary <string, string>(prot, StringComparer.OrdinalIgnoreCase); } else { ret.Remove(this.protections[prot.Id]); } } } } ProtectionParameters.SetParameters(context, target, ret); }