Ejemplo n.º 1
0
        public static SubstitutionInfo ProcessSubstitutions(AssemblyDefinition assembly, LinkContext context)
        {
            if (context.Annotations.GetAction(assembly) == AssemblyAction.Skip)
            {
                return(null);
            }

            var rsc = GetEmbeddedXml(assembly, res => res.Name.Equals("ILLink.Substitutions.xml", StringComparison.OrdinalIgnoreCase));

            if (rsc == null)
            {
                return(null);
            }

            BodySubstitutionParser parser = null;

            try {
                context.LogMessage($"Processing embedded substitution descriptor {rsc.Name} from {assembly.Name}");
                parser = GetExternalSubstitutionParser(context, rsc, assembly);
            } catch (XmlException ex) {
                context.LogError($"Error processing {rsc.Name}: {ex}", 1003);
            }

            if (parser == null)
            {
                return(null);
            }

            var substitutionInfo = new SubstitutionInfo();

            parser.Parse(substitutionInfo);
            return(substitutionInfo);
        }
Ejemplo n.º 2
0
        public bool TryGetSubstitutionInfo(MemberReference member, out SubstitutionInfo xmlInfo)
        {
            var assembly = member.Module.Assembly;

            if (!_embeddedXmlInfos.TryGetValue(assembly, out xmlInfo))
            {
                xmlInfo = EmbeddedXmlInfo.ProcessSubstitutions(assembly, _context);
                _embeddedXmlInfos.Add(assembly, xmlInfo);
            }

            return(xmlInfo != null);
        }
Ejemplo n.º 3
0
 public MemberActionStore(LinkContext context)
 {
     PrimarySubstitutionInfo = new SubstitutionInfo();
     _embeddedXmlInfos       = new Dictionary <AssemblyDefinition, SubstitutionInfo> ();
     _context = context;
 }