Пример #1
0
        private void Weave(string configFile)
        {
            AspectDngConfig conf = new AspectDngConfig(configFile);

            if (!File.Exists(conf.TargetAssembly))
            {
                throw new ConfigurationException("File doesn't exist: " + conf.TargetAssembly);
            }
            if (!File.Exists(conf.AspectsAssembly))
            {
                throw new ConfigurationException("File doesn't exist: " + conf.AspectsAssembly);
            }

            string backup = CopyToBackup(conf.TargetAssembly);

            if (conf.TargetAssembly == conf.AspectsAssembly || conf.AspectsAssembly == null || conf.AspectsAssembly == "")
            {
                Cil.Init(backup, backup);
            }
            else
            {
                Cil.Init(backup, conf.AspectsAssembly);
            }

            PerformWeave();
            Cil.SaveTo(conf.WeavedAssembly);
        }
Пример #2
0
        private void DirectWeave(string targetAssemblyPath)
        {
            if (!File.Exists(targetAssemblyPath))
            {
                throw new ConfigurationException("File doesn't exist: " + targetAssemblyPath);
            }

            string backup = CopyToBackup(targetAssemblyPath);

            Cil.Init(backup, backup);
            PerformWeave();
            Cil.SaveTo(targetAssemblyPath);
        }