SayehBanTools.Framework
1.2.4
dotnet add package SayehBanTools.Framework --version 1.2.4
NuGet\Install-Package SayehBanTools.Framework -Version 1.2.4
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.
For projects that support PackageReference, copy this XML node into the project file to reference the package.
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 SayehBanTools.Framework --version 1.2.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SayehBanTools.Framework, 1.2.4"
#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 SayehBanTools.Framework@1.2.4
#: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=SayehBanTools.Framework&version=1.2.4
#tool nuget:?package=SayehBanTools.Framework&version=1.2.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SayehBanTools - راهنمای استفاده
یک کتابخانه چندمنظوره برای توسعهدهندگان داتنت با قابلیتهای متنوع
فهرست مطالب
نصب
برای نصب کتابخانه از NuGet استفاده کنید:
dotnet add package SayehBanTools
یا در Visual Studio از طریق Package Manager Console:
Install-Package SayehBanTools
کلاسها و قابلیتها
IPAccess
بررسی محدوده IP:
bool isInRange = IPAccess.IsInRange("192.168.1.5", "192.168.1.1", "192.168.1.10");
// true اگر IP در محدوده باشد
Calculator
انجام محاسبات ریاضی:
// جمع
double sum = Calculator.Add(5, 10, 15); // 30
// ضرب
double product = Calculator.Multiply(2, 3, 4); // 24
// تخفیف
decimal discounted = Calculator.Discount(1000, 20); // 800
// مالیات
decimal taxed = Calculator.Taxation(1000, 9); // 1090
RabbitMQ
پیکربندی سرویسها:
services.AddTransient();
services.AddTransient();
ارسال پیام:
var message = new BaseMessage();
await _messageBus.SendMessageAsync(message, "exchange_name", "queue_name");
مدیریت فایلها
var fileManager = new ManageFiles();
// آپلود فایل
string uploadedPath = await fileManager.UploadFileAsync("/uploads", file);
// حذف فایل
fileManager.DeleteFileServer("/uploads/file.txt");
تبدیل اعداد
// عدد به حروف
string words = ConvertNumToString.convert("123456789");
// "صد و بیست و سه میلیون و چهارصد و پنجاه و شش هزار و هفتصد و هشتاد و نه"
// عدد به رشته فارسی
string persianNumber = "123456".En2Fa(); // "۱۲۳۴۵۶"
مدیریت رشتهها
// تبدیل اعداد انگلیسی به فارسی
string persianNum = "123".En2Fa(); // "۱۲۳"
// تبدیل اعداد فارسی به انگلیسی
string englishNum = "۱۲۳".Fa2En(); // "123"
// حذف تگهای HTML
string cleanHtml = "Test".HtmlTags(); // "Test"
رمزنگاری
// رمزنگاری
string encrypted = await StringEncryptor.EncryptAsync("text", "initVector", "passPhrase");
// رمزگشایی
string decrypted = await StringEncryptor.DecryptAsync(encrypted, "initVector", "passPhrase");
تولید مقادیر
// کد ملی معتبر
string nationalCode = NationalCode.GenerateRandom();
// کد تصادفی 16 رقمی
string randomValue = GenerateValues.Generate16ValueRandome();
ارسال پیامک
// ارسال پیامک پترن
var data = new Dictionary { { "code", "12345" } };
var result = await SMS_System.SendPatternAsync(apiLink, apiKey, data, "pattern_code", "sender", "09123456789", null);
// بررسی اعتبار
var credit = await SMS_System.GetCreditAsync(apiLink, apiKey);
مدیریت تاریخ
// تبدیل میلادی به شمسی
string shamsiDate = ConvertDateTime.MiladiToShamsi(DateTime.Now);
// تبدیل شمسی به میلادی
DateTime miladiDate = ConvertDateTime.ShamsiToMiladi("1402/05/15");
ترجمه
var translator = new TranslateTexts(new HttpClient());
var request = new TranslationRequest
{
OriginalText = "Hello",
InputLanguage = "en",
OutputLanguage = "fa"
};
var response = await translator.TranslateTextAsync(request);
// response.Translations[0] = "سلام"
صفحهبندی
var query = dbContext.Products.AsQueryable();
var pager = new Pager(totalItems: 100, currentPage: 2, pageSize: 10);
var pagedResults = query.PagedResult(pager.CurrentPage, pager.PageSize, out int totalCount);
مثالهای کد
مثال کامل RabbitMQ
// Startup.cs
services.Configure(Configuration.GetSection("RabbitMQ"));
services.AddTransient();
services.AddTransient();
// Controller
public class MessageController : Controller
{
private readonly ISendMessages _messageBus;
public MessageController(ISendMessages messageBus)
{
_messageBus = messageBus;
}
[HttpPost]
public async Task Send([FromBody] MessageDto message)
{
var baseMessage = new BaseMessage();
await _messageBus.SendMessageAsync(baseMessage, "notifications", "emails");
return Ok();
}
}
مثال مدیریت فایل
[HttpPost]
public async Task Upload(IFormFile file)
{
var fileManager = new ManageFiles();
string path = await fileManager.UploadFileAsync("wwwroot/uploads", file);
return Ok(new { Path = path });
}
مشارکت
مشارکتهای شما استقبال میشود! برای مشارکت:
- ریپوی را Fork کنید
- شاخه جدید ایجاد کنید (
git checkout -b feature/AmazingFeature) - تغییرات را Commit کنید (
git commit -m 'Add some AmazingFeature') - Push به شاخه (
git push origin feature/AmazingFeature) - Pull Request باز کنید
مجوز
این پروژه تحت مجوز MIT منتشر شده است. برای اطلاعات بیشتر فایل LICENSE را مطالعه کنید.
📧 برای ارتباط: sdvp1991david@gmail.com
🌍 وبسایت: https://sayehban.ir
💻 مخزن کد: https://github.com/SayyehBan/SayehBanTools.Framework
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net48 is compatible. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.8
- Dapper (>= 2.1.89)
- Elastic.Clients.Elasticsearch (>= 9.5.3)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.13)
- Microsoft.Extensions.Options (>= 10.0.12)
- Microsoft.Office.Interop.Excel (>= 16.0.18925.20022)
- Newtonsoft.Json (>= 13.0.4)
- OllamaSharp (>= 5.5.0)
- RabbitMQ.Client (>= 7.2.2)
- RestSharp (>= 114.0.0)
- StackExchange.Redis (>= 3.3.1)
- System.IO.Abstractions (>= 22.3.0)
- System.Reactive.Windows.Forms (>= 7.0.0)
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.2.4 | 0 | 10/6/2026 |
| 1.2.3 | 53 | 10/5/2026 |
| 1.2.2 | 45 | 10/4/2026 |
| 1.2.1 | 58 | 10/4/2026 |
| 1.2.0 | 41 | 10/3/2026 |
| 1.1.9 | 50 | 10/3/2026 |
| 1.1.8 | 52 | 10/3/2026 |
| 1.1.7 | 46 | 10/1/2026 |
| 1.1.6 | 47 | 10/1/2026 |
| 1.1.5 | 89 | 9/28/2026 |
| 1.1.4 | 85 | 9/28/2026 |
| 1.1.3 | 84 | 9/27/2026 |
| 1.1.2 | 81 | 9/27/2026 |
| 1.1.1 | 96 | 9/27/2026 |
| 1.1.0 | 94 | 9/27/2026 |
| 1.0.9 | 84 | 9/25/2026 |
| 1.0.8 | 84 | 9/25/2026 |
| 1.0.7 | 85 | 9/25/2026 |
| 1.0.6 | 92 | 9/25/2026 |
| 1.0.5 | 89 | 9/24/2026 |
Loading failed