private IList <Shape> ParseTagsToObjects(IList <string> tags) { IList <Shape> parsedShapes = new List <Shape>(); foreach (var tag in tags) { IList <string> tagArguments = TextProcessingUtils.SplitTokens(tag); IDictionary <string, string> shapeAttributes = TextProcessingUtils.SplitAttributes(tagArguments); if (ShapeMappings.TagToShapeTypeMap.TryGetValue(tagArguments[0], out ShapeType type)) { Shape parsed = _shapeFactory.CreateShape(type, shapeAttributes); parsedShapes.Add(parsed); } } return(parsedShapes); }
public void InvokeCommand(string commandLine) { IList <string> arguments = TextProcessingUtils.SplitTokens(commandLine); if (arguments.Count == 0) { _writer.WriteLine("No command entered!"); return; } if (_commandMap.TryGetValue(arguments[0], out ICommand mappedCommand)) { mappedCommand.Execute(arguments); } else { _writer.WriteLine("Command not supported!"); } }