Skip to content

Releases: MonsterCreator/ConsoleAddonLibrary

ConsoleAdditionLibrary

01 Aug 09:43
5b42bdb

Choose a tag to compare

ConsoleAdditionLibrary (v 1.0)

Console Addition Library is expands your capabilities in writing beautiful console commands with clear, concise and easily manageable code.

ConsoleLogs class contains methods that allow you to:
- Output messages of a certain color to the console.
- Output messages character by character at the specified speed.

ConsoleInput class contains methods that allow you to:
- Get the necessary data from the user (string, int, double or bool) with incorrect input processing. By default, the methods of this class will require the user to enter the correct input until he does so.

ConsoleMenu class allows you to create simple menus with the ability to navigate with arrows or W/S.

Sample code for creating a simple menu

private static void Main()
    {
        ConsoleMenu consoleMenu = new ConsoleMenu();
        consoleMenu._menuName = "Menu1";
        consoleMenu.AddMenuElement(new MenuElement("Sum command",() => Sum()));
        consoleMenu.AddMenuElement(new MenuElement("Difference command", () => Difference()));
        consoleMenu.AddMenuElement(new MenuElement("Multiply command", () => Multiply()));
        consoleMenu.ShowMenu();
    }

An example of the implementation of one of the transmitted methods, which will gradually output a yellow (system) message with the requirement to enter a number, after which it will perform a simple addition operation and output the result to the console

private static void Sum()
    {
        int x = 0;
        x = ConsoleInput.GetIntValue(() => ConsoleLogs.SystemLog(() => ConsoleLogs.GradualPrinting("enter first value", PrintingSpeed.normal)));
        int y = 0;
        y = ConsoleInput.GetIntValue(() => ConsoleLogs.SystemLog(() => ConsoleLogs.GradualPrinting("enter second value", PrintingSpeed.normal)));
        ConsoleLogs.SystemLog((x + y).ToString());
        Console.ReadKey();
    }

These methods are designed so that you can combine different functions to achieve the desired result.