Exemplo n.º 1
0
        public async Task <SimulationExport[]> ExportSimulationsIn(PKSimProject project, ExportRunOptions exportRunOptions)
        {
            var nameOfSimulationsToExport = (exportRunOptions.Simulations ?? Enumerable.Empty <string>()).ToList();

            if (!nameOfSimulationsToExport.Any())
            {
                nameOfSimulationsToExport.AddRange(project.All <Simulation>().AllNames());
            }

            var simulationExports = new List <SimulationExport>();

            //sequential for now
            foreach (var simulationName in nameOfSimulationsToExport)
            {
                var simulation = project.BuildingBlockByName <Simulation>(simulationName);
                if (simulation == null)
                {
                    _logger.AddWarning($"Simulation '{simulationName}' was not found in project '{project.Name}'", project.Name);
                    continue;
                }

                simulationExports.Add((await ExportSimulation(simulation, exportRunOptions, project)));
            }

            return(simulationExports.ToArray());
        }
Exemplo n.º 2
0
        private async Task exportSimulations(PKSimProject project, ExportRunOptions exportRunOptions)
        {
            var nameOfSimulationsToExport = (exportRunOptions.Simulations ?? Enumerable.Empty <string>()).ToList();

            if (!nameOfSimulationsToExport.Any())
            {
                nameOfSimulationsToExport.AddRange(project.All <Simulation>().AllNames());
            }

            //sequential for now
            foreach (var simulationName in nameOfSimulationsToExport)
            {
                var simulation = project.BuildingBlockByName <Simulation>(simulationName);
                if (simulation == null)
                {
                    _logger.AddWarning($"Simulation '{simulationName}' was not found in project '{project.Name}'");
                    continue;
                }

                await exportSimulation(simulation, exportRunOptions);
            }
        }
Exemplo n.º 3
0
        private InputMapping exportInput(PKSimProject project, QualifcationConfiguration configuration, Input input)
        {
            var buildingBlock = project.BuildingBlockByName(input.Name, input.Type);

            var inputsFolder      = configuration.InputsFolder;
            var projectName       = FileHelper.RemoveIllegalCharactersFrom(project.Name);
            var buildingBlockName = FileHelper.RemoveIllegalCharactersFrom(input.Name);
            var targetFolder      = Path.Combine(inputsFolder, projectName, input.Type.ToString());

            DirectoryHelper.CreateDirectory(targetFolder);

            var fileFullPath = Path.Combine(targetFolder, $"{buildingBlockName}{CoreConstants.Filter.MARKDOWN_EXTENSION}");

            // Use wait for now until we can support // run of input
            _markdownReporterTask.ExportToMarkdown(buildingBlock, fileFullPath, input.SectionLevel).Wait();
            _logger.AddDebug($"Input data for {input.Type} '{input.Name}' exported to '{fileFullPath}'", project.Name);

            return(new InputMapping
            {
                SectionId = input.SectionId,
                Path = relativePath(fileFullPath, configuration.OutputFolder)
            });
        }