Ejemplo n.º 1
0
        public CompilerResults CompileAssemblyFromDomBatch(CompilerParameters options, CodeCompileUnit[] compilationUnits)
        {
            Setup(options, ContainsLocalFunctions(compilationUnits));

            foreach (var Unit in compilationUnits)
            {
                foreach (CodeAttributeDeclaration attribute in Unit.AssemblyCustomAttributes)
                {
                    EmitAttribute(ABuilder, attribute);
                }

                EmitNamespace(ABuilder, Unit.Namespaces[0]);
            }

            ABuilder.SetEntryPoint(EntryPoint, PEFileKinds.WindowApplication);
            Save();

            var    results = new CompilerResults(new TempFileCollection());
            string output  = options.OutputAssembly;

            if (options.GenerateInMemory)
            {
                results.TempFiles.AddFile(output, false);
                byte[] raw = File.ReadAllBytes(output);
                results.CompiledAssembly = Assembly.Load(raw);
                File.Delete(output);
            }
            else
            {
                results.PathToAssembly = Path.GetFullPath(output);
            }

            return(results);
        }
Ejemplo n.º 2
0
        public void Run()
        {
            ABuilder ab = new ABuilder();

            ab
            .AddField1()
            .AddField2();
            ConcreteProductA a = ab.Build();
        }
Ejemplo n.º 3
0
        public Actor Construct(ABuilder builder)
        {
            builder.BuildType();
            builder.BuildGender();
            builder.BuildFace();
            builder.BuildCostume();
            builder.BuildHairStyle();
            Actor actor = builder.CreateActor();

            return(actor);
        }
Ejemplo n.º 4
0
        public Actor Construct(ABuilder builder)
        {
            builder.BuildType();
            builder.BuildGender();
            builder.BuildFace();
            builder.BuildCostume();
            if (!builder.IsBareHeaded())
            {
                builder.BuildHairStyle();
            }
            Actor actor = builder.CreateActor();

            return(actor);
        }
Ejemplo n.º 5
0
 static void Main(string[] args)
 {
     var container = new Container();
     var obj       = ABuilder.Build(container);
     var obj1      = container.GetByName("obj1");
 }
 public static ABuilder With(this ABuilder builder, Action <ABuilder> action)
 {
     action(builder);
     return(builder);
 }