CodeM.Common.Tools 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package CodeM.Common.Tools --version 1.0.2                
NuGet\Install-Package CodeM.Common.Tools -Version 1.0.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="CodeM.Common.Tools" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CodeM.Common.Tools --version 1.0.2                
#r "nuget: CodeM.Common.Tools, 1.0.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.
// Install CodeM.Common.Tools as a Cake Addin
#addin nuget:?package=CodeM.Common.Tools&version=1.0.2

// Install CodeM.Common.Tools as a Cake Tool
#tool nuget:?package=CodeM.Common.Tools&version=1.0.2                

netcoreTools

.netcore常用工具类集合

Install

依赖安装

Package Manager
Install-Package CodeM.Common.Tools -Version 1.0.2
.NET CLI
dotnet add package CodeM.Common.Tools --version 1.0.2
PackageReference
<PackageReference Include="CodeM.Common.Tools" Version="1.0.2" />
Paket CLI
paket add CodeM.Common.Tools --version 1.0.2

CryptoUtils

加密相关类

Base64编码方法

string Base64Encode(string text, string encoding = "utf-8")

参数: text:待编码的字符串 encoding:指定字符编码格式,默认utf-8

返回:经过Base64编码后的字符串

Base64解码方法

string Base64Decode(string base64Text, string encoding = "utf-8")

参数: base64Text:待解码的Base64编码的字符串 encoding:指定字符编码格式,默认utf-8

返回:经过Base64解码后的字符串

AES加密方法

string AESEncode(string text, string key, string encoding = "utf-8")

参数:

text:待加密的字符串

key:加密字符串

encoding:指定字符编码格式,默认utf-8

返回:加密后的字符串

AES解密方法

string AESDecode(string aesText, string key, string encoding = "utf-8")

参数:

aesText:待解密的AES加密字符串

key:加密字符串

encoding:指定字符编码格式,默认utf-8

返回:解密后的字符串

HashUtils

Hash算法类

MD5哈希计算

string MD5(string text, string encoding = "utf-8")

参数:

text:待哈希计算的字符串

encoding:指定字符编码格式,默认utf-8

返回:经过MD5哈希计算的字符串

SHA1哈希计算<br/>

string SHA1(string text, string encoding = "utf-8")

参数:

text:待哈希计算的字符串

encoding:指定字符编码格式,默认utf-8

返回:经过SHA1哈希计算的字符串

SHA256计算

string SHA256(string text, string encoding = "utf-8")

参数:

text:待哈希计算的字符串

encoding:指定字符编码格式,默认utf-8

返回:经过SHA256哈希计算的字符串

SHA384计算

string SHA384(string text, string encoding = "utf-8")

参数:

text:待哈希计算的字符串

encoding:指定字符编码格式,默认utf-8

返回:经过SHA384哈希计算的字符串

SHA512计算

string SHA512(string text, string encoding = "utf-8")

参数:

text:待哈希计算的字符串

encoding:指定字符编码格式,默认utf-8

返回:经过SHA512哈希计算的字符串

XmlUtils

Xml文件遍历类

节点遍历方法

void Iterate(string file, XmlNodeInfoGetter callback = null)

参数: file:待遍历的XML文件绝对路径 callback:回调函数,可在回调函数中进行节点信息解析和收集

XmlNodeInfoGetter回调方法定义

bool XmlNodeInfoGetter(XmlNodeInfo nodeInfo);

参数: nodeInfo:当前遍历到的节点对象

返回:返回true,程序继续向下遍历;否则,停止遍历。

XmlNodeInfo对象

属性: Path:返回当前节点路径,如:/root/person LocalName:返回当前节点的本地名称 FullName:返回当前节点的全名称,包括命名空间和本地名称 NamespaceURI:返回当前节点的命名空间URI IsNode:返回当前节点是否元素节点 IsEndNode:遍历过程会两次经过一个节点,一次开始,一次结束,该属性返回是否为结束一次的遍历 IsTextNode:返回当前节点是否为文本节点 IsCDATANode:返回当前节点是否为CDATA节点 Text:返回当前节点的文本内容 CData:返回CDATA节点的内容 AttributeCount:返回节点属性的数量 Line:返回当前节点在文件中的行数

方法: bool HasAttributes()

返回:返回当前节点是否包括属性信息

string GetAttribute(int index) 参数: index:指定属性的索引位置 返回:返回指定索引位置的属性的内容

string GetAttribute(string name) 参数: name:指定属性的名称 返回:返回指定名称的属性的内容

string GetAttribute(string localName, string namespaceURI) 参数: localName:指定属性的本地名称 namespaceURI:指定属性的命名空间URI 返回:返回指定名称和命名空间的属性的内容

JsonConfigParser

Json配置文件解析器

添加Json配置文件

public JsonConfigParser AddJsonFile(string path)

参数:

path:Json配置文件全路径

返回:返回Json配置文件解析器本身,可链式调用,增加多个配置文件,配置文件中有相同项,后添加的优先。

将添加的Json配置文件内容解析为动态对象

public dynamic Parse()

返回:将Json配置文件的内容转换为DynamicObject对象并返回。

Github源码

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp3.0 is compatible.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on CodeM.Common.Tools:

Package Downloads
CodeM.Common.Orm

一套轻量级Object/Relational Mapping通用数据库操作框架

CodeM.Common.Ioc

.netcore 一套轻量级IOC操作库

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.6.9 915 7/27/2022
1.6.8 403 7/26/2022
1.6.5 387 7/25/2022
1.6.3 386 7/25/2022
1.6.2 387 7/25/2022
1.6.1 397 7/24/2022
1.6.0 826 7/22/2022
1.3.9 431 6/26/2022
1.3.8 397 6/26/2022
1.3.7 818 6/4/2022
1.3.6 510 3/25/2022
1.3.5 420 3/24/2022
1.3.1 2,033 3/14/2022
1.2.5 717 12/28/2021
1.2.3 285 12/19/2021
1.2.2 264 12/15/2021
1.2.0 1,037 11/13/2021
1.1.18 370 11/4/2021
1.1.16 542 11/3/2021
1.1.15 352 10/14/2021
1.1.12 317 9/30/2021
1.1.10 785 8/10/2021
1.1.9 347 8/10/2021
1.1.8 380 7/28/2021
1.1.7 337 7/14/2021
1.1.6 324 7/8/2021
1.1.5 367 6/25/2021
1.1.3 359 5/20/2021
1.1.2 347 5/20/2021
1.1.1 1,566 3/18/2021
1.1.0 822 3/3/2021
1.0.7 671 2/23/2021
1.0.5 1,588 11/18/2020
1.0.4 701 10/12/2020
1.0.3 708 9/19/2020
1.0.2 516 8/17/2020
1.0.1 1,028 4/30/2019
1.0.0 596 3/27/2019