Skip to content

LoveDoLove/CS_CommonUtilities

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License


Logo

CommonUtilities

A modular, production-ready C#/.NET utility library and toolkit for rapid development.
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Project Structure
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

CommonUtilities is a modular, production-ready C#/.NET utility library and toolkit designed to accelerate development for .NET 8+ projects. It contains a broad set of helpers, models, and utilities for common application needs (security, data, HTTP, scheduling, media, cloud integrations, and more). The codebase is organized for easy consumption as a project reference or compiled library.

This README was created from the project's template and repository contents.

(back to top)

Features

  • Security: AES, SHA256, signature and related helpers
  • Data: Conversion, formatting, JSON file utilities
  • HTTP: Basic and advanced HTTP helpers
  • System: App settings, caching, file/process utilities, logging helpers
  • Scheduler: Cron job helpers, scheduled services, SyncService base
  • Media: Image helpers, Dropbox/image helpers, QR code generation
  • Integrations: Stripe, Cloudflare captcha, Google AI, Google Drive, Google MFA
  • Mailer: SMTP/mail helpers
  • Utilities: Command helpers, enum helpers, IP info lookup

(back to top)

Built With

(back to top)

Getting Started

Use this project by referencing the CommonUtilities project in your solution or by building the library and consuming the DLL.

Prerequisites

Installation

  1. Clone the repository:
git clone https://github.com/LoveDoLove/CS_CommonUtilities.git
  1. Restore packages and build:
dotnet restore
dotnet build
  1. Add CommonUtilities\CommonUtilities.csproj as a project reference in your solution or copy the compiled DLL from bin/.

(back to top)

Configuration

Many helpers require configuration via appsettings.json (or appsettings.Development.json). Example configuration keys used in this repo:

{
  "Smtp": {
    /* mailer */
  },
  "CfCaptcha": {
    /* cloudflare captcha */
  },
  "IpInfo": {
    /* ipinfo token */
  },
  "Stripe": {
    /* api keys */
  }
}

See appsettings.json and appsettings.Development.json in the repo root for concrete examples.

(back to top)

Usage

Examples below show common usage patterns. Refer to source XML comments for full API details.

Basic security

using CommonUtilities.Utilities.Security;

string encrypted = AesUtilities.Encrypt("mydata", "password");
string hash = Sha256Utilities.ComputeHash("mydata");

Sending email

using CommonUtilities.Helpers.Mailer;
using Microsoft.Extensions.Configuration;

var config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
var smtpConfig = config.GetSection("Smtp").Get<Mailer.MailerConfig>();
var mailer = new Mailer.MailerHelper(smtpConfig);
await mailer.SendAsync("to@example.com", "Subject", "Body");

Stripe (example)

using CommonUtilities.Helpers.Stripe;

var cfg = new Stripe.StripeConfig { ApiKey = "sk_test_xxx" };
var stripe = new Stripe.StripeHelper(cfg);
// use stripe methods

(back to top)

Project Structure

Top-level folders and a short description (see repository for full details):

  • CommonUtilities/Helpers/ — helper classes grouped by feature (Mailer, Stripe, GoogleDrive, Security, Media, etc.)
  • CommonUtilities/Models/ — shared models and constants
  • CommonUtilities/Utilities/ — lower-level utilities (Data, Http, Security, System helpers)
  • CommonUtilities/Services/ — background services and SyncService base
  • appsettings.json / appsettings.Development.json — configuration samples

Use these namespaces in your projects to call the helpers directly.

(back to top)

Contributing

Contributions are welcome. To contribute:

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

Please follow standard .NET best practices and include unit tests where appropriate.

(back to top)

License

Distributed under the MIT License. See LICENSE for details.

(back to top)

Contact

LoveDoLove — GitHub

Project Link: https://github.com/LoveDoLove/CS_CommonUtilities

(back to top)

Acknowledgments

(back to top)