public string RegisterHarvester(List <string> arguments) { try { var type = arguments[0]; Harvester harvester = HarvesterFactory.Get(type, arguments.Skip(1).ToList()); this.harvesters.Add(harvester); return($"Successfully registered {arguments[0]} Harvester - {arguments[1]}"); } catch (Exception e) { return(e.Message); } }
public string RegisterHarvester(List <string> arguments) { try { var type = arguments[0]; var id = arguments[1]; var harvesterFactory = new HarvesterFactory(); Harvester harvester = harvesterFactory.Get(arguments); harvesters.Add(id, harvester); return($"Successfully registered {type} Harvester - {id}"); } catch (ArgumentException ae) { return(ae.Message); } }
public string RegisterHarvester(List <string> arguments) { var msg = string.Empty; try { var type = arguments[0]; var id = arguments[1]; var harvester = harvesterFactory.Get(arguments); harvesters[id] = harvester; msg = $"Successfully registered {type} Harvester {id}"; } catch (Exception e) { msg = e.Message; } return(msg); }
public string RegisterHarvester(List <string> arguments) { try { if (arguments[0] == "Sonic") { harvesters.Add(HarvesterFactory.Get((int)HarvesterFactoryId.Sonic, arguments)); return($"Successfully registered {arguments[0]} Harvester - {arguments[1]}"); } else { harvesters.Add(HarvesterFactory.Get((int)HarvesterFactoryId.Hammer, arguments)); return($"Successfully registered {arguments[0]} Harvester - {arguments[1]}"); } } catch (Exception e) { return(e.Message); } }