static void Main(string[] args) { // The client code creates a builder object, passes it to the // director and then initiates the construction process. The end // result is retrieved from the builder object. var director = new Director(); var carBuilder = new CarBuilder(); var sportEngine = new SportEngine(); var workEngine = new WorkEngine(); director.Builder = carBuilder; director.Engine = workEngine; Console.WriteLine("Crear el carro:"); director.CrearCarro(); Console.WriteLine(carBuilder.GetResult().ListParts()); var manualBuilder = new ManualBuilder(); director.Builder = manualBuilder; director.Engine = sportEngine; Console.WriteLine("Crear el manual:"); director.CrearManual(); Console.WriteLine(manualBuilder.GetResult().ListParts()); Console.ReadKey(); }
private void _args_PreParse(object?sender, PreParseEventArgs e) { var a = _args !; this.OnParseArguments?.Invoke(a, e); if (e.SubCommand == "help") { var man = new ManualBuilder(a); man.BuildFull(this.CommandUsages ?? Array.Empty <string>()); _man = man.ToString(); } }
public static void BuildManual() { ManualBuilder m = new ManualBuilder(); m.LoadTemplates(HelpTools.Configuration.Parms.template_xml); File.WriteAllText(HelpTools.Configuration.Parms.projectname + ".tex", m.GenerateManual()); m.CreatePDFfromLatex(HelpTools.Configuration.Parms.projectname + ".tex"); File.Copy( HelpTools.Configuration.Parms.projectname + ".pdf", HelpTools.Configuration.Parms.output_path_manual + @"\" + HelpTools.Configuration.Parms.projectname + ".pdf", true); }
public void ParseTest() { var conv = CLConvFactory.Create(); conv.AddType <SwitchA>(); conv.AddType <SwitchB>(); conv.AddType <SwitchC>(); var help = new ManualBuilder(conv); help.Build(); Assert.AreEqual( Resources.CL_ManualBuilder_Result.Replace("\r\n", "\n").Replace("\n\r", "\n").Replace('\r', '\n'), help.ToString().Replace("\r\n", "\n").Replace("\n\r", "\n").Replace('\r', '\n') ); }
public void MakeSport() { CarBuilder carBuilder = new CarBuilder(); ManualBuilder manualBuilder = new ManualBuilder(); Director director = new Director(); director.makeSportCar(carBuilder); director.makeSportCar(manualBuilder); SportCar = carBuilder.GetCar(); SportCarManual = manualBuilder.GetManual(); director.makeSimpleCar(carBuilder); director.makeSimpleCar(manualBuilder); SimpleCar = carBuilder.GetCar(); SimpleCarManual = manualBuilder.GetManual(); }
static void Main(string[] args) { var director = new Director(); var builder = new CarBuilder(); var ManualBuilder = new ManualBuilder(); director.Builder = builder; director.buildFullFeaturedProduct(); Console.WriteLine(builder.GetProduct().ListParts()); director.Builder = ManualBuilder; director.buildFullFeaturedProduct(); Console.WriteLine(ManualBuilder.GetManual().ListManual()); Console.ReadLine(); }
private void BackgroundMakeManual(object sender, DoWorkEventArgs doWorkEventArgs) { tw = new StringWriter(); Console.SetOut(tw); Data.LoadContentXml(Configuration.Parms.content_xml); Data.LoadManualStructure(Configuration.Parms.structure_xml); ManualBuilder m = new ManualBuilder(); m.LoadTemplates(HelpTools.Configuration.Parms.template_xml); File.WriteAllText(HelpTools.Configuration.Parms.projectname + ".tex", m.GenerateManual()); m.CreatePDFfromLatex(HelpTools.Configuration.Parms.projectname + ".tex"); File.Copy( HelpTools.Configuration.Parms.projectname + ".pdf", HelpTools.Configuration.Parms.output_path_manual + @"\" + HelpTools.Configuration.Parms.projectname + ".pdf", true); }
public void BuildBus() { Director Director = new Director(); // Construimos Bus CarBuilder carBuilder = new CarBuilder(); Director.SetBuilder(carBuilder); Director.BuildBus(); Car Car = carBuilder.GetCar(); // Construimos el manual del Bus ManualBuilder manualBuilder = new ManualBuilder(); Director.SetBuilder(manualBuilder); Director.BuildBus(); Manual Manual = manualBuilder.GetManual(); Assert.AreEqual(Car.Engine, "bus"); Assert.AreEqual(Manual.EngineDescription, "Engine Description: bus"); }