RadLibrary

Codacy Badge CodeFactor NuGet

All-In-One library

Features

  • Customizable logger
    • Prints dictionaries and lists like in Python
  • Colorful console support
    • Custom colors (HEX string->Color class convert support through Colorizer)
    • ESC colors access through Font, Background & Foreground classes
    • Console wrapper for ease of use (RadConsole)
    • Colorful input
  • Configuration manager
    • Comments support
    • Scheme support
  • Formatters
    • Any types of Enumerables
    • Exception
    • String
    • Custom
  • Utilities
    • Dynamic console allocation for GUI apps
    • Only one app instance
    • Easy to use random (int, bool) + random item from collection

Getting started

Install RadLibrary in your project through NuGet package RadLibrary

If you're on .NET 5, you don't need to initialize anything, just write the code! Otherwise, call Utilities.Initialize() somewhere in Main()

Check Articles for more information!

Colorful console

Write line to the console

Pro tip: write using Console = RadLibrary.RadConsole.RadConsole; at usings and use Console class as always~

RadConsole.WriteLine("[#fffff]{CoolPrefix} [aaaff]Some colorful text");

RadConsole.WriteLine("[00ffcc]{CoolPrefix} [#ffff66]Some colorful text");

Sample image

Logging

Current method logger

var logger = LogManager.GetMethodLogger();

logger.Trace("Trace");
logger.Debug("Debug");
logger.Info("Info");
logger.Warn("Warn");
logger.Error("Error");

try
{
  int.Parse("sadasd");
}
catch (Exception e)
{
  logger.Fatal(e);
}

logger.Info(new List<string> { "Yes", "No", "Maybe" });
logger.Info("{\"song\":\"Song name\",\"artist\":\"Radolyn\",\"start\":0,\"end\":9999999999999,\"paused\":false}");

Sample image

Multilogger sample

var consoleLogger = LogManager.GetMethodLogger();
var fileLogger = LogManager.GetMethodLogger<FileLogger>();

var logger = LogManager.GetClassLogger<MultiLogger>(consoleLogger, fileLogger);

logger.Trace("Trace");
logger.Debug("Debug");
logger.Info("Info");
logger.Warn("Warn");
logger.Error("Error");

try
{
  int.Parse("sadasd");
}
catch (Exception e)
{
  logger.Fatal(e);
}

logger.Info(new List<string> { "Yes", "No", "Maybe" });
logger.Info("{\"song\":\"Song name\",\"artist\":\"Radolyn\",\"start\":0,\"end\":9999999999999,\"paused\":false}");

Sample image Sample image

Configuration Manager

Create configuration using FileManager

var logger = LogManager.GetMethodLogger();
var config = new IniManager("test.conf");

config["ip"] = "127.0.0.1";
config["autorun"] = true;
config["key"].SetValue('a');
config["url"] = "https://radolyn.com";

config.Save();
  • Improve this Doc
In This Article
Back to top Generated by DocFX