Skip to content

LoveHikari/friendly_csharp_common

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

friendly_csharp_common

LICENSE MIT Licence

C# Public libraries, including .net standard

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

请注意:

一旦使用本开源项目以及引用了本项目或包含本项目代码的公司因为违反劳动法(包括但不限定非法裁员、超时用工、雇佣童工等)在任何法律诉讼中败诉的,项目作者有权利追讨本项目的使用费,或者直接不允许使用任何包含本项目的源代码!任何性质的外包公司996公司需要使用本类库,请联系作者进行商业授权!其他企业或个人可随意使用不受限。

建议开发环境

操作系统:Windows 11 22000.120及以上版本 开发工具:VisualStudio2022 v17.0.0 Preview 2.1及以上版本 SDK:.Net 6.0及以上版本

安装程序包

.NET 6.0以上

PM> Install-Package Hikari.Common

类库说明

1.GalaSoft.MvvmLight

UI 线程上的调度程序操作的帮助程序类。提取自GalaSoft.MvvmLight

2.Hikari.Common

帮助类日常积累

3.Hikari.WPF

WPF MVVM框架

4.FsLib.EfCore

EF DDD模式基类

5.Hikari.Common.Redis

Redis

6.Hikari.Common.Office

Office

7.Hikari.DbCore

数据库访问帮助类

特色功能示例代码

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; // 硬盘序列号

代码包含

DateTime扩展类 DateTime帮助类

License

MIT

About

.net core 公共库,包括 .net 标准 、.net標準を含む.net coreパブリックライブラリ、 .net core Public libraries, including .net standard

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages