Exemplo n.º 1
0
        public override bool Execute(string[] args)
        {
            if (args.Length != 4)
            {
                Console.LogError("Incorrect number of arguments!");
                return(false);
            }

            Sections id;

            try
            {
                id = (Sections)Enum.Parse(typeof(Sections), args[0], true);
            }
            catch
            {
                Console.LogError("Invalid section");
                return(false);
            }


            bool CheckColor(out int colorLocal, string colorstring, string colorName)
            {
                if (!int.TryParse(colorstring, out colorLocal))
                {
                    Console.LogError($"Color value {colorName} is invalid!");
                    return(false);
                }

                if (colorLocal < 0 || colorLocal > 255)
                {
                    Console.LogError("Color Values must be in the range 0 to 255!");
                }

                return(true);
            }

            if (!CheckColor(out var red, args[1], "red"))