Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2924_DotNetCoreMigration/HeuristicLab.DynamicAssemblyTestApp/InspectApplication.cs @ 16998

Last change on this file since 16998 was 16998, checked in by dpiringe, 5 years ago

#2924:

  • in project HeuristicLab.CommandLineInterface changed output for options -> hidden options are not shown in the help box anymore
  • in project HeuristicLab.DynamicAssemblyTestApp:
    • added ApplicationAttributes
    • added full cancel/pause/resume support for class AppTest to test the same behaviour between main and child process
  • in project HeuristicLab:
    • changed auto generated Dockerfile -> only copies necessary projects -> speeds up the build process
    • in file HeuristicLab-3.3.csproj:
      • changed DockerDefaultTargetOS to Linux
      • removed reference HeuristicLab.DefinitionLanguage
      • added icon and manifest
    • deleted folder Properties with file launchSettings.json
    • changed the direct access to ApplicationTypes for OptimizeCommand and InspectCommand to new method IApplicationManager.GetInstances<T>(params object[] args)
  • added build script for docker image dockerImageBuild.ps1
File size: 1.4 KB
Line 
1using System;
2using HeuristicLab.Common;
3using HeuristicLab.Core;
4using HeuristicLab.Optimization;
5using HeuristicLab.PluginInfrastructure;
6
7namespace HeuristicLab.DynamicAssemblyTestApp {
8  [Serializable]
9  [Application("CLIInspect", "")]
10  public class InspectApplication : ApplicationBase {
11    public UniPath InputFilePath { get; set; }
12
13    public InspectApplication() { }
14
15    public InspectApplication(UniPath inputFilePath) {
16      InputFilePath = inputFilePath;
17    }
18
19    public override void Run(ICommandLineArgument[] args) {
20      ContentManager.Initialize(new PersistenceContentManager());
21      IStorableContent content = ContentManager.Load(InputFilePath.ToString());
22      IOptimizer optimizer = content as IOptimizer;
23      if (content != null) {
24        Console.WriteLine($"Name: {optimizer.Name}");
25        Console.WriteLine($"Description: {optimizer.Description}");
26        Console.WriteLine($"Run count: {optimizer.Runs.Count}");
27        Console.WriteLine("\nRESULT(S):");
28        int i = 1;
29        foreach (var run in optimizer.Runs) {
30          Console.WriteLine($"{"-------------------------------- RUN",35} {$"{i++:D3}" + " --------------------------------",-35}");
31          foreach (var res in run.Results) {
32            Console.WriteLine($"{res.Key,35} : {res.Value,-35}");
33          }
34        }
35      }
36    }
37  }
38}
Note: See TracBrowser for help on using the repository browser.