public BotFramework(IBotFrameworkOutputHandler outputHandler, ArgumentsParser parsedArgs) { _outputHandler = outputHandler; if(outputHandler == null || parsedArgs == null) throw new ArgumentNullException("One or more arguments to framework is null", new Exception()); var numberOfBots = parsedArgs.NumBots; var simultaneousBots = parsedArgs.SimultaneousBots; var host = parsedArgs.Host; var port = parsedArgs.Port; if (numberOfBots > NUM_BOTS_MAX || simultaneousBots > NUM_BOTS_MAX || simultaneousBots > numberOfBots) throw new ArgumentException("Too many bots requested"); if (numberOfBots <= 0 || simultaneousBots <= 0) throw new ArgumentException("Not enough bots requested"); _numBots = numberOfBots; _host = host; _port = port; _botsList = new List<IBot>(numberOfBots); _doneSignal = new Semaphore(simultaneousBots, simultaneousBots); }
public BotFramework(IBotFrameworkOutputHandler outputHandler, ArgumentsParser parsedArgs) { _outputHandler = outputHandler; if (outputHandler == null || parsedArgs == null) { throw new ArgumentNullException("One or more arguments to framework is null", new Exception()); } var numberOfBots = parsedArgs.NumBots; var simultaneousBots = parsedArgs.SimultaneousBots; var host = parsedArgs.Host; var port = parsedArgs.Port; if (numberOfBots > NUM_BOTS_MAX || simultaneousBots > NUM_BOTS_MAX || simultaneousBots > numberOfBots) { throw new ArgumentException("Too many bots requested"); } if (numberOfBots <= 0 || simultaneousBots <= 0) { throw new ArgumentException("Not enough bots requested"); } _numBots = numberOfBots; _host = host; _port = port; _botsList = new List <IBot>(numberOfBots); _doneSignal = new Semaphore(simultaneousBots, simultaneousBots); }