Orion.Foundations 0.21.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Orion.Foundations --version 0.21.0
                    
NuGet\Install-Package Orion.Foundations -Version 0.21.0
                    
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="Orion.Foundations" Version="0.21.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Orion.Foundations" Version="0.21.0" />
                    
Directory.Packages.props
<PackageReference Include="Orion.Foundations" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Orion.Foundations --version 0.21.0
                    
#r "nuget: Orion.Foundations, 0.21.0"
                    
#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.
#:package Orion.Foundations@0.21.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Orion.Foundations&version=0.21.0
                    
Install as a Cake Addin
#tool nuget:?package=Orion.Foundations&version=0.21.0
                    
Install as a Cake Tool

Orion.Foundations

NuGet Version License .NET

Core utilities and extensions for the Orion IRC Server project.

IRC is not dead, long live IRC!

About

Orion.Foundations provides essential utilities, extensions, and base classes for building IRC server components. This library forms the foundation of the Orion IRC Server ecosystem, offering common functionality that can be used across various Orion modules or in your own IRC-related projects.

Installation

dotnet add package Orion.Foundations

Or using the Package Manager Console:

Install-Package Orion.Foundations

Key Features

  • Base64 Extensions: Handle Base64 encoding and decoding
  • ByteUtils: Utilities for MD5 checksum operations
  • DateTime Extensions: Unix timestamp operations, epoch conversion
  • Encryption Extensions: String encryption/decryption
  • Environment Variable Replacement: Replace environment variables in strings with pattern {ENV_VAR}
  • Hash Utilities: Cryptographic operations, password handling, AES encryption
  • Host Mask Utilities: IRC host mask operations (nick!user@host patterns)
  • IP Address Extensions: IP address handling and conversion
  • JSON Utilities: Serialization and deserialization with AOT support
  • String Utilities: Various string manipulations, including case conversions
  • YAML Utilities: YAML serialization and deserialization
  • DNS Utilities: Hostname resolution helpers
  • Port Parser: Parse port ranges like "6660-6669,6697"
  • Resource Utils: Read embedded resources from assemblies
  • Observable Pattern: Helpers for working with Reactive Extensions
  • Object Pool: Generic object pooling

Examples

Base64 Operations

using Orion.Foundations.Extensions;

// Convert string to Base64
string encoded = "Hello, World!".ToBase64();

// Convert Base64 to string
string decoded = encoded.FromBase64();

// Check if a string is Base64
bool isBase64 = encoded.IsBase64String();

DateTime Operations

using Orion.Foundations.Extensions;

// Get Unix timestamp
long timestamp = DateTime.UtcNow.ToUnixTimestamp();

// Convert from Unix timestamp
DateTime date = timestamp.FromEpoch();

String Case Conversions

using Orion.Foundations.Extensions;

string text = "HelloWorld";

string snake = text.ToSnakeCase();     // "hello_world"
string camel = text.ToCamelCase();     // "helloWorld"
string pascal = text.ToPascalCase();   // "HelloWorld"
string kebab = text.ToKebabCase();     // "hello-world"
string title = text.ToTitleCase();     // "Hello World"
string upper = text.ToSnakeCaseUpper(); // "HELLO_WORLD"

Environment Variable Replacement

using Orion.Foundations.Extensions;

string template = "The home directory is {HOME}";
string result = template.ReplaceEnvVariable();

Hash and Encryption

using Orion.Foundations.Utils;

// Create password hash
string hashedPassword = HashUtils.CreatePassword("myPassword");

// Verify password
bool isValid = HashUtils.VerifyPassword("myPassword", hashedPassword);

// Generate secure key
string key = HashUtils.GenerateBase64Key();

// AES encryption
byte[] encrypted = HashUtils.Encrypt("sensitive data", key.FromBase64ToByteArray());
string decrypted = HashUtils.Decrypt(encrypted, key.FromBase64ToByteArray());

Port Range Parsing

using Orion.Foundations.Extensions;

string portRange = "6660-6669,6697";
IEnumerable<int> ports = portRange.ToPorts();
// Returns: 6660, 6661, 6662, 6663, 6664, 6665, 6666, 6667, 6668, 6669, 6697

IP Address Handling

using Orion.Foundations.Extensions;

// Convert special patterns
var anyAddress = "*".ToIpAddress(); // Returns IPAddress.Any (0.0.0.0)
var ipv6Any = "::".ToIpAddress();   // Returns IPAddress.IPv6Any (::)

// Normal conversion
var loopback = "127.0.0.1".ToIpAddress();

DNS Resolution

using Orion.Foundations.Utils;

var result = await DnsUtils.TryResolveHostnameAsync("192.168.1.1");
if (result.Resolved)
{
    Console.WriteLine($"Hostname: {result.HostName}");
}

YAML Serialization

using Orion.Foundations.Extensions;

// Serialize to YAML
var config = new MyConfig();
string yaml = config.ToYaml();

// Deserialize from YAML
var loadedConfig = yaml.FromYaml<MyConfig>();

Object Pooling

using Orion.Foundations.Pool;

// Create a pool of reusable objects
var pool = new ObjectPool<MyDisposableClass>();

// Get an object from the pool
var obj = pool.Get();

// Use the object...

// Return it to the pool when done
pool.Return(obj);

Project Structure

  • Extensions/: Extension methods for various types
  • Utils/: Utility classes and helper methods
  • Types/: Enums and basic type definitions
  • Observable/: Helpers for working with Reactive Extensions
  • Pool/: Object pooling implementation

Dependencies

  • YamlDotNet: For YAML serialization and deserialization
  • Orion.Core.Server: Server-side core functionality
  • Orion.Irc.Core: IRC protocol implementation
  • Orion.Network.Core: Networking abstractions

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Orion.Foundations:

Package Downloads
Orion.Network.Core

Networking abstractions for Orion IRC Server

Orion.Network.Tcp

TCP implementation for Orion IRC Server networking

Orion.Core.Server.Web

Web API and HTTP interface for Orion IRC Server

Orion.Core.Server

Server-side core functionality for Orion IRC Server

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.30.1 281 5/15/2025
0.30.0 246 5/13/2025
0.29.0 256 5/12/2025
0.28.4 228 5/12/2025
0.28.3 232 5/12/2025
0.28.2 244 5/12/2025
0.28.1 158 5/11/2025
0.28.0 87 5/10/2025
0.27.1 181 5/8/2025
0.27.0 158 5/8/2025
0.26.0 164 5/8/2025
0.25.2 154 5/8/2025
0.25.1 151 5/8/2025
0.25.0 173 5/8/2025
0.24.0 161 5/6/2025
0.23.0 160 5/6/2025
0.22.3 163 5/6/2025
0.22.2 163 5/5/2025
0.22.0 126 5/2/2025
0.21.0 124 5/2/2025
0.20.0 133 5/2/2025
0.19.1 130 5/2/2025
0.19.0 159 5/1/2025
0.18.1 161 5/1/2025
0.18.0 164 4/30/2025
0.17.0 161 4/29/2025
0.16.0 183 4/29/2025
0.15.0 174 4/28/2025
0.14.3 186 4/28/2025
0.14.2 175 4/28/2025
0.14.1 170 4/28/2025
0.14.0 159 4/28/2025
0.13.0 170 4/28/2025
0.12.3 170 4/28/2025
0.12.2 174 4/28/2025
0.12.1 172 4/28/2025
0.12.0 166 4/28/2025
0.11.1 166 4/28/2025
0.11.0 168 4/28/2025
0.10.0 167 4/28/2025
0.9.0 167 4/23/2025
0.8.0 167 4/23/2025
0.7.0 178 4/22/2025
0.6.1 160 4/22/2025
0.6.0 180 4/20/2025
0.5.0 186 4/20/2025
0.4.0 178 4/20/2025
0.3.0 109 4/19/2025
0.2.0 157 4/18/2025
0.1.10 197 4/18/2025
0.1.9 185 4/18/2025
0.1.8 192 4/18/2025
0.1.7 169 4/18/2025
0.1.6 175 4/18/2025
0.1.5 180 4/18/2025
0.1.4 182 4/18/2025
0.1.3 198 4/17/2025
0.1.2 209 4/17/2025