Exemplo n.º 1
0
    public override void Execute(IEnumerable <String> arguments)
    {
        if (!arguments.Any())
        {
            base.Execute(arguments);
            return;
        }

        if (!Int32.TryParse(arguments.First(), out Int32 height))
        {
            Writer.WriteLine($"Pyramid height of \"{arguments.First()}\" must be an integer");
            return;
        }


        IEnumerable <String> pyramidBlockArguments = arguments.Skip(1);

        if (!pyramidBlockArguments.Any())
        {
            Writer.WriteLine("Pyramid block not supplied.");
            return;
        }

        String pyramidBlock = String.Join(' ', pyramidBlockArguments);

        var pyramid = PyramidBuilder.Get(pyramidBlock, height);

        foreach (var line in pyramid)
        {
            TwitchClientManager.SpoolMessage(line);
        }
    }