YE.Core 1.0.2024.801

dotnet add package YE.Core --version 1.0.2024.801                
NuGet\Install-Package YE.Core -Version 1.0.2024.801                
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="YE.Core" Version="1.0.2024.801" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add YE.Core --version 1.0.2024.801                
#r "nuget: YE.Core, 1.0.2024.801"                
#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 YE.Core as a Cake Addin
#addin nuget:?package=YE.Core&version=1.0.2024.801

// Install YE.Core as a Cake Tool
#tool nuget:?package=YE.Core&version=1.0.2024.801                

YE.Core

YE.Core是一个基础类库,包括开发常用功能。

CrcHelper

CRC-算法辅助类,分常用查表法和计算法。
计算法
/// <summary>
/// CRC-16校验算法[计算法]
/// </summary>
/// <example>
/// <code lang="cs">
/// <![CDATA[
/// GetCrc16(data, 0x1021, true) -- CRC-16/MCRF4XX
/// GetCrc16(data, 0x1021, false) -- CRC-16/XMODEM
/// GetCrc16(data, 0x8005, true) -- CRC-16/MODBUS
/// GetCrc16(data, 0x8005, false) -- CRC-16/BUYPASS
/// ]]>
/// </code>
/// </example>
/// <param name="data">数据</param>
/// <param name="ploy">多项式</param>
/// <param name="isReverse">true:逆序 低位在左,高位在右,false:正序 高位在左,低位在右</param>
/// <returns>CRC结果</returns>
public static UInt16 GetCrc16(byte[] data, UInt16 ploy, bool isReverse)
            
            
/// <summary>
/// CRC-32校验算法[计算法]
/// </summary>
/// <example>
/// <code lang="cs">
/// <![CDATA[
/// GetCrc32(data, 0x04C11DB7, true) -- CRC-32
/// GetCrc32(data, 0x04C11DB7, false) -- CRC-32/POSIX
/// GetCrc32(data, 0x1EDC6F41, true) -- CRC-32C
/// ]]>
/// </code>>
/// </example>
/// <param name="data">数据</param>
/// <param name="ploy">多项式</param>
/// <param name="isReverse">true:逆序 低位在左,高位在右,false:正序 高位在左,低位在右</param>
/// <returns>CRC结果</returns>
public static UInt32 GetCrc32(byte[] data, UInt32 ploy, bool isReverse)            
查表法
/// <summary>
/// CRC16-生成表方法
/// </summary>
/// <param name="poly">多项式</param>
/// <param name="isReverse">true:逆序 低位在左,高位在右,false:正序 高位在左,低位在右</param>
/// <returns>表</returns>
public static UInt16[] GenerateCrc16Table(UInt16 poly, bool isReverse)
    
    
/// <summary>
/// CRC32-生成表方法
/// </summary>
/// <param name="poly">多项式</param>
/// <param name="isReverse">true:逆序 低位在左,高位在右,false:正序 高位在左,低位在右</param>
/// <returns>表</returns>
public static UInt32[] GenerateCrc32Table(UInt32 poly, bool isReverse)

    
/// <summary>
/// CRC-16校验算法[查表法]
/// </summary>
/// <param name="data">数据</param>
/// <param name="crcTable">表</param>
/// <param name="isReverse">true:逆序 低位在左,高位在右,false:正序 高位在左,低位在右</param>
/// <returns>CRC结果</returns>
public static UInt16 GetCrc16WithTable(byte[] data, UInt16[] crcTable, bool isReverse)

    
/// <summary>
/// CRC-32校验算法[查表法]
/// </summary>
/// <param name="data">数据</param>
/// <param name="crcTable">表</param>
/// <param name="isReverse">true:逆序 低位在左,高位在右,false:正序 高位在左,低位在右</param>
/// <returns>CRC结果</returns>
public static UInt32 GetCrc32WithTable(byte[] data, UInt32[] crcTable, bool isReverse)

EnumExtension

获取Enum类型的Description信息
/// <summary>
/// 获取Enum类型的Description信息
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static string GetDescription(this Enum value)

IniHelper

ini文件操作类
  • 支持bool、int、float、double、string类型;
  • float类型有效位数7位;double类型有效位数15位;
  • string类型有效位数512位;
  • 当string类型为多语言且出现乱码时,需提前创建ini文件且格式为UTF16 LE;
/// <summary>
/// 写入数据
/// </summary>
/// <example>
/// <code lang="cs">
/// <![CDATA[
/// string file_path = "./test.ini";
/// IniHelper.WriteValue("BOOL", "test_1", false, file_path);
/// IniHelper.WriteValue("INT", "test_3", int.MinValue, file_path);
/// IniHelper.WriteValue("FLOAT", "test_6", -1234.567, file_path);
/// IniHelper.WriteValue("DOUBLE", "test_9", -123456789.987654, file_path);
/// IniHelper.WriteValue("STRING", "test_14", "안녕하세요", file_path);
/// ]]>
/// </code>
/// </example>
/// <typeparam name="T">类型</typeparam>
/// <param name="section">节</param>
/// <param name="key">键</param>
/// <param name="value">值</param>
/// <param name="filePath">ini文件</param>
/// <returns>是否写入成功</returns>
public static bool WriteValue<T>(string section, string key, T value, string filePath)
    
/// <summary>
/// 读取数据
/// </summary>
/// <example>
/// <code lang="cs">
/// <![CDATA[
/// string file_path = "./test.ini";
/// bool test_1 = IniHelper.ReadValue<bool>("BOOL", "test_1", file_path);
/// int test_3 = IniHelper.ReadValue<int>("INT", "test_3", file_path)
/// float test_6 = IniHelper.ReadValue<float>("FLOAT", "test_6", file_path);
/// double test_9 = IniHelper.ReadValue<double>("DOUBLE", "test_9", file_path);
/// string test_14 = IniHelper.ReadValue<string>("STRING", "test_14", file_path);
/// ]]>
/// </code>
/// </example>
/// <typeparam name="T">类型</typeparam>
/// <param name="section">节</param>
/// <param name="key">键</param>
/// <param name="filePath">ini文件</param>
/// <param name="defaultValue">默认值</param>
/// <returns></returns>
public static T ReadValue<T>(string section, string key, string filePath, T defaultValue = default(T))

ProducerConsumer

简单生产者-消费者模式
var producerConsumer = new ProducerConsumer<int>(t =>
{
    Task.Run(() =>
    {
        Console.WriteLine($"Hello YE.Core, This is from {t}");
    });
});

producerConsumer.Add(10);
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net5.0-windows7.0 is compatible.  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.  net6.0-windows7.0 is compatible.  net7.0 is compatible.  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.  net7.0-windows7.0 is compatible.  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.  net8.0-windows7.0 is compatible. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.5

    • No dependencies.
  • .NETFramework 4.6.2

    • No dependencies.
  • .NETFramework 4.7.2

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net5.0

    • No dependencies.
  • net5.0-windows7.0

    • No dependencies.
  • net6.0

    • No dependencies.
  • net6.0-windows7.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net7.0-windows7.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net8.0-windows7.0

    • No dependencies.

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
1.0.2024.801 104 8/1/2024
1.0.2024.701 111 7/1/2024
1.0.2024.627-beta 96 6/27/2024
0.1.2024.514 105 5/14/2024
0.1.2024.513 104 5/13/2024

更新ReadMe.md