SayehBanTools.Framework
1.2.5
dotnet add package SayehBanTools.Framework --version 1.2.5
NuGet\Install-Package SayehBanTools.Framework -Version 1.2.5
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="SayehBanTools.Framework" Version="1.2.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SayehBanTools.Framework" Version="1.2.5" />
<PackageReference Include="SayehBanTools.Framework" />
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.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SayehBanTools.Framework, 1.2.5"
#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.5
#: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.5
#tool nuget:?package=SayehBanTools.Framework&version=1.2.5
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<RabbitMQConnection, RabbitMQConnection>();
services.AddTransient<ISendMessages, RabbitMQMessageBus>();
ارسال پیام:
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 = "<div>Test</div>".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<string, object> { { "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<RabbitMqConnectionSettings>(Configuration.GetSection("RabbitMQ"));
services.AddTransient<RabbitMQConnection>();
services.AddTransient<ISendMessages, RabbitMQMessageBus>();
// Controller
public class MessageController : Controller
{
private readonly ISendMessages _messageBus;
public MessageController(ISendMessages messageBus)
{
_messageBus = messageBus;
}
[HttpPost]
public async Task<IActionResult> Send([FromBody] MessageDto message)
{
var baseMessage = new BaseMessage();
await _messageBus.SendMessageAsync(baseMessage, "notifications", "emails");
return Ok();
}
}
مثال مدیریت فایل
[HttpPost]
public async Task<IActionResult> 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.5 | 38 | 10/6/2026 |
| 1.2.4 | 40 | 10/6/2026 |
| 1.2.3 | 60 | 10/5/2026 |
| 1.2.2 | 49 | 10/4/2026 |
| 1.2.1 | 60 | 10/4/2026 |
| 1.2.0 | 43 | 10/3/2026 |
| 1.1.9 | 55 | 10/3/2026 |
| 1.1.8 | 56 | 10/3/2026 |
| 1.1.7 | 50 | 10/1/2026 |
| 1.1.6 | 49 | 10/1/2026 |
| 1.1.5 | 89 | 9/28/2026 |
| 1.1.4 | 86 | 9/28/2026 |
| 1.1.3 | 85 | 9/27/2026 |
| 1.1.2 | 84 | 9/27/2026 |
| 1.1.1 | 98 | 9/27/2026 |
| 1.1.0 | 95 | 9/27/2026 |
| 1.0.9 | 86 | 9/25/2026 |
| 1.0.8 | 84 | 9/25/2026 |
| 1.0.7 | 85 | 9/25/2026 |
| 1.0.6 | 93 | 9/25/2026 |
Loading failed