Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2924_DotNetCoreMigration/HeuristicLab.ConsoleApplications/ConsoleInspector.cs @ 17504

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

#2924:

  • renamed HeuristicLab.DynamicAssemblyTestApp to HeuristicLab.ConsoleApplications
    • incl. Namespace and plugin name
  • renamed InspectApplication to ConsoleInspector
File size: 1.4 KB
Line 
1using System;
2using HEAL.Attic;
3using HeuristicLab.Common;
4using HeuristicLab.Core;
5using HeuristicLab.Optimization;
6using HeuristicLab.PluginInfrastructure;
7
8namespace HeuristicLab.ConsoleApplications {
9  [StorableType("61621E70-8A67-43A2-8EB2-233FC01E493B")]
10  [Application("CLIInspect", "")]
11  public class ConsoleInspector : ApplicationBase {
12    [Storable]
13    public UniPath InputFilePath { get; set; }
14
15    public ConsoleInspector() { }
16
17    public ConsoleInspector(UniPath inputFilePath) {
18      InputFilePath = inputFilePath;
19    }
20
21    public override void Run(ICommandLineArgument[] args) {
22      ContentManager.Initialize(new PersistenceContentManager());
23      IStorableContent content = ContentManager.Load(InputFilePath.ToString());
24      IOptimizer optimizer = content as IOptimizer;
25      if (content != null) {
26        Console.WriteLine($"Name: {optimizer.Name}");
27        Console.WriteLine($"Description: {optimizer.Description}");
28        Console.WriteLine($"Run count: {optimizer.Runs.Count}");
29        Console.WriteLine("\nRESULT(S):");
30        int i = 1;
31        foreach (var run in optimizer.Runs) {
32          Console.WriteLine($"{"-------------------------------- RUN",35} {$"{i++:D3}" + " --------------------------------",-35}");
33          foreach (var res in run.Results) {
34            Console.WriteLine($"{res.Key,35} : {res.Value,-35}");
35          }
36        }
37      }
38    }
39  }
40}
Note: See TracBrowser for help on using the repository browser.