SayehBanTools 1.7.4
dotnet add package SayehBanTools --version 1.7.4
NuGet\Install-Package SayehBanTools -Version 1.7.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.
<PackageReference Include="SayehBanTools" Version="1.7.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SayehBanTools" Version="1.7.4" />
<PackageReference Include="SayehBanTools" />
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 --version 1.7.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SayehBanTools, 1.7.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@1.7.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&version=1.7.4
#tool nuget:?package=SayehBanTools&version=1.7.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<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
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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.
-
net9.0
- Elastic.Clients.Elasticsearch (>= 9.1.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
- Microsoft.EntityFrameworkCore (>= 9.0.8)
- Microsoft.Extensions.Features (>= 9.0.8)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.8)
- Microsoft.Extensions.Options (>= 9.0.8)
- Newtonsoft.Json (>= 13.0.3)
- RabbitMQ.Client (>= 7.1.2)
- RestSharp (>= 112.1.0)
- StackExchange.Redis (>= 2.8.58)
- System.IO.Abstractions (>= 22.0.15)
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.7.4 | 120 | 8/9/2025 |
1.7.3 | 94 | 7/18/2025 |
1.7.2 | 98 | 7/11/2025 |
1.7.1 | 141 | 7/9/2025 |
1.7.0 | 143 | 7/8/2025 |
1.6.9 | 141 | 7/2/2025 |
1.6.8 | 146 | 6/29/2025 |
1.6.7 | 141 | 6/29/2025 |
1.6.6 | 147 | 6/29/2025 |
1.6.5 | 104 | 6/27/2025 |
1.6.4 | 142 | 6/26/2025 |
1.6.3 | 142 | 6/23/2025 |
1.6.2 | 144 | 6/23/2025 |
1.6.1 | 288 | 6/11/2025 |
1.6.0 | 286 | 6/11/2025 |
1.5.9 | 248 | 6/9/2025 |
1.5.8 | 112 | 6/6/2025 |
1.5.7 | 76 | 5/31/2025 |
1.5.6 | 75 | 5/31/2025 |
1.5.5 | 98 | 5/30/2025 |
1.5.4 | 156 | 5/29/2025 |
1.5.3 | 155 | 5/25/2025 |
1.5.2 | 154 | 5/21/2025 |
1.5.1 | 159 | 5/21/2025 |
1.5.0 | 155 | 5/19/2025 |
1.4.9 | 159 | 5/19/2025 |
1.4.8 | 156 | 5/19/2025 |
1.4.7 | 154 | 5/19/2025 |