private void GenerateExtensions(ModuleBuilder target) { foreach (string extension in Extensions ?? new string[] {}) { string extCode = StaticCodeLoader.Load(StaticCodeLoader.ExtensionStaticCodeName(extension)); target.StaticCode.Add(extCode); } }
public ProjectBuilder GenerateProject(PapDocument document) { var inputClass = new ModuleBuilder(ModuleBuilder.ModuleTypes.Class, Visibilities.Public, InputClassName); var outputClass = new ModuleBuilder(ModuleBuilder.ModuleTypes.Class, Visibilities.Public, OutputClassName); var operationClass = new ModuleBuilder(ModuleBuilder.ModuleTypes.Class, Visibilities.Public, OperationClassName); var modules = new[] { inputClass, outputClass, operationClass }; // Eingangsparameter erzeugen GenerateProperties(inputClass, Visibilities.Public, document.Inputs); // Ausgangsparameter erzeugen GenerateProperties(outputClass, Visibilities.Public, document.Outputs); // Eingangs- und Ausgangsparameter in Berechnungsklasse erzeugen GenerateOperationalInputOutputProperties(operationClass); GenerateOperationalInputAccessors(operationClass, document.Inputs); GenerateOperationalOutputAccessors(operationClass, document.Outputs); // Interne Berechnungsparameter erzeugen GenerateProperties(operationClass, Visibilities.Private, document.Internals); // Konstanten erzeugen GenerateConstants(operationClass, document.Constants); // Berechnungs-Code erzeugen GenerateCalculationCode(operationClass, document); // Erweiterungen erzeugen GenerateExtensions(operationClass); // Statische Berechnungsmethoden in Berechnungsklasse erzeugen operationClass.StaticCode.Add(StaticCodeLoader.Load(StaticCodeLoader.PapOperationalClassStaticCodeName)); // Projekt erzeugen var project = new ProjectBuilder(); project.Sources.AddRange(modules.Select(m => new SourceBuilder(m) { Header = FileHeader, Namespace = Namespace })); return(project); }