ImGajeedsEasyConsole 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package ImGajeedsEasyConsole --version 1.0.1                
NuGet\Install-Package ImGajeedsEasyConsole -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ImGajeedsEasyConsole" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ImGajeedsEasyConsole --version 1.0.1                
#r "nuget: ImGajeedsEasyConsole, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ImGajeedsEasyConsole as a Cake Addin
#addin nuget:?package=ImGajeedsEasyConsole&version=1.0.1

// Install ImGajeedsEasyConsole as a Cake Tool
#tool nuget:?package=ImGajeedsEasyConsole&version=1.0.1                

EasyConsole

ToDo:

- implement argon2 hashing for SecureString (Does not work yet)

Examples:

"Hello World" in color:
Console.WriteLine("Hello World", new Color(ConsoleColor.Green));
Password input:
var password = Console.ReadPassword("Password: ");
Yes / No Question:
var answer = Console.BoolQuestion("Would you like to continue?");
Console.WriteLine(answer);
Object Selection:
var options = new Options(new[]
{
    "Option 1",
    "Option 2",
    "Option 3"
});
var index = Console.SelectOption(options);
Console.WriteLine(index);
Form:
var lines = new[]
{
    "Firstname",
    "Lastname"
};
var values = Console.Form(lines);
     
Console.WriteLine(values[0]);
Console.WriteLine(values[1]);
Set Console Color:
Console.SetColor(new Color(ConsoleColor.Blue));
Console.WriteLine("This text should be blue");
Console.WriteLine("And this one too");

Documentation:

Color:

In the Color class you can define a fore- and or background color.
(Pretty self explaining)

var color = new Color(ConsoleColor.DarkBlue, ConsoleColor.DarkGray);

Note: You can use this Color in pretty much every other Console function.

Write:

With the Write function you can write text to the console and color it. This command will not make a new line in the console!

Console.Write("Text", color);
WriteLine:

This function is exactly the same as Write, except it does make a new line after it.

Console.Write("Text with new line", color)
ReadLine:

This function is like the one in System.Console. But here you can ask for something too.

var answer = Console.ReadLine();

//or

var answer = Console.ReadLine("Username: ", color);
ReadKey:

This one is completly like the one in System.Console.

var key = Console.ReadKey();
ReadPassword:

With this function you can ask for a Password that is returned as SecureString.

var pass = Console.ReadPassword();

//or

var pass = Console.ReadPassword("Password: ", color, passColor);
Yes / No Question (BoolQuestion):

With this function you can ask a yes/no question with a default value.
(yes = true, no = false)

var answer = Console.BoolQuestion("Would you like to continue?", def, color);
SelectOption:

With this function you can select from a string[] of options. Returned will be the index of the array. To select a option, move with the arrow keys and press enter.

var options = new[]
{
    "Option 1",
    "Option 2",
    "Option 3"
};
var index = Console.SelectOption(options);
Console.WriteLine(index);
Form:

With this function you can create a Form where users can input variables for multiple lines. To edit a field, select it with your arrow keys and and press enter. Now you can write.

var lines = new[]
{
    "Firstname",
    "Lastname"
};
var values = Console.Form(lines);
     
Console.WriteLine(values[0]);
Console.WriteLine(values[1]);
AwaitAnyKey:

This function waits for any key to press. You can enable or disable the message in the params.

Console.AwaitAnyKey();
AwaitEnter:

This function is like the AwaitAnyKey function, but it only waits for the enter key.

Console.AwaitEnter();
Clear:

With this function you can clear the whole console.

Console.WriteLine("Hello");
Console.WriteLine("World");
Console.Clear();
ClearLine:

With this function you can clear a specific line.

Console.WriteLine("Hello");
Console.WriteLine("World");
Console.ClearLine(0);
OverwriteLine:

With this function you can overwrite any line in the console.

Console.WriteLine("Hello");
Console.WriteLine("World");
Console.OverwriteLine(0, "Overwritten");
GetColor:

With this function you can get the current console color.

var color = Console.GetColor();
SetColor:

With this function you can set the current console color.

Console.SetColor(color);
CursorTop:

Get and set the CursorTop.

Console.CursorTop(0);
var top = Console.CursorTop();
CursorLeft:

Like the CursorTop you can get and set its position.

Console.CursorLeft(0);
var left = Console.CursorLeft();
BufferWidth:

Width this function you can get the BufferWidth.

var width = Console.BufferWidth();
BufferWidth:

Width this function you can get the BufferHeight.

var height = Console.BufferHeight();

License

This project has a MIT License: license

Contact

If you have any question please write to me on discord because im not that often on github.

ImGajeed76#5617
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 427 7/27/2022
1.0.2 407 7/27/2022
1.0.1 428 7/21/2022
1.0.0 412 7/21/2022