Example #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);
                        }
                    }
                }
            }
Example #2
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.Condition != null && info.ApplyToMember) ||
                            type == ApplyInfoType.CurrentInfoOnly ||
                            (type == ApplyInfoType.CurrentInfoInherits && info.Condition == null && info.ApplyToMember)) {
                            parser.ParseProtectionString(settings, info.Settings);
                        }
                    }
                }
            }