![]() |
VOOZH | about |
dotnet add package ClearTools --version 3.0.9
NuGet\Install-Package ClearTools -Version 3.0.9
<PackageReference Include="ClearTools" Version="3.0.9" />
<PackageVersion Include="ClearTools" Version="3.0.9" />Directory.Packages.props
<PackageReference Include="ClearTools" />Project file
paket add ClearTools --version 3.0.9
#r "nuget: ClearTools, 3.0.9"
#:package ClearTools@3.0.9
#addin nuget:?package=ClearTools&version=3.0.9Install as a Cake Addin
#tool nuget:?package=ClearTools&version=3.0.9Install as a Cake Tool
A comprehensive .NET Standard 2.1 utility library providing robust, production-ready tools for common development tasks. ClearTools offers utilities for string manipulation, cryptography, image processing, Azure services integration, HTTP client operations, and much more.
👁 NuGet Version
👁 License: MIT
dotnet add package ClearTools
using ClearTools.Extensions;
using Clear.Tools;
// String extensions
string text = "Hello 123 World!";
int number = text.ToInt32(); // Extracts numbers: 123
string cleaned = StringUtility.StripSymbols(text); // Removes symbols, preserves spaces: "Hello 123 World"
// Image processing
var scaledImage = ImageUtility.ScaleImage(originalImage, 800, 600);
// Cryptography
string salt = Crypto.CreateSalt();
string hash = Crypto.EncodeSHA256("password", salt);
// OTP generation
var otpResult = OtpUtility.GenerateCode("user@example.com", 12345, TimeSpan.FromMinutes(5));
StringUtility)Comprehensive string manipulation and processing tools:
// URL and SEO-friendly string generation
string urlKey = StringUtility.GenerateUrlKey("My Blog Post Title!"); // "my-blog-post-title"
// HTML and symbol stripping
string cleanText = StringUtility.StripHTML("<p>Hello <b>World</b></p>"); // "Hello World"
string alphanumeric = StringUtility.StripSymbols("Hello @World! 123"); // "Hello World 123"
// Date-based unique identifiers
string dateCode = StringUtility.GetDateCode(); // File time-based code
string updateId = StringUtility.AddUpDate(); // Timestamp-based ID
// Tag generation
string tags = StringUtility.GenerateTags("tag1", "tag2", "tag3"); // "tag1,tag2,tag3"
ImageUtility)Advanced image manipulation capabilities:
// Image scaling with aspect ratio preservation
Image scaledImage = ImageUtility.ScaleImage(sourceImage, 800, 600, ImageSizePreference.Width);
// Image cropping and resizing
Image croppedImage = ImageUtility.CropImage(sourceBitmap, 300, 300);
Bitmap resizedImage = ImageUtility.ResizeImage(sourceImage, 400, 300);
// Format conversion
byte[] imageBytes = ImageUtility.ConvertBitmapToBytes(bitmap, ImageFormat.Jpeg);
string base64Image = ImageUtility.ConvertImageToBase64(image, ImageFormat.Png);
// High-quality JPEG saving
ImageUtility.SaveJpegToFile("output.jpg", image, quality: 85);
Encryption)string key = "MySecretEncryptionKeyThatIsLongEnough123"; // 32+ chars required
string encrypted = Encryption.Encrypt("sensitive data", key);
string decrypted = Encryption.Decrypt(encrypted, key);
Crypto)// Hashing algorithms
string salt = Crypto.CreateSalt(128);
string sha256Hash = Crypto.EncodeSHA256("password", salt);
string sha512Hash = Crypto.EncodeSHA512("password", salt);
string sha1Hash = Crypto.EncodeSHA1("password");
// Base64 encoding/decoding
string encoded = Crypto.EncodeBase64("text to encode");
string decoded = Crypto.DecodeBase64(encoded);
OtpUtility)// Generate OTP with custom expiry
var otpResult = OtpUtility.GenerateCode("user@example.com", 12345, TimeSpan.FromMinutes(5));
Console.WriteLine($"Code: {otpResult.Code}, Expires: {otpResult.ExpiryTime}");
// Validate OTP
bool isValid = OtpUtility.ValidateCode("user@example.com", 12345, "123456", otpResult.ExpiryTime);
BaseConverter)Convert numbers between different bases and formats:
// Convert from any base to decimal
long decimal = BaseConverter.ConvertToDecimal("1010", 2); // Binary to decimal: 10
long hexDecimal = BaseConverter.ConvertToDecimal("FF", 16); // Hex to decimal: 255
// Convert decimal to any base
string binary = BaseConverter.ConvertFromDecimal(10, 2); // "1010"
string hex = BaseConverter.ConvertFromDecimal(255, 16); // "FF"
// Convert to alphabetic representation
string alpha = BaseConverter.ConvertToAlpha(26); // "BA"
EditorJS)Parse and convert EditorJS content to HTML:
// Parse EditorJS JSON to HTML
string html = EditorJS.Parse(editorJsJsonString);
// Supports: headers, paragraphs, lists, images, embeds (YouTube, Vimeo)
StringExtensions)Powerful string manipulation extensions:
// Value toggling
string toggled = "active".Toggle("inactive"); // "inactive"
// Case-insensitive operations
bool contains = "Hello World".Search("WORLD"); // true
bool equals = "Hello".EqualsNoCase("HELLO"); // true
// Number and symbol extraction
string numbers = "abc123def456".ExtractNumbers(); // "123456"
string clean = "Hello;World*".StripSymbols(); // "HelloWorld" (removes specific symbols)
// Type conversions
int number = "abc123".ToInt32(); // 123
decimal price = "Price: $29.99".ToDecimal(); // 29.99
// CSV processing
List<string> items = "apple,banana,cherry".ToListFromCsv();
HashSet<string> uniqueItems = "apple,banana,apple".ToHashSetFromCsv();
DateTimeExtensions)Enhanced DateTime formatting:
DateTime now = DateTime.Now;
string dateStr = now.ToDateString(); // "15/Aug/2025"
string dateTimeStr = now.ToDateTimeString(); // "15/Aug/2025 14:30:15"
KeyVaultExtensions)Robust Azure Key Vault integration for configuration management:
// Define your settings class
public class AppSettings
{
public string DatabaseConnectionString { get; set; }
[KeyVaultKey("api-key")]
public string ApiKey { get; set; }
}
// For ASP.NET Web Applications
var builder = WebApplication.CreateBuilder(args);
builder.AddKeyVaultForWebApplication<AppSettings>(
keyVaultUri: "https://your-keyvault.vault.azure.net/",
out AppSettings settings
);
// For Azure Functions
hostBuilder.AddKeyVaultForAzureFunctions<AppSettings>(
keyVaultUri: "https://your-keyvault.vault.azure.net/",
out AppSettings functionSettings
);
AzureStorageManager)Azure Blob Storage operations:
string connectionString = "DefaultEndpointsProtocol=https;AccountName=...";
// Upload operations
AzureStorageManager.UploadToAzure(connectionString, "container", stream, "application/pdf", "file.pdf", "folder");
// Download operations
AzureStorageManager.DownloadFromAzure(connectionString, "container", fileInfo, "folder");
// Check folder existence
bool exists = AzureStorageManager.AzureFolderExists(connectionString, "container", "folder");
ServicesExtensions)Automatic service registration by interface:
// Register all services implementing IService
services.AddScopedServicesByInterface<IService>();
services.AddSingletonServicesByInterface<IRepository>();
services.AddTransientServicesByInterface<IValidator>();
ApiClient)Comprehensive HTTP client with built-in error handling and serialization:
// Initialize
var apiClient = new ApiClient(httpClient);
// GET with various options
var user = await apiClient.GetAsync<User>("https://api.example.com/users/1");
var userWithAuth = await apiClient.GetAsync<User>("https://api.example.com/users/1", bearerToken);
// POST operations
var response = await apiClient.PostAsync("https://api.example.com/users", newUser);
var createdUser = await apiClient.PostAsync<User, User>("https://api.example.com/users", newUser);
// reCAPTCHA validation
var captchaResult = await apiClient.ValidateGoogleCaptcharAsync(secretKey, response, remoteIp);
RequestValidationMiddleware)ASP.NET Core middleware for API key validation:
// Setup
services.AddRequestValidation("your_secret_api_key", skipForDevelopment: true);
app.UseRequestValidation();
// Client usage - include key in headers
client.DefaultRequestHeaders.Add("key", "your_secret_api_key");
ValidationCodeResult: OTP generation results with code and expiryCaptcherResponse: Google reCAPTCHA validation response# Via .NET CLI
dotnet add package ClearTools
# Via PackageReference
<PackageReference Include="ClearTools" Version="3.0.9" />
ClearTools targets .NET Standard 2.1 and includes:
public class ImageProcessor
{
public async Task<string> ProcessAndUploadImage(IFormFile file)
{
using var stream = file.OpenReadStream();
var image = Image.FromStream(stream);
// Process image
var scaledImage = ImageUtility.ScaleImage(image, 800, 600);
var imageBytes = ImageUtility.ConvertBitmapToBytes((Bitmap)scaledImage, ImageFormat.Jpeg);
// Generate unique filename
var fileName = StringUtility.GenerateFileName(file.FileName, "jpg");
// Upload to Azure
using var uploadStream = new MemoryStream(imageBytes);
AzureStorageManager.UploadToAzure(connectionString, "images", uploadStream, "image/jpeg", fileName, "uploads");
return fileName;
}
}
public class OtpService
{
private readonly int _secretKey = 123456;
public ValidationCodeResult GenerateOtp(string email)
{
return OtpUtility.GenerateCode(email, _secretKey, TimeSpan.FromMinutes(5));
}
public bool ValidateOtp(string email, string code, DateTime expiry)
{
return OtpUtility.ValidateCode(email, _secretKey, code, expiry);
}
}
For comprehensive documentation covering all methods and use cases, see:
✅ String Utilities: URL generation, HTML stripping, text processing
✅ Image Processing: Scaling, cropping, format conversion, quality optimization
✅ Cryptography: Hashing, encryption, salt generation, secure tokens
✅ OTP Management: Generation, validation, expiry handling
✅ Azure Integration: Key Vault, Blob Storage, managed identity support
✅ HTTP Client: RESTful API client with authentication and serialization
✅ Extensions: String, DateTime, Byte array, and service collection extensions
✅ Middleware: Request validation, API key authentication
✅ EditorJS: Content parsing and HTML conversion
✅ Base Conversion: Number base conversion utilities
✅ File Management: File I/O operations and utilities
We welcome contributions! Please see our for details.
This project is licensed under the MIT License - see the file for details.
ClearTools - Making .NET development clearer, one utility at a time. 🚀
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 netstandard2.1 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.5.1 | 719 | 3/20/2026 |
| 3.5.0 | 155 | 3/19/2026 |
| 3.4.1 | 227 | 3/1/2026 |
| 3.4.0 | 159 | 2/24/2026 |
| 3.3.5 | 419 | 1/10/2026 |
| 3.3.0 | 127 | 1/9/2026 |
| 3.2.0 | 252 | 12/22/2025 |
| 3.1.1 | 328 | 11/14/2025 |
| 3.1.0 | 325 | 11/13/2025 |
| 3.0.9 | 583 | 8/21/2025 |
| 3.0.7 | 708 | 7/3/2025 |
| 3.0.7-preview1 | 226 | 7/3/2025 |
| 3.0.6 | 271 | 6/30/2025 |
| 3.0.5 | 319 | 6/26/2025 |
| 3.0.5-preview1 | 374 | 6/10/2025 |
| 3.0.4 | 503 | 3/28/2025 |
| 3.0.2 | 272 | 2/20/2025 |
| 3.0.1 | 246 | 2/13/2025 |
| 3.0.0 | 290 | 12/19/2024 |
| 2.1.23-preview5 | 210 | 12/10/2024 |