Zzz.Tool
1.1.0
dotnet add package Zzz.Tool --version 1.1.0
NuGet\Install-Package Zzz.Tool -Version 1.1.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="Zzz.Tool" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Zzz.Tool" Version="1.1.0" />
<PackageReference Include="Zzz.Tool" />
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 Zzz.Tool --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Zzz.Tool, 1.1.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 Zzz.Tool@1.1.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=Zzz.Tool&version=1.1.0
#tool nuget:?package=Zzz.Tool&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
������־
1.0.0
��Ŀ������滮ģ��
1.0.1
������������Utils������չ
- ��������ַ�������
- �����ַ�����չ
- ��������ʱ���ʽʱ���ת����չ
- ����ö����չ
- ����ʵ��ӳ����չ
- ����ͳһ�����ࡢ��ҳ����չ��ͳһ�쳣��
Use
//ֻ�������ֵ��ַ���
RandomStringUtils.RandomNumeric(10);
//ֻ������ĸ���ַ���
RandomStringUtils.RandomAlphabetic(10);
//�������֡���ĸ���ַ���
RandomStringUtils.RandomAlphanumeric(10);
//GUID
StringUtils.NewId();
//�����ţ�yyyyMMddHHmmssfff+7λ�������
StringUtils.NewOrderNo();
//����(Ĭ��*)
"zz123456".Mask('#');
//Base64
"zz123456".ToBase64String();
"zz123456".ToBase64String().Base64ToString();
//ʱ���ַ���(Ĭ��'/'�ָ�) yyyy/mm/dd HH:mm:ss:fff
DateTime.Now.ToCommonDateTime('-');
DateTime.Now.ToCommonDateTimeWithSecond();
//ʱ��תʱ������룩
DateTime.Now.ToTotalSeconds();
//ʱ��תʱ��������룩
DateTime.Now.ToTotalMilliSeconds();
//ʱ���תʱ��
DateTime.Now.ToTotalSeconds().ToDateTimeWithSecond();
DateTime.Now.ToTotalSeconds().ToDateTimeWithMilliSecond();
//ʱ���
date1.DateDiff(date2);
//��ȡö��������DescriptionAttribute��
user.UserTypeEnum.GetDescription()
//ӳ��
Users user = new Users();
user.Map<Users,UsersDto>();
userList.Map<List<Users>,List<UsersDto>>()
//ͳһ����ֵ{"code":0,"msg":"success"}
R.Ok();
//ͳһ����ֵ{"code":0,"msg":"success","data":obj}
R.Ok().Put(obj);
//ͳһ����ֵ{"code":500,"msg":"δ֪�쳣������ϵ����Ա"}
R.Error();
//ͳһ����ֵ{"code":code,"msg":error}
R.Error(code,"error");
//��ҳ
var list = Users.GetUserList();
//������ҳ
new PageUtils<Users>(list.Skip(1).Take(3), list.Count(), p.PageSize, p.Page);
//��ҳ��ѯ����Model�̳�IPage
new PageUtils<Users>(IPage,xxx.AsQueryable())
//������ҳ
xxx.AsQueryable().ToPage(IPage);
//ҳ���ҳ
xxx.AsQueryable().ToPage(pageIndex,pageSize);
//�쳣
throw new ZzzException("�׳��쳣");
throw new ZzzException(5001,"�׳��쳣");
1.0.2
����У�顢Jwt��Json
- �����ַ���У����չ���Զ���У��
- ����Jwt��װ
- Json��չ
- ͼƬ��������չ
Use
//��ֵУ��
//������https://any86.github.io/any-rule/
TryValidate("��У���ַ���","����");
TryValidate(�ַ����б�,����);
"www.xxxxx.com".IsURL();
"https://1234.345345/sdd/aa.png".IsImagePath();
"1233333333333333".IsBackCardId();
"XX88888".IsPlate();
"18754564845".IsMobilePhone();
"1234564778975646".IsIDCard();
5.Range(1,4);
//����JWT
var securityKey = "oInZ1834jQv04qweKgeEaaGh";
JwtUtils.GenerateToken("123456", securityKey,7);
//��ȡJWTƾ֤�û���Ϣ
JwtUtils.GetPrincipal(token, securityKey);
//��ȡJWT����
JwtUtils.GetPayload(token);
//��֤
JwtUtils.CheckToken(token, securityKey);
JwtUtils.IsExp(token);
//Json��ʵ��ת��
user.ToJson(true);
json.ToObject<Users>();
//Image��
"xxx.png".IsImage();
ImageUtils.IsImage("xxx.png");
//ͼƬ����
ImageUtils.Resize(@"StaticFile\ccc.jpg", "1111.jpg", 100, 100);
@"StaticFile\ccc.jpg".Resize(100,100);
@"StaticFile\ccc.jpg".Resize("2222.png",100,100);
//ͼƬ��ʽת����֧��Png|Jpeg|WbeP|Gif|Bmp|Pbm(Ĭ������GUID)
@"StaticFile\ccc.jpg".ToWebP();
ImageUtils.ToWenP("xxxx");
//ͼƬ��ʽת��ָ�����ƣ�Ŀǰֻ֧�ֱ���ͼƬ��
@"StaticFile\ccc.jpg".ToPng("������.png");
ImageUtils.ToWenP("xxxx.png""newName.WebP");
//֧���ļ���
using var stream = new FileStream(@"StaticFile\ccc.jpg", FileMode.Open);
stream.SaveWebP(@"StaticFile\");
1.1.0
����
- MD5����|���Ρ���չ
- DES����|���ܡ���չ
- RSA����|���ܡ�ǩ��|��ǩ����չ
Use
//AES���ܽ���|��չ
EncryptUntils.AesEncrypt("key", "iv","content");
EncryptUntils.AESDecrypt("key", "iv", "content");
"zz123456".AESEncrypt("key","iv");
"asdasdasd".AESDecrypt("key"��"iv");
//AESGCM���ܽ���|��չ
EncryptUntils.AesGcmEncrypt("key", "iv", "zz123456", out string tag, out string cipher);
EncryptUntils.AesGcmDecrypt("key", "iv", tag, cipher);
"zz123456".AESGcmEncrypt("key","iv",out tag);
"asdasdasd".AESGcmDecrypt("key","iv",tag);
//AESCCM���ܽ���|��չ
EncryptUntils.AesCcmEncrypt("key", "iv", "zz123456", out string tag, out string cipher);
EncryptUntils.AesCcmDecrypt("key", "iv", tag, cipher);
"zz123456".AesCcmEncrypt("key","iv",out tag);
"asdasdasd".AesCcmDecrypt("key","iv",tag);
//RSA���ܽ���|��չ
EncryptUntils.RSAEncrypt("zz123456", publicKey);
EncryptUntils.RSADecrypt(cipher, privateKey)
"zz123456".RSAEncrypt(publicKey);
cipher.RSADecrypt(privateKey)
//ǩ����ǩ
EncryptUntils.RSASignWithSAH256("zz123456", privateKey);
EncryptUntils.RSAVerifyWithSAH256("zz123456", sign, privateKey);
"zz123456".RSASignWithSAH1(privateKey);
"zz123456".RSAVerifyWithSAH1(enStr,publicKey);
//MD5���ܽ���|��չ
"zz123456".MD5Encrypt();
"zz123456".MD5Encrypt("salt");
1.2.0
�����
- �ļ���д
- �ļ�ѹ��
- XML��д��ת��
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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 was computed. 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.
-
net6.0
- Microsoft.AspNetCore.Http.Features (>= 5.0.17)
- Microsoft.IdentityModel.Tokens (>= 6.22.0)
- Newtonsoft.Json (>= 13.0.1)
- SixLabors.ImageSharp (>= 2.1.3)
- System.IdentityModel.Tokens.Jwt (>= 6.22.0)
- TinyMapper (>= 3.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.