Esempio n. 1
0
        private static WeavingParameters GetWeavingParameters(CommandLineParameters options)
        {
            WeavingParameters weavingParameters;

            using (var fodyXmlConfiguration = new FileStream(options.FodyWeaverConfigPath, FileMode.Open))
            {
                var currentDirectory = Directory.GetCurrentDirectory();
                weavingParameters = WeavingParameters.GetWeavingParameters(fodyXmlConfiguration, currentDirectory, options.References);
            }
            return(weavingParameters);
        }
        public static WeavingParameters GetWeavingParameters(Stream fodyXmlConfiguration, string weaverFolder, string references)
        {
            var xmlDocument = new XmlDocument();

            xmlDocument.Load(fodyXmlConfiguration);

            var weaverEntries = new List <WeaverEntry>();

            foreach (XmlNode documentElementChildNode in xmlDocument.DocumentElement.ChildNodes)
            {
                weaverEntries.Add(new WeaverEntry()
                {
                    AssemblyName = documentElementChildNode.Name,
                    Element      = documentElementChildNode.OuterXml,
                    TypeName     = "ModuleWeaver",
                    AssemblyPath = Path.Combine(weaverFolder, $"{documentElementChildNode.Name}.Fody.dll")
                });
            }

            var weavingParameters = new WeavingParameters(weaverEntries, references);

            return(weavingParameters);
        }
        public void Weave(WeavingParameters weavingParameters)
        {
            var entries = weavingParameters.WeaverEntries.ToList();

            WeaveImpl(entries, weavingParameters.References);
        }