예제 #1
0
        public void Merge(
            FileInfo source,
            Pipe <CilDocumentSyntax> compile,
            FileInfo destination)
        {
            CilSyntax context = CilBackend.CreateCompiler(null);

            context
            .BeginDocument()
            .AssemblyRewrite(source.FullName)
            .CustomAttribute(
                context.Types.Import(
                    typeof(DerivedAssemblyMarker)))
            .EndAssembly()
            .Do(compile)
            .EndDocument();

            ((IAssemblyResolverParameters)context).AddSearchDirectory(destination.DirectoryName);

            var writer = context as IAssemblyWriter;

            if (writer == null)
            {
                throw new InvalidOperationException("Backend does not support assembly writing");
            }

            writer.Write(destination.FullName);
        }
예제 #2
0
 public CecilBackendLanguage(string filePath)
 {
     Syntax     = CilBackend.CreateCompiler(filePath);
     outputPath = Path.GetFileNameWithoutExtension(filePath) + ".exe";
 }