Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/17/19 10:40:41 (5 years ago)
Author:
dpiringe
Message:

#2924:

  • some changes in CLIApplication.cs to reduce unnecessary allocation of string objects
  • renamed AppTest to ConsoleOptimizer and fixed race condition
  • replaced enum RunnerJob with class RunnerMessage for more control of saved data
  • changed usage of BinaryFormatter with HEAL.Attic, following types are now Storable:
    • ConsoleOptimizer
    • InspectApplication
    • ApplicationBase
    • ApplicationRunner
    • AssemblyInfo
    • Runner
    • UniPath
    • RunnerMessage
  • switched QuietMode from ApplicationRunner to IRunner
  • DockerRunnerHost can now automatically build docker images for linux and windows containers (also identifies which container type is active) -> removes the condition to have the image preinstalled
    • to achieve this, there are two new folders DockerLinuxBuild and DockerWindowsBuild included in build output, which include Dockerfiles to build images for linux and windows container
  • added NuGet package System.CodeDom to project HeuristicLab.Scripting-3.3
  • added method Send(RunnerMessage) to IRunnerHost and transferred methods Pause and Resume to IRunner
  • added internal reference of RunnerHost in Runner
  • added abstract method SendMessage(RunnerMessage) in RunnerHost which gets called from method Send(RunnerMessage)
  • because of a Google.Protobuf "bug", RunnerMessages cannot get serialized/deserialized directly on stream -> workaround with a byte array, which gets written and read
    • additionally, the length of the array gets sent first (length as integer -> 4 bytes)
    • static method in RunnerMessage to read a message from a stream
    • the method SendMessage(RunnerMessage) in RunnerHost implements this functionality
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2924_DotNetCoreMigration/HeuristicLab.CommandLineInterface/CLIApplication.cs

    r16985 r17013  
    5151          SetOption(cmdData, option, (i + 1 < args.Length) ? args[++i] : "");
    5252        // else check if arg is valid command, then jump to next command
    53         else if (IsValidCommand(args[i], cmdData, out CommandData next)) {         
     53        else if (IsValidCommand(args[i], cmdData, out CommandData next)) {
    5454          CheckRequirements(cmdData);
    5555          valueIndex = 0; // reset value index for new command
     
    163163    /// Returns true when the given argument can be identified as help option (--help).
    164164    /// </summary>
    165     private static bool IsHelpRequest(string arg) => arg.ToLower().Equals("--help");
     165    private static bool IsHelpRequest(string arg) => arg.Equals("--help", StringComparison.InvariantCultureIgnoreCase);
    166166
    167167    /// <summary>
     
    185185    private static bool IsValidCommand(string arg, CommandData cmdData, out CommandData next) {
    186186      foreach (var cmd in cmdData.Commands) {
    187         if (arg.ToLower().Equals(cmd.Identifier.ToLower())) {
     187        if (cmd.Identifier.Equals(arg, StringComparison.InvariantCultureIgnoreCase)) {
    188188          next = cmd;
    189189          return true;
     
    213213    /// </summary>
    214214    private static ICommand GetInstance(CommandData cmdData) {
    215       if (cmdData.Instance == null) 
     215      if (cmdData.Instance == null)
    216216        cmdData.Instance = (ICommand)Activator.CreateInstance(cmdData.CommandType);
    217217      return cmdData.Instance;
     
    226226          IList list = (IList)CreateGenericType(typeof(List<>), targetType);
    227227          string[] elements = nextArg.Split(',');
    228           foreach(var elem in elements) list.Add(ParseString(elem, targetType));
     228          foreach (var elem in elements) list.Add(ParseString(elem, targetType));
    229229          property.SetValue(GetInstance(cmdData), list);
    230230        } else property.SetValue(GetInstance(cmdData), ParseString(nextArg, property.PropertyType));
     
    318318    /// Valid = it implements ICommand and has a parameterless constructor.
    319319    /// </summary>
    320     private static bool IsInstancableCommand(Type type) => 
    321       type.GetInterface(nameof(ICommand)) != null && 
    322       !type.IsAbstract && 
    323       !type.IsInterface && 
     320    private static bool IsInstancableCommand(Type type) =>
     321      type.GetInterface(nameof(ICommand)) != null &&
     322      !type.IsAbstract &&
     323      !type.IsInterface &&
    324324      type.GetConstructors().Any(info => info.GetParameters().Length == 0);
    325325
Note: See TracChangeset for help on using the changeset viewer.