/// <summary> /// Retreives configuration from command line arguments. /// </summary> /// <param name="arguments">Command line args.</param> /// <returns>Config from command line args.</returns> public static ComponentConfig GetConfigFromArgs(string[] arguments) { var config = new ComponentConfig(); for (var i = 0; i < arguments.Length; i++) { switch (arguments[i]) { case "-address": { try { config.ServerAddress = arguments[++i]; } catch (Exception) { throw; } break; } case "-port": { try { config.ServerPort = arguments[++i]; } catch (Exception) { throw; } break; } case "-logAll": { config.LogAllInfo = true; break; } default: { Console.WriteLine("Unexpected argument {0}, ignored.", arguments[i]); break; } } } return config; }
/// <summary> /// /// </summary> /// <param name="config">Server address and port.</param> /// <param name="type">Component type.</param> protected RegisteredComponent(ComponentConfig config, string type) : base(config, type) { }
/// <summary> /// /// </summary> /// <param name="config">Server info from App.config and arguments.</param> public TaskManager(ComponentConfig config) : base(config, "TaskManager") { }
/// <summary> /// /// </summary> /// <param name="config">Config instance containing server info.</param> /// <param name="type">Type of component</param> protected Component(ComponentConfig config, string type) { ServerInfo = new ServerInfo(config.ServerPort, config.ServerAddress); Type = type; LogAllInfo = config.LogAllInfo; }
/// <summary> /// /// </summary> /// <param name="componentConfig">Server info from App.config and arguments.</param> public ComputationalClient(ComponentConfig componentConfig) : base(componentConfig, "ComputationalClient") { }
/// <summary> /// /// </summary> /// <param name="config">Component config.</param> /// <param name="type">Type of component.</param> protected ComputingComponent(ComponentConfig config, string type) : base(config, type) { }
/// <summary> /// /// </summary> /// <param name="componentConfig">Server info from App.config and arguments.</param> public ComputationalNode(ComponentConfig componentConfig) : base(componentConfig, "ComputationalNode") { }