Ejemplo n.º 1
0
 public ProjectContext()
 {
     Refs           = new List <Assembly>();
     EmitContext    = new EmitProjectContext();
     ProjectTypes   = new List <Type>();
     BinaryFileKind = PEFileKinds.Dll;
 }
Ejemplo n.º 2
0
        public static void GenerateBinary(ProjectContext context)
        {
            string             binFileName     = context.GetBinaryNameEx();
            var                assemblyName    = new AssemblyName(context.RootNameSpace);
            AssemblyBuilder    assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave);
            var                moduleBuilder   = assemblyBuilder.DefineDynamicModule(context.RootNameSpace, binFileName, true);
            EmitProjectContext emitContext     = new EmitProjectContext();

            emitContext.AssemblyName    = assemblyName;
            emitContext.AssemblyBuilder = assemblyBuilder;
            emitContext.ModuleBuilder   = moduleBuilder;
            context.EmitContext         = emitContext;
            setAttr(assemblyBuilder, context);
        }