XiHan.Common.Utilities
0.4.2
Prefix Reserved
The owner has unlisted this package.
This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package XiHan.Common.Utilities --version 0.4.2
NuGet\Install-Package XiHan.Common.Utilities -Version 0.4.2
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="XiHan.Common.Utilities" Version="0.4.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XiHan.Common.Utilities" Version="0.4.2" />
<PackageReference Include="XiHan.Common.Utilities" />
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 XiHan.Common.Utilities --version 0.4.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: XiHan.Common.Utilities, 0.4.2"
#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 XiHan.Common.Utilities@0.4.2
#: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=XiHan.Common.Utilities&version=0.4.2
#tool nuget:?package=XiHan.Common.Utilities&version=0.4.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
XiHan.Common.Utilities
曦寒公共通用组件库
如何使用
依赖注入
services.RunModuleInitializers(configuration)
包含功能
加密解密
AES加密解密
// 加密
AesEncryptionHelper.Encrypt(plainText,password);
// 解密
AesEncryptionHelper.Decrypt(cipherText,password);
DES加密解密
// 加密
DesEncryptionHelper.Encrypt(plainText);
// 解密
DesEncryptionHelper.Decrypt(cipherText);
MD5加密
// 对字符串进行 MD5 生成哈希
Md5HashEncryptionHelper.Encrypt(plainText);
// 对数据流进行 MD5 生成哈希
Md5HashEncryptionHelper.EncryptStream(inputPath);
RSA加密解密
// 加密
// 生成密钥对,并将公钥和私钥存储到文件中
RsaEncryptionHelper.GenerateKeys(publicKeyPath,privateKeyPath);
// 使用公钥加密数据
string result = RsaEncryptionHelper.Encrypt(plainText);
// 解密
// 加载一个已有的 RSA 密钥对
RsaEncryptionHelper.LoadKeys(publicKeyPath,privateKeyPath);
// 使用私钥解密数据
string result = RsaEncryptionHelper.Decrypt(cipherText);
SHA加密
// 生成 SHA1 哈希值
ShaHashEncryptionHelper.Sha1(plainText);
// 生成 SHA256 哈希值
ShaHashEncryptionHelper.Sha256(plainText);
// 生成 SHA384 哈希值
ShaHashEncryptionHelper.Sha384(plainText);
// 生成 SHA512 哈希值
ShaHashEncryptionHelper.Sha512(plainText);
自定义异常
// 创建一个自定义异常
throw new CustomException("自定义异常");
拓展
控制台输出拓展
// 正常信息
inputStr.WriteLineInfo();
// 成功信息
inputStr.WriteLineSuccess();
// 处理、查询信息
inputStr.WriteLineHandle();
// 警告、新增、更新信息
inputStr.WriteLineWarning();
// 错误、删除信息
inputStr.WriteLineError();
编码解码拓展
// Base32 编码
data.Base32Encode();
// Base32 解码
data.Base32Decode();
// Base64 编码
data.Base64Encode();
// Base64 解码
data.Base64Decode();
// HTML 编码
data.HtmlEncode();
// HTML 解码
data.HtmlDecode();
// URL 编码
data.UrlEncode();
// URL 解码
data.UrlDecode();
// Unicode 编码
data.UnicodeEncode();
// Unicode 解码
data.UnicodeDecode();
// 将字符串转化为二进制
data.BinaryEncode();
// 将二进制转化为字符串
data.BinaryDecode();
// 将字符串转化为文件流
data.ToStream();
枚举拓展
// 获取枚举的描述
EnumHelper.GetDescription(enumValue);
// 获取枚举的值
EnumHelper.GetEnumValue(enumValue);
// 获取枚举的名称
EnumHelper.GetEnumName(enumValue);
// 获取枚举的键值对
EnumHelper.GetEnumKeyValue(enumValue);
| Product | Versions 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 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.
-
net8.0
- XiHan.Common.Core (>= 0.4.2)
- Yitter.IdGenerator (>= 1.0.14)
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 |
|---|