コード例 #1
0
        void ApplySettings(IDnlibDef def, Rules rules, IEnumerable <ProtectionSettingsInfo> infos, ProtectionSettings settings = null)
        {
            if (settings == null)
            {
                settings = new ProtectionSettings();
            }
            else
            {
                settings = new ProtectionSettings(settings);
            }

            ApplyRules(context, def, rules, settings);
            settings = ProtectionParameters.GetParameters(context, def);

            ProtectionSettingsInfo?last = null;
            var parser = new ObfAttrParser(protections);

            foreach (var info in infos)
            {
                if (info.Exclude)
                {
                    if (info.ApplyToMember)
                    {
                        settings.Clear();
                    }
                    continue;
                }

                last = info;

                if (info.ApplyToMember && !string.IsNullOrEmpty(info.Settings))
                {
                    parser.ParseProtectionString(settings, info.Settings);
                }
            }
            if (last != null && !last.Value.ApplyToMember &&
                !string.IsNullOrEmpty(last.Value.Settings))
            {
                parser.ParseProtectionString(settings, last.Value.Settings);
            }
        }
コード例 #2
0
        // Token: 0x060001B4 RID: 436 RVA: 0x0000E008 File Offset: 0x0000C208
        private void ApplySettings(IDnlibDef def, Dictionary <Rule, PatternExpression> rules, IEnumerable <ObfAttrMarker.ProtectionSettingsInfo> infos, ProtectionSettings settings = null)
        {
            if (settings == null)
            {
                settings = new ProtectionSettings();
            }
            else
            {
                settings = new ProtectionSettings(settings);
            }
            base.ApplyRules(this.context, def, rules, settings);
            settings = ProtectionParameters.GetParameters(this.context, def);
            ObfAttrMarker.ProtectionSettingsInfo?last = null;
            ObfAttrParser parser = new ObfAttrParser(this.protections);

            foreach (ObfAttrMarker.ProtectionSettingsInfo info in infos)
            {
                if (info.Exclude)
                {
                    if (info.ApplyToMember)
                    {
                        settings.Clear();
                    }
                }
                else
                {
                    last = new ObfAttrMarker.ProtectionSettingsInfo?(info);
                    if (info.ApplyToMember && !string.IsNullOrEmpty(info.Settings))
                    {
                        parser.ParseProtectionString(settings, info.Settings);
                    }
                }
            }
            if (last.HasValue && !last.Value.ApplyToMember && !string.IsNullOrEmpty(last.Value.Settings))
            {
                parser.ParseProtectionString(settings, last.Value.Settings);
            }
        }
コード例 #3
0
ファイル: ObfAttrMarker.cs プロジェクト: jroessel/ConfuserEx
 public ProtectionSettingsStack(ProtectionSettingsStack copy)
 {
     context = copy.context;
     stack   = new Stack <Tuple <ProtectionSettings, ProtectionSettingsInfo[]> >(copy.stack);
     parser  = copy.parser;
 }
コード例 #4
0
ファイル: ObfAttrMarker.cs プロジェクト: jroessel/ConfuserEx
 public ProtectionSettingsStack(ConfuserContext context, Dictionary <string, Protection> protections)
 {
     this.context = context;
     stack        = new Stack <Tuple <ProtectionSettings, ProtectionSettingsInfo[]> >();
     parser       = new ObfAttrParser(protections);
 }
コード例 #5
0
 public ProtectionSettingsStack(ProtectionSettingsStack copy)
 {
     context = copy.context;
     stack = new Stack<Tuple<ProtectionSettings, ProtectionSettingsInfo[]>>(copy.stack);
     parser = copy.parser;
 }
コード例 #6
0
 public ProtectionSettingsStack(ConfuserContext context, Dictionary<string, Protection> protections)
 {
     this.context = context;
     stack = new Stack<Tuple<ProtectionSettings, ProtectionSettingsInfo[]>>();
     parser = new ObfAttrParser(protections);
 }
コード例 #7
0
        void ApplySettings(IDnlibDef def, Rules rules, IEnumerable<ProtectionSettingsInfo> infos, ProtectionSettings settings = null)
        {
            if (settings == null)
                settings = new ProtectionSettings();
            else
                settings = new ProtectionSettings(settings);

            ApplyRules(context, def, rules, settings);
            settings = ProtectionParameters.GetParameters(context, def);

            ProtectionSettingsInfo? last = null;
            var parser = new ObfAttrParser(protections);
            foreach (var info in infos) {
                if (info.Exclude) {
                    if (info.ApplyToMember)
                        settings.Clear();
                    continue;
                }

                last = info;

                if (info.ApplyToMember && !string.IsNullOrEmpty(info.Settings)) {
                    parser.ParseProtectionString(settings, info.Settings);
                }
            }
            if (last != null && !last.Value.ApplyToMember &&
                !string.IsNullOrEmpty(last.Value.Settings)) {
                parser.ParseProtectionString(settings, last.Value.Settings);
            }
        }