Hikari.Common 8.1.5

dotnet add package Hikari.Common --version 8.1.5
                    
NuGet\Install-Package Hikari.Common -Version 8.1.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="Hikari.Common" Version="8.1.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Hikari.Common" Version="8.1.5" />
                    
Directory.Packages.props
<PackageReference Include="Hikari.Common" />
                    
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 Hikari.Common --version 8.1.5
                    
#r "nuget: Hikari.Common, 8.1.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 Hikari.Common@8.1.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=Hikari.Common&version=8.1.5
                    
Install as a Cake Addin
#tool nuget:?package=Hikari.Common&version=8.1.5
                    
Install as a Cake Tool

Hikari.Common

LICENSE <img alt="dotnet-version" src="https://img.shields.io/badge/.net-%3E%3D8.0-blue.svg"></img> <img alt="csharp-version" src="https://img.shields.io/badge/C%23-latest-blue.svg"></img> <img alt="IDE-version" src="https://img.shields.io/badge/IDE-vs2022-blue.svg"></img> MIT Licence <a href="https://github.com/LoveHikari/friendly_csharp_common"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/9/95/Font_Awesome_5_brands_github.svg/54px-Font_Awesome_5_brands_github.svg.png" height="24"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/29/GitHub_logo_2013.svg/128px-GitHub_logo_2013.svg.png" height="24"></a>

<p align="center"> <a href="https://github.com/LoveHikari/friendly_csharp_common/blob/master/README.md">中文</a> ❤ <a href="https://github.com/LoveHikari/friendly_csharp_common/blob/master/README.en.md">English</a> ❤ <a href="https://github.com/LoveHikari/friendly_csharp_common/blob/master/README.jp.md">日本語</a> </p>

全龄段友好的C#.NET万能工具库,不管你是菜鸟新手还是骨灰级玩家都能轻松上手,这个库包含一些常用的操作类,大都是静态类,加密解密,反射操作,树结构,文件探测,权重随机筛选算法,分布式短id,表达式树,linq扩展,文件压缩,多线程下载,硬件信息,字符串扩展方法,日期时间扩展操作,中国农历,大文件拷贝,图像裁剪,验证码,断点续传,集合扩展、Excel导出等常用封装。

诸多功能集一身,代码量不到2MB!

项目开发模式:日常代码积累+网络搜集

⭐⭐⭐喜欢这个项目的话就Star、Fork、Follow素质三连关♂注一下吧⭐⭐⭐

关于本项目,如果你有任何不懂的地方或使用过程中遇到任何问题,可以直接提issue或私信联系我,我会为你提供完全免费的技术指导,当然,如果你觉得不好意思接受免费的指导,想适当打赏我也是不会拒绝的!🤣🤣🤣

请注意:

一旦使用本开源项目以及引用了本项目或包含本项目代码的公司因为违反劳动法(包括但不限定非法裁员、超时用工、雇佣童工等)在任何法律诉讼中败诉的,一经发现,本项目作者有权利追讨本项目的使用费(公司工商注册信息认缴金额的2-5倍作为本项目的授权费),或者直接不允许使用任何包含本项目的源代码! 人力外包公司007公司需要使用本类库,请联系作者进行商业授权!其他企业或个人可随意使用不受限。007那叫用人,也是废人。8小时工作制才可以让你有时间自我提升,将来有竞争力。反对007,人人有责!

建议开发环境

操作系统:Windows 11 23H2及以上版本

开发工具:VisualStudio2022 v17.8及以上版本

SDK:.Net 8.0及以上所有版本

安装程序包

.NET 8.0以上

PM> Install-Package Hikari.Common

特色功能示例代码

1.检验字符串是否是Email、手机号、URL、IP地址、身份证号等

bool isEmail="3444764617@qq.com".MatchEmail(); // 可在appsetting.json中添加EmailDomainWhiteList和EmailDomainBlockList配置邮箱域名黑白名单,逗号分隔,如"EmailDomainBlockList": "^\\w{1,5}@qq.com,^\\w{1,5}@163.com,^\\w{1,5}@gmail.com,^\\w{1,5}@outlook.com",
bool isInetAddress = "114.114.114.114".MatchInetAddress();
bool isUrl = "http://masuit.com".MatchUrl();
bool isPhoneNumber = "15205201520".MatchPhoneNumber();
bool isIdentifyCard = "312000199502230660".MatchIdentifyCard();// 校验中国大陆身份证号
bool isCNPatentNumber = "200410018477.9".MatchCNPatentNumber(); // 校验中国专利申请号或专利号,是否带校验位,校验位前是否带“.”,都可以校验,待校验的号码前不要带CN、ZL字样的前缀

2.硬件监测(仅支持Windows)

float load = SystemInfo.CpuLoad;// 获取CPU占用率
long physicalMemory = SystemInfo.PhysicalMemory;// 获取物理内存总数
long memoryAvailable = SystemInfo.MemoryAvailable;// 获取物理内存可用率
double freePhysicalMemory = SystemInfo.GetFreePhysicalMemory();// 获取可用物理内存
Dictionary<string, string> diskFree = SystemInfo.DiskFree();// 获取磁盘每个分区可用空间
Dictionary<string, string> diskTotalSpace = SystemInfo.DiskTotalSpace();// 获取磁盘每个分区总大小
Dictionary<string, double> diskUsage = SystemInfo.DiskUsage();// 获取磁盘每个分区使用率
double temperature = SystemInfo.GetCPUTemperature();// 获取CPU温度
int cpuCount = SystemInfo.GetCpuCount();// 获取CPU核心数
IList<string> ipAddress = SystemInfo.GetIPAddress();// 获取本机所有IP地址
string localUsedIp = SystemInfo.GetLocalUsedIP();// 获取本机当前正在使用的IP地址
IList<string> macAddress = SystemInfo.GetMacAddress();// 获取本机所有网卡mac地址
string osVersion = SystemInfo.GetOsVersion();// 获取操作系统版本
RamInfo ramInfo = SystemInfo.GetRamInfo();// 获取内存信息
var cpuSN=SystemInfo.GetCpuInfo()[0].SerialNumber; // CPU序列号
var driveSN=SystemInfo.GetDiskInfo()[0].SerialNumber; // 硬盘序列号

44. 真实文件类型探测/文本编码检测

var encoding=new FileInfo(filepath).GetEncoding(); // 获取文件编码(扩展调用)
var encoding=stream.GetEncoding(); // 获取流的编码(扩展调用)
var encoding=TextEncodingDetector.GetEncoding(filepath); // 获取文件编码(类调用)

// 多种方式,任君调用
var detector=new FileInfo(filepath).DetectFiletype(); // 扩展调用
//var detector=File.OpenRead(filepath).DetectFiletype(); // 流扩展调用
//var detector=FileSignatureDetector.DetectFiletype(filepath); // 类调用

detector.Precondition;//基础文件类型
detector.Extension;//真实扩展名
detector.MimeType;//MimeType
detector.FormatCategories;//格式类别
默认支持的文件类型
扩展名 说明
3GP 3GPP, 3GPP 2
7Z 7-Zip
APK ZIP based Android Package
AVI Audio-Video Interleave
SH Shell Script
BPLIST Binary Property List
BMP, DIB Bitmap
BZ2 Bunzip2 Compressed
CAB Microsoft Cabinet
CLASS Java Bytecode
CONFIG .NET Configuration File
CRT, CERT Certificate
CUR Cursor
DB Windows Thumbs.db Thumbnail Database
DDS DirectDraw Surface
DLL Windows Dynamic Linkage Library
DMG Apple Disk Mount Image
DMP Windows Memory Dump File
DOC Microsoft Office Word 97-2003 Document
DOCX Microsoft Office Word OpenXML Document
EPUB e-Pub Document
EXE Windows Executive
FLAC Loseless Audio
FLV Flash Video
GIF Graphics Interchage Format
GZ GZ Compressed
HDP HD Photo(JPEG XR) Image
HWP Legacy HWP, HWPML, CFBF HWP
ICO Icon
INI Initialization File
ISO ISO-9660 Disc Image
LNK Windows Shortcut Link
JP2 JPEG 2000 Image
JPG, JPEG Joint Photographic Experts Group Image
LZH LZH Compressed
M4A MP4 Container Contained Audio Only
M4V MP4 Container Contained Video
MID Midi Sound
MKA Matroska Container Contained Audio Only
MKV Matroska Container Contained Video
MOV QuickTime Movie Video
MP4 MP4 Container Contained Contents
MSI Microsoft Installer
OGG OGG Video or Audio
ODF OpenDocument Formula
ODG OpenDocument Graphics
ODP OpenDocument Presentation
ODS OpenDocument Spreadsheet
ODT OpenDocument Text
PAK PAK Archive or Quake Archive
PDB Microsoft Program Database
PDF Portable Document Format
PFX Microsoft Personal Information Exchange Certificate
PNG Portable Network Graphics Image
PPT Microsoft Office PowerPoint 97-2003 Document
PPTX Microsoft Office PowerPoint OpenXML Document
PPSX Microsoft Office PowerPoint OpenXML Document for Slideshow only
PSD Photoshop Document
RAR WinRAR Compressed
REG Windows Registry
RPM RedHat Package Manager Package
RTF Rich Text Format Document
SLN Microsoft Visual Studio Solution
SRT SubRip Subtitle
SWF Shockwave Flash
SQLITE, DB SQLite Database
TAR pre-ISO Type and UStar Type TAR Package
TIFF Tagged Image File Format Image
TXT Plain Text
WAV Wave Audio
WASM Binary WebAssembly
WEBM WebM Video
WEBP WebP Image
XAR XAR Package
XLS Microsoft Office Excel 97-2003 Document
XLSX Microsoft Office Excep OpenXML Document
XML Extensible Markup Language Document
Z Z Compressed
ZIP ZIP Package

代码包含

DateTime扩展类 DateTime帮助类

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  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 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 (3)

Showing the top 3 NuGet packages that depend on Hikari.Common:

Package Downloads
Hikari.UniCloud.Sdk

UniCloud操作类

Hikari.Common.EntityFrameworkCore

efcore基础类

Hikari.WeChatCloud.Sdk

微信云数据库操作类

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.1.5 161 7/9/2025
8.1.4 160 6/24/2025
8.1.3 142 6/20/2025
8.1.2 188 3/20/2025
8.1.1 155 3/19/2025
8.1.0 247 3/5/2025
8.0.12 135 12/27/2024
8.0.11 129 12/23/2024
8.0.10 149 11/12/2024
8.0.9 149 10/16/2024
8.0.8 150 10/9/2024
8.0.7 211 3/11/2024
8.0.6 214 2/1/2024
8.0.5 150 1/31/2024
8.0.0.4 169 1/31/2024
8.0.0.3 146 1/30/2024
8.0.0.2 238 1/5/2024
8.0.0.1 212 11/29/2023
8.0.0 145 11/15/2023
7.0.2.3 190 10/26/2023
7.0.2.2 179 10/26/2023
7.0.2.1 170 10/26/2023
7.0.2 205 8/16/2023
7.0.1.4 216 8/1/2023
7.0.1.3 223 7/28/2023
7.0.1.2 218 7/19/2023
7.0.1.1 379 2/23/2023
7.0.1 426 11/21/2022
7.0.0 411 11/9/2022
6.0.4 512 7/18/2022
6.0.3.9 503 5/27/2022
6.0.3.8 527 4/22/2022
6.0.3.7 234 4/13/2022
6.0.3.6 217 4/11/2022
6.0.3.5 211 3/31/2022
6.0.3.4 545 1/26/2022
6.0.3.3 543 1/11/2022
6.0.3.2 358 12/29/2021
6.0.3.1 471 12/29/2021 6.0.3.1 is deprecated because it has critical bugs.
6.0.3 366 12/24/2021
6.0.2.4 455 11/9/2021
6.0.0-rc.2.2.4 262 10/18/2021
6.0.0-rc.2.2.3 222 10/14/2021
6.0.0-rc.1.2.2 237 10/12/2021
6.0.0-rc.1.2.1 256 9/23/2021
6.0.0-rc.1.2.0 277 9/16/2021
6.0.0-rc.1.1.0 290 9/16/2021
6.0.0-preview.4.3.0 274 6/23/2021
6.0.0-preview.4.1.0 270 6/9/2021
6.0.0-preview.4.0.0 294 6/4/2021
6.0.0-preview.3.1.1 246 5/25/2021
6.0.0-preview.3.1.0 241 5/20/2021

修复了一些错误
いくつかのバグを修正しました
Fixed some bugs