public bool Execute(string[] commandParams, WeaponsController weaponsController) { var commandName = commandParams[0]; switch (commandName) { case "Create": { weaponsController.CreateWeapon(commandParams.Skip(1).ToArray()); return(false); } case "Add": { var gemParams = commandParams[3]; var socketIndex = int.Parse(commandParams[2]); var weaponName = commandParams[1]; weaponsController.AddGem(gemParams, socketIndex, weaponName); return(false); } case "Remove": { var weaponName = commandParams[1]; var socketIndex = int.Parse(commandParams[2]); weaponsController.RemoveGem(socketIndex, weaponName); return(false); } case "Print": { var weaponName = commandParams[1]; weaponsController.PrintWeapon(weaponName); return(false); } case "END": { weaponsController.Print(); return(true); } default: throw new ArgumentException("Invalid Command Name!"); } }
public bool Execute(string[] commandParams, WeaponsController weaponsController) { var commandName = commandParams[0]; switch (commandName) { case "Create": { weaponsController.CreateWeapon(commandParams.Skip(1).ToArray()); return(false); } case "Add": { var gemParams = commandParams[3]; var socketIndex = int.Parse(commandParams[2]); var weaponName = commandParams[1]; weaponsController.AddGem(gemParams, socketIndex, weaponName); return(false); } case "Remove": { var weaponName = commandParams[1]; var socketIndex = int.Parse(commandParams[2]); weaponsController.RemoveGem(socketIndex, weaponName); return(false); } case "Print": { var weaponName = commandParams[1]; weaponsController.PrintWeapon(weaponName); return(false); } case "END": { return(true); } //case "Author": // { // Console.WriteLine($"Author: Pesho"); // return false; // } //case "Revision": // { // Console.WriteLine($"Revision: 3"); // return false; // } //case "Description": // { // Console.WriteLine($"Class description: Used for C# OOP Advanced Course - Enumerations and Attributes."); // return false; // } //case "Reviewers": // { // Console.WriteLine($"Reviewers: Pesho, Svetlio"); // return false; // } //default: // throw new ArgumentException("Invalid Command Name!"); // return true; } return(this.GetAttributeProperties(commandName)); }