diff --git a/Windows/CS/Framework4.0/Utils/Utils/Properties/AssemblyInfo.cs b/Windows/CS/Framework4.0/Utils/Utils/Properties/AssemblyInfo.cs index 5a6fe04..d9430bb 100644 --- a/Windows/CS/Framework4.0/Utils/Utils/Properties/AssemblyInfo.cs +++ b/Windows/CS/Framework4.0/Utils/Utils/Properties/AssemblyInfo.cs @@ -12,7 +12,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyProduct("com.joyd.Utils")] [assembly: AssemblyCopyright("Copyright © 2025 JoyD")] [assembly: AssemblyTrademark("JoyD")] -[assembly: AssemblyCulture("zh-CN")] +[assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 会使此程序集中的类型 //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 diff --git a/Windows/CS/Framework4.0/Utils/Utils/Utils.cs b/Windows/CS/Framework4.0/Utils/Utils/Utils.cs index 0461e99..db30997 100644 --- a/Windows/CS/Framework4.0/Utils/Utils/Utils.cs +++ b/Windows/CS/Framework4.0/Utils/Utils/Utils.cs @@ -156,119 +156,5 @@ namespace JoyD.Windows.CS { return Convert.FromBase64String(base64); } - - /// - /// 构建不含前缀的FTPC命令字节流 - /// - /// 命令字符(ASCII编码) - /// 命令参数,支持以下类型: - /// - /// long: 24位大端序数据(如filesize24或addr24) - /// ushort: 16位大端序数据长度 - /// uint: 32位大端序数据(如CRC32值) - /// string: ASCII编码的字符串参数 - /// byte[]: 原始字节数组参数 - /// - /// - /// 包含命令、参数和CRC16校验的完整字节数组 - /// 当参数类型不支持时抛出 - public static byte[] BuildRawFTPCommand(char command, params object[] parameters) - { - using (MemoryStream ms = new MemoryStream()) - { - // 写入命令(ASCII编码的单个字符) - ms.WriteByte((byte)command); - - // 添加参数(参数之间没有间隔,直接写入字节) - foreach (var param in parameters) - { - if (param is long) - { - // filesize24或addr24: 3字节大端序 - long value = (long)param; - - // 使用位运算直接获取24位值的三个字节,大端序 - byte byte1 = (byte)((value >> 16) & 0xFF); // 最高位字节 - byte byte2 = (byte)((value >> 8) & 0xFF); // 中间字节 - byte byte3 = (byte)(value & 0xFF); // 最低位字节 - - // 直接写入三个字节 - ms.WriteByte(byte1); - ms.WriteByte(byte2); - ms.WriteByte(byte3); - } - else if (param is ushort) - { - // N16: 16位大端序数据长度 - ushort value = (ushort)param; - - // 使用位运算直接获取16位值的两个字节,大端序 - byte byte1 = (byte)((value >> 8) & 0xFF); // 高8位字节 - byte byte2 = (byte)(value & 0xFF); // 低8位字节 - - // 直接写入两个字节 - ms.WriteByte(byte1); - ms.WriteByte(byte2); - } - else if (param is uint) - { - // 处理uint类型(如CRC32值) - uint value = (uint)param; - - // 使用位运算直接获取32位值的四个字节,大端序 - byte byte1 = (byte)((value >> 24) & 0xFF); // 最高位字节 - byte byte2 = (byte)((value >> 16) & 0xFF); // 次高位字节 - byte byte3 = (byte)((value >> 8) & 0xFF); // 次低位字节 - byte byte4 = (byte)(value & 0xFF); // 最低位字节 - - // 直接写入四个字节 - ms.WriteByte(byte1); - ms.WriteByte(byte2); - ms.WriteByte(byte3); - ms.WriteByte(byte4); - } - else if (param is string) - { - // 字符串参数直接写入ASCII字节 - string strValue = (string)param; - byte[] strBytes = Encoding.ASCII.GetBytes(strValue); - ms.Write(strBytes, 0, strBytes.Length); - } - else if (param is byte[]) - { - // byte[]参数直接写入 - byte[] data = (byte[])param; - ms.Write(data, 0, data.Length); - } - } - - // 获取当前流中的所有字节,用于计算CRC16 - byte[] currentBytes = ms.ToArray(); - - // 计算CRC16 - ushort crc16 = CalculateCRC16(currentBytes, 0, currentBytes.Length); - - // 写入CRC16(大端序) - byte crcByte1 = (byte)((crc16 >> 8) & 0xFF); // 高8位 - byte crcByte2 = (byte)(crc16 & 0xFF); // 低8位 - ms.WriteByte(crcByte1); - ms.WriteByte(crcByte2); - - // 返回完整的字节数组 - return ms.ToArray(); - } - } - - /// - /// 构建完整的通信命令字符串 - /// - /// 通过BuildRawFTPCommand方法构建的原始FTPC命令字节流 - /// 完整的通信命令字符串,格式为:set(LFMGR: FTPC, "base64_encoded_command") - /// 当输入命令字节流为null时抛出 - public static string BuildCommunicationCommand(byte[] rawFTPCommand) - { - string base64 = Convert.ToBase64String(rawFTPCommand); - return $"set(LFMGR: FTPC, \"{base64}\")"; - } } } diff --git a/Windows/CS/Framework4.0/Utils/publish-nuget.ps1 b/Windows/CS/Framework4.0/Utils/publish-nuget.ps1 index 24faa8b..34c6536 100644 --- a/Windows/CS/Framework4.0/Utils/publish-nuget.ps1 +++ b/Windows/CS/Framework4.0/Utils/publish-nuget.ps1 @@ -10,7 +10,7 @@ $targetDllName = "JoyD.Windows.CS.Utils.dll" # 保持与AssemblyName一致, # NuGet包元数据配置 - 在此处修改所有元数据 $packageId = "com.joyd.utils" -$version = "1.0.0.0" # 更新版本号以确保用户安装的是修复后的版本 +$version = "1.0.0.2" # 更新版本号以确保用户安装的是修复后的版本 $title = "通用工具库" $authors = "曾庆明" $owners = "JoyD Technology" @@ -22,7 +22,7 @@ $licenseUrl = "https://opensource.org/licenses/MIT" $iconFileName = "Utils.ico" $iconSourcePath = Join-Path $scriptDir $iconFileName $iconUrl = "http://47.111.181.23:8081/repository/gradle/main/Utils.ico" -$releaseNotes = "初始版本发布" +$releaseNotes = "取消区域性设置,默认使用 invariant culture" # 其他设置 $nupkgFileName = "$packageId.$version.nupkg"