https://github.com/lexz-08/cslhelper
Makes creating, destroying, and and printing to a console window easier, with support for virtual terminal sequences and basic text colors.
https://github.com/lexz-08/cslhelper
console console-window cpp csharp pinvoke windows
Last synced: 2 months ago
JSON representation
Makes creating, destroying, and and printing to a console window easier, with support for virtual terminal sequences and basic text colors.
- Host: GitHub
- URL: https://github.com/lexz-08/cslhelper
- Owner: Lexz-08
- Created: 2024-07-26T20:27:17.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-07-26T21:00:07.000Z (almost 2 years ago)
- Last Synced: 2025-01-07T14:25:09.834Z (over 1 year ago)
- Topics: console, console-window, cpp, csharp, pinvoke, windows
- Language: C#
- Homepage: https://github.com/Lexz-08/CSLHelper/
- Size: 69.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CSLHelper
## Description
Makes creating, destroying, and and printing to a console window easier, with support for virtual terminal sequences and basic text colors.
## How To Use
```csharp
using System.Windows.Forms;
using CSLHelper;
using Icon = System.Drawing.Icon;
namespace MyProgram
{
public partial class MyForm : Form
{
InitializeComponent();
// the 'IsVirtual' parameter defaults to 'false', so only put 'true' here if you want it enabled
Console.Inst.CreateConsole("My Console Window", true);
FormClosing += (_, __) => Console.Inst.DestroyConsole();
Console.Inst.SetIcon(Icon); // sets the window caption icon and the taskbar icon of the console window
Console.Inst.SetIconBig(Icon); // sets the taskbar icon of the console window
Console.Inst.SetIconSmall(Icon); // sets the window caption icon of the console window
// have following printed text be bright red and bright black (aka gray)
Console.Inst.SetTextColor(TextColor.BrightRed, BackColor.BrightBlack);
Console.Inst.WriteLine("Hello World!");
Console.Inst.WriteLine("Look at my cool text!");
// if you have 'IsVirtual' set to 'true' when calling 'Console.Inst.CreateConsole',
// you can use ANSI escape codes to format the text and do other manipulations with the console window
Console.Inst.Write("\x1b[H\x1b[2J"); // clear the console window
// the following command is similar to calling:
// Console.Inst.SetTextColor(TextColor.Red);
// Console.Inst.Write("This is red text");
Console.Inst.Write("\x1b[31mThis is red text"); // print red text
}
}
```
## Example

## FYI
In the release, there is a file called `cslpp.dll`, which you only need to download if it is not automatically being written to in the same directory as `CSLHelper.dll`.
## Download
[CSLHelper.dll](https://github.com/Lexz-08/CSLHelper/releases/latest/download/CSLHelper.dll)
[cslpp.dll](https://github.com/Lexz-08/CSLHelper/releases/latest/download/cslpp.dll) — if not in the same directory as `CSLHelper.dll` when program is run