RoeiBajayo.Infrastructure 1.0.1

dotnet add package RoeiBajayo.Infrastructure --version 1.0.1
                    
NuGet\Install-Package RoeiBajayo.Infrastructure -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="RoeiBajayo.Infrastructure" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RoeiBajayo.Infrastructure" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="RoeiBajayo.Infrastructure" />
                    
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 RoeiBajayo.Infrastructure --version 1.0.1
                    
#r "nuget: RoeiBajayo.Infrastructure, 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.
#:package RoeiBajayo.Infrastructure@1.0.1
                    
#: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=RoeiBajayo.Infrastructure&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=RoeiBajayo.Infrastructure&version=1.0.1
                    
Install as a Cake Tool

Infrastructure.Utils

A comprehensive .NET utility library providing common infrastructure components and extensions for modern C# applications.

Features

Infrastructure.Utils is organized into specialized modules:

๐Ÿ”ง Core Extensions

  • String Extensions - Powerful string manipulation, parsing, and transformation utilities
  • Collection Extensions - LINQ enhancements, async enumerable support, chunking, and more
  • DateTime Extensions - Date/time calculations, repeating patterns, Jewish dates, sunrise/sunset
  • Number Extensions - Mathematical operations and number formatting utilities

๐ŸŒ HTTP & Networking

  • RestClient - Enhanced HTTP client with built-in retry logic, cookie management, and fake user-agent support
  • WebSocket Client - Managed WebSocket connections with automatic reconnection
  • Multiple Request Types - Support for JSON, form data, multipart, and streaming requests

๐Ÿ’พ Data Storage & Caching

  • Persistent Collections - File-based collections with automatic JSON serialization
  • Key-Value Store - Simple persistent key-value storage
  • Scoped Cache - Request-scoped caching for web applications
  • Queues - Various queue implementations including throttling and accumulator queues

๐Ÿ”’ Security

  • Encryption - AES encryption/decryption utilities
  • Hashing - SHA and MD5 hashing helpers
  • Random - Cryptographically secure random generators
  • Signature Validation - Digital signature utilities

๐Ÿงต Threading & Async

  • Task Pool - Managed task execution with concurrency limits
  • Keyed Locker - Named locks for synchronization
  • Async Extensions - Utilities for working with async enumerables
  • Timeout Helpers - Task timeout management

๐Ÿ“ Text Processing

  • Frequency Analyzer - Text analysis with persistent storage
  • HTML Parser - Simple HTML tag parsing and manipulation
  • Hebrew Text - Hebrew language parsing and processing utilities
  • String Processor - Advanced string processing pipelines

๐Ÿ’‰ Dependency Injection

  • Auto-Registration - Automatic service registration using marker interfaces
  • Keyed Services - Support for keyed service registration
  • Lazy Resolution - Lazy dependency resolution support
  • Scoped Services - Enhanced scoped service patterns

๐Ÿ”Š Additional Features

  • Text-to-Speech - TTS integration with multiple language support
  • Telegram Integration - Send messages via Telegram bot API
  • Process Management - Enhanced process execution utilities
  • File Storage - Organized file storage patterns

Installation

Package Manager

Install-Package Infrastructure.Utils

.NET CLI

dotnet add package Infrastructure.Utils

PackageReference

<PackageReference Include="Infrastructure.Utils" Version="*" />

Quick Start

1. Register Services

using Infrastructure.Utils;

// In your Startup.cs or Program.cs
services.AddInfrastructureServices<YourAppMarker>();

2. HTTP Client Usage

using Infrastructure.Utils.Http.Models;

public class MyService
{
    private readonly IRestClient _client;

    public MyService(IRestClient client) => _client = client;

    public async Task<T> GetDataAsync<T>()
    {
        var options = new RestCallOptions
        {
            Url = "https://api.example.com/data",
            TimeoutMs = 5000
        };

        return await _client.GetJsonAsync<T>(options);
    }
}

3. Persistent Storage

using Infrastructure.Utils.Repositories.Persistent;

// Key-Value Store
var store = new KeyValueStore("./data/store.json");
await store.SetAsync("key", "value");
var value = await store.GetAsync<string>("key");

// Persistent Collection
var collection = new PersistentCollection<User>("./data/users.json");
await collection.AddAsync(new User { Name = "John" });
var users = await collection.GetAllAsync();

4. Security Utilities

using Infrastructure.Utils.Security;

// Encryption
string encrypted = AES.Encrypt("secret data", "password");
string decrypted = AES.Decrypt(encrypted, "password");

// Hashing
string hash = SHA.Hash256("data to hash");
bool isValid = SHA.Verify256("data", hash);

// Secure Random
int randomNumber = RandomExtensions.RandomNumber(1, 100);
string randomString = RandomExtensions.RandomString(16);

5. Dependency Injection with Marker Interfaces

// Define your services with marker interfaces

public class MyService : ISingletonService
{
    public Task<string> GetDataAsync() => Task.FromResult("data");
}

// Services are automatically registered!

6. Text Frequency Analysis

using Infrastructure.Utils.Text.Analyzers;

var analyzer = new FrequencyAnalyzer();
analyzer.AddText("sample text for analysis");
var frequencies = analyzer.GetFrequencies();

// With persistent storage
var persistentAnalyzer = new FrequencyAnalyzer(
    new JsonFrequencyAnalyzerStore("./data/frequencies.json")
);

Requirements

  • .NET 8.0 or higher
  • C# 12.0 or higher (uses latest language features)

Dependencies

  • MediatorCore (1.7.8) - Mediator pattern implementation
  • MemoryCore (1.6.3) - Memory caching
  • Microsoft.AspNetCore.Http.Abstractions (2.3.0) - HTTP abstractions
  • Microsoft.Extensions.Logging.Abstractions (8.0.0) - Logging abstractions
  • NAudio (2.2.1) - Audio processing for TTS
  • System.Text.Json (8.0.5) - JSON serialization

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

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

Support

For issues, questions, or contributions, please visit the GitHub repository.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  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

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.1 108 8/9/2025
1.0.0 186 8/4/2025