/// <summary> /// Setup the options to configure a commander using configuration api from a json file. /// </summary> static void SetupCommanderOptions() { // Build the options and setup a commander. _config = new ConfigurationBuilder() .AddJsonFile(Directory.GetCurrentDirectory() + "/appsettings.json") .Build(); _options = new CommanderOptionsBuilder().Build(_config); }
/// <summary> /// Comander constructor. /// </summary> /// <param name="options"></param> public Commander(ICommanderOptions options) { //Private members initialization. _commandParser = new CommandParser(); //Setup the playground. Playground = new Playground() { Width = options.PlaygroundWidth, Height = options.PlaygroundHeight, AllowedBoundaries = options.AllowedBoundaries, CollisionsDetected = options.CollisionsDetected }; //Public properties initialization. MaxRobots = options.MaxRobots; StepSize = options.StepSize; RobotParking = new Dictionary <int, Robot>(); RobotCounter = 1; }