示例#1
0
            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);
                        }
                    }
                }
            }
示例#2
0
            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);
                    }
                }
            }
示例#3
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);
            }
        }
        // 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);
            }
        }
示例#5
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);
            }
        }