FyLib 2.4.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package FyLib --version 2.4.0
                    
NuGet\Install-Package FyLib -Version 2.4.0
                    
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="FyLib" Version="2.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FyLib" Version="2.4.0" />
                    
Directory.Packages.props
<PackageReference Include="FyLib" />
                    
Project file
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 FyLib --version 2.4.0
                    
#r "nuget: FyLib, 2.4.0"
                    
#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 FyLib@2.4.0
                    
#: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=FyLib&version=2.4.0
                    
Install as a Cake Addin
#tool nuget:?package=FyLib&version=2.4.0
                    
Install as a Cake Tool

🚀 FyLib - 现代化 C# 工具库

NuGet Version .NET License AOT Compatible

FyLib 是一个功能丰富、性能卓越的现代化 C# 工具库,专为 .NET 10.0 设计,充分利用了最新的 C# 语言特性,为开发者提供高效、易用的常用功能集合。

✨ 核心优势

🔥 采用最新技术栈

  • .NET 10.0 专属设计,充分利用最新性能优化
  • 扩展类型(Extension Types) 语法,提供更自然的 API 体验
  • AOT 兼容,支持原生编译,启动更快、内存占用更少
  • 可空引用类型,提供更安全的类型系统

极致性能优化

  • 使用 AsSpan() 和现代字符串操作,减少内存分配
  • HTTP 客户端连接池,提升网络请求性能
  • 字节池管理,优化内存使用
  • 零分配的哈希计算和字符串处理

🛠️ 全面功能覆盖

  • 10+ 核心模块,涵盖开发常见需求
  • 60+ 实用方法,开箱即用
  • 完善的类型扩展,让代码更简洁优雅
  • 企业级功能,满足复杂业务场景

🎯 功能特性

🔐 安全加密模块

// 支持多种哈希算法:MD5、SHA1、SHA256、SHA512、CRC32
string hash = "hello world".MD5;           // 直接属性访问
string sha256 = HashHelper.sha256("data"); // 工业级安全

🌐 现代 HTTP 客户端

// 链式调用,优雅简洁
var result = await "https://api.example.com"
    .ToQuickHttp()
    .SetTimeout(5000)
    .SetProxy("127.0.0.1", 8080)
    .AddHeader("Authorization", "Bearer token")
    .PostJsonAsync(data);

🚀 强大字符串扩展

// .NET 10.0 扩展类型语法,如同原生方法
string text = "  Hello World  ";
bool isNum = text.IsNumeric;        // 数值验证
bool isIp = "192.168.1.1".IsIp;     // IP格式验证
string clean = text.Filter;         // 过滤空白字符
byte[] bytes = "48656C6C6F".ToBytes(); // 十六进制转换

智能时间处理

// 丰富的时间戳处理功能
var now = TimeHelper.TimeStamp();                    // UTC时间戳
var millis = TimeHelper.TimeStampX();               // 毫秒时间戳
var tomorrow7AM = TimeHelper.GetTimestampAtSpecificTime(1, "07:00");
bool inRange = TimeHelper.IsTimeInRange("09:00-18:00");

📦 高效数据打包

// 类型安全的数据序列化
using var pack = new Pack();
pack.push(123);           // int
pack.push("hello");       // string  
pack.push<byte>(255);     // 泛型支持
var data = pack.Get();    // 获取字节数组

🔧 实用工具集合

// 网络工具
bool online = Other.Ping("google.com", 3000);
string mac = Other.GetRandMac();

// 文件操作
var fileInfo = PathHelper.GetFileInfo("/path/to/file");
var content = FileExtensions.ReadAllText("config.txt");

// 系统信息
var process = RemoteProcess.GetProcessById(1234);
var ipInfo = IPHelper.GetLocalIP();

📋 完整功能列表

模块 功能描述 亮点特性
🔐 HashHelper MD5/SHA/CRC32 等哈希计算 支持字符串和字节数组,性能优化
🌐 QuickHttp HTTP 客户端封装 连接池、Gzip、代理、链式调用
TimeHelper 时间戳和日期处理 UTC/本地时间转换、范围判断
📝 StringExtension 字符串扩展方法 .NET 10 语法、20+ 验证和转换方法
📦 Pack/UnPack 数据序列化 类型安全、高性能二进制打包
🔧 Other 系统和网络工具 Ping、MAC地址、IMEI生成
📁 FileExtensions 文件操作扩展 路径处理、文件读写
📋 IniHelper INI 配置文件 配置文件读写和管理
📊 IPHelper 网络IP工具 IP地址获取和验证
🖥️ API Windows API 封装 Kernel32、User32、ntdll 等

🚀 快速开始

安装

# NuGet 包管理器
Install-Package FyLib

# .NET CLI
dotnet add package FyLib

# PackageReference
<PackageReference Include="FyLib" Version="2.2.0" />

基础使用

using FyLib;
using FyLib.Http;

// 字符串处理
string data = "Hello123";
if (data.IsNumeric) 
{
    Console.WriteLine($"MD5: {data.MD5}");
}

// HTTP 请求
var response = await "https://httpbin.org/get"
    .ToQuickHttp()
    .SetTimeout(5000)
    .GetAsync();

// 时间处理
var timestamp = TimeHelper.TimeStamp();
var dateStr = Other.TimeStampToString(timestamp);

// 哈希计算
string hash = HashHelper.sha256("important data");

🎯 适用场景

  • Web API 开发 - HTTP 客户端和数据处理
  • 数据处理 - 字符串解析和格式验证
  • 系统工具 - 文件操作和系统信息获取
  • 网络编程 - TCP/UDP 数据包处理
  • 安全相关 - 数据加密和哈希验证
  • 配置管理 - INI 文件和参数处理
  • 性能敏感应用 - AOT 编译优化支持

⚙️ 系统要求

  • .NET 10.0 或更高版本
  • C# 13.0 语言特性支持
  • 支持 WindowsLinuxmacOS
  • AOT 原生编译兼容

🤝 贡献指南

我们欢迎社区贡献!请查看 贡献指南 了解如何参与项目开发。

📄 许可证

Copyright © 枫影傲然 2024 - MIT License

🔗 相关链接


⭐ 如果这个项目对你有帮助,请给个 Star 支持一下!

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on FyLib:

Package Downloads
FyLib.DuckSoft.ClientApi

DuckClient API 客户端 SDK,提供用户认证、版本管理、会话管理、支付集成、SignalR 实时通信等功能。开箱即用,自动加密签名,轻松对接 DuckClient SaaS 平台。

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.5.2 135 2/27/2026
2.5.1 142 2/27/2026 2.5.1 is deprecated because it is no longer maintained.
2.5.0 143 2/25/2026
2.4.0 296 12/15/2025
2.2.0 227 9/25/2025
2.1.0 311 9/25/2025 2.1.0 is deprecated because it has critical bugs.
2.0.0 305 8/7/2025
1.2.0 213 1/13/2025
1.1.9 206 1/11/2025
1.1.8 229 1/11/2025 1.1.8 is deprecated because it has critical bugs.
1.1.7 246 12/12/2024
1.1.6 209 12/12/2024
1.1.5 221 12/7/2024
1.1.4 234 8/27/2024
1.1.3 217 7/16/2024
1.1.1 238 5/5/2024
1.1.0 312 12/26/2023
Loading failed