From c5ae08e8c56f25423315ec36eb9a89ecc9b9b27e Mon Sep 17 00:00:00 2001 From: huangxianguo Date: Mon, 3 Jun 2024 16:35:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=87=87=E9=9B=86=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E7=A8=8B=E5=BA=8F=E4=BB=93=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 + .../.idea.MasstransferExporter/.idea/vcs.xml | 2 +- MasstransferCommon/MasstransferCommon.csproj | 14 + MasstransferCommon/Utils/BeanUtil.cs | 39 ++ MasstransferCommon/Utils/DeviceInfoUtil.cs | 90 +++++ MasstransferCommon/Utils/JsonUtil.cs | 42 +++ MasstransferCommon/Utils/Md5Util.cs | 24 ++ MasstransferCommon/Utils/RegistryHelper.cs | 32 ++ MasstransferCommon/Utils/TimeUtil.cs | 63 ++++ ...CoreApp,Version=v7.0.AssemblyAttributes.cs | 4 + .../net7.0/MasstransferCommon.AssemblyInfo.cs | 22 ++ ...asstransferCommon.AssemblyInfoInputs.cache | 1 + ....GeneratedMSBuildEditorConfig.editorconfig | 11 + .../MasstransferCommon.GlobalUsings.g.cs | 8 + .../net7.0/MasstransferCommon.assets.cache | Bin 0 -> 2321 bytes ...nsferCommon.csproj.AssemblyReference.cache | Bin 0 -> 1344 bytes ...asstransferCommon.csproj.nuget.dgspec.json | 71 ++++ .../MasstransferCommon.csproj.nuget.g.props | 15 + .../MasstransferCommon.csproj.nuget.g.targets | 2 + MasstransferCommon/obj/project.assets.json | 227 ++++++++++++ MasstransferCommon/obj/project.nuget.cache | 12 + .../obj/project.packagespec.json | 1 + .../obj/rider.project.model.nuget.info | 1 + .../obj/rider.project.restore.info | 1 + .../MasstransferCommunicate.csproj | 24 ++ .../Mqtt/Client/MessageQueueHelper.cs | 96 +++++ .../Mqtt/Client/MqttClient.cs | 153 ++++++++ MasstransferCommunicate/Mqtt/Model/Message.cs | 8 + .../Mqtt/Model/MqttConnectOptions.cs | 25 ++ ...CoreApp,Version=v7.0.AssemblyAttributes.cs | 4 + .../MasstransferCommunicate.AssemblyInfo.cs | 22 ++ ...ansferCommunicate.AssemblyInfoInputs.cache | 1 + ....GeneratedMSBuildEditorConfig.editorconfig | 11 + .../MasstransferCommunicate.GlobalUsings.g.cs | 8 + .../MasstransferCommunicate.assets.cache | Bin 0 -> 3085 bytes ...ansferCommunicate.csproj.nuget.dgspec.json | 138 ++++++++ ...sstransferCommunicate.csproj.nuget.g.props | 15 + ...transferCommunicate.csproj.nuget.g.targets | 2 + .../obj/project.assets.json | 335 ++++++++++++++++++ .../obj/project.nuget.cache | 14 + .../obj/project.packagespec.json | 1 + .../obj/rider.project.restore.info | 1 + MasstransferExporter.sln | 12 + .../obj/rider.project.restore.info | 2 +- global.json | 7 + 45 files changed, 1564 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 MasstransferCommon/MasstransferCommon.csproj create mode 100644 MasstransferCommon/Utils/BeanUtil.cs create mode 100644 MasstransferCommon/Utils/DeviceInfoUtil.cs create mode 100644 MasstransferCommon/Utils/JsonUtil.cs create mode 100644 MasstransferCommon/Utils/Md5Util.cs create mode 100644 MasstransferCommon/Utils/RegistryHelper.cs create mode 100644 MasstransferCommon/Utils/TimeUtil.cs create mode 100644 MasstransferCommon/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs create mode 100644 MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.AssemblyInfo.cs create mode 100644 MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.AssemblyInfoInputs.cache create mode 100644 MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.GeneratedMSBuildEditorConfig.editorconfig create mode 100644 MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.GlobalUsings.g.cs create mode 100644 MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.assets.cache create mode 100644 MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.csproj.AssemblyReference.cache create mode 100644 MasstransferCommon/obj/MasstransferCommon.csproj.nuget.dgspec.json create mode 100644 MasstransferCommon/obj/MasstransferCommon.csproj.nuget.g.props create mode 100644 MasstransferCommon/obj/MasstransferCommon.csproj.nuget.g.targets create mode 100644 MasstransferCommon/obj/project.assets.json create mode 100644 MasstransferCommon/obj/project.nuget.cache create mode 100644 MasstransferCommon/obj/project.packagespec.json create mode 100644 MasstransferCommon/obj/rider.project.model.nuget.info create mode 100644 MasstransferCommon/obj/rider.project.restore.info create mode 100644 MasstransferCommunicate/MasstransferCommunicate.csproj create mode 100644 MasstransferCommunicate/Mqtt/Client/MessageQueueHelper.cs create mode 100644 MasstransferCommunicate/Mqtt/Client/MqttClient.cs create mode 100644 MasstransferCommunicate/Mqtt/Model/Message.cs create mode 100644 MasstransferCommunicate/Mqtt/Model/MqttConnectOptions.cs create mode 100644 MasstransferCommunicate/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs create mode 100644 MasstransferCommunicate/obj/Debug/net7.0/MasstransferCommunicate.AssemblyInfo.cs create mode 100644 MasstransferCommunicate/obj/Debug/net7.0/MasstransferCommunicate.AssemblyInfoInputs.cache create mode 100644 MasstransferCommunicate/obj/Debug/net7.0/MasstransferCommunicate.GeneratedMSBuildEditorConfig.editorconfig create mode 100644 MasstransferCommunicate/obj/Debug/net7.0/MasstransferCommunicate.GlobalUsings.g.cs create mode 100644 MasstransferCommunicate/obj/Debug/net7.0/MasstransferCommunicate.assets.cache create mode 100644 MasstransferCommunicate/obj/MasstransferCommunicate.csproj.nuget.dgspec.json create mode 100644 MasstransferCommunicate/obj/MasstransferCommunicate.csproj.nuget.g.props create mode 100644 MasstransferCommunicate/obj/MasstransferCommunicate.csproj.nuget.g.targets create mode 100644 MasstransferCommunicate/obj/project.assets.json create mode 100644 MasstransferCommunicate/obj/project.nuget.cache create mode 100644 MasstransferCommunicate/obj/project.packagespec.json create mode 100644 MasstransferCommunicate/obj/rider.project.restore.info create mode 100644 global.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3acf3f3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.idea +**/bin +**/obj +global.json + diff --git a/.idea/.idea.MasstransferExporter/.idea/vcs.xml b/.idea/.idea.MasstransferExporter/.idea/vcs.xml index 6c0b863..94a25f7 100644 --- a/.idea/.idea.MasstransferExporter/.idea/vcs.xml +++ b/.idea/.idea.MasstransferExporter/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/MasstransferCommon/MasstransferCommon.csproj b/MasstransferCommon/MasstransferCommon.csproj new file mode 100644 index 0000000..4dccdb8 --- /dev/null +++ b/MasstransferCommon/MasstransferCommon.csproj @@ -0,0 +1,14 @@ + + + + net7.0 + enable + enable + + + + + + + + diff --git a/MasstransferCommon/Utils/BeanUtil.cs b/MasstransferCommon/Utils/BeanUtil.cs new file mode 100644 index 0000000..0bbce97 --- /dev/null +++ b/MasstransferCommon/Utils/BeanUtil.cs @@ -0,0 +1,39 @@ +namespace MasstransferCommon.Utils; + +/// +/// bean 工具类 +/// +public class BeanUtil +{ + /// + /// 实现Bean的属性复制 + /// + /// + /// + public static void CopyProperties(object source, object target) + { + var sourceProperties = source.GetType().GetProperties(); + var targetProperties = target.GetType().GetProperties(); + + foreach (var sourceProperty in sourceProperties) + { + var targetProperty = Array.Find(targetProperties, p => p.Name == sourceProperty.Name && + p.PropertyType == sourceProperty.PropertyType); + + if (targetProperty != null && targetProperty.CanWrite) + targetProperty.SetValue(target, sourceProperty.GetValue(source)); + } + } + + public static T CopyProperties(object source) + { + var instance = Activator.CreateInstance(); + CopyProperties(source, instance); + return instance; + } + + public static List CopyProperties(IEnumerable source) + { + return source.Select(CopyProperties).ToList(); + } +} \ No newline at end of file diff --git a/MasstransferCommon/Utils/DeviceInfoUtil.cs b/MasstransferCommon/Utils/DeviceInfoUtil.cs new file mode 100644 index 0000000..18c4a84 --- /dev/null +++ b/MasstransferCommon/Utils/DeviceInfoUtil.cs @@ -0,0 +1,90 @@ +using System.Management; +using System.Security.Cryptography; +using System.Text; + +namespace MasstransferSecurity.Utils; + +/// +/// 设备信息工具类方法 +/// +public sealed class DeviceInfoUtil +{ + public static string GenerateUniqueID() + { + var cpuId = GetCpuId(); + var motherboardId = GetMotherboardId(); + var diskDriveId = GetDiskDriveId(); + var macAddress = GetMacAddress(); + + var deviceId = $"{cpuId}-{motherboardId}-{diskDriveId}-{macAddress}"; + return ComputeSha256Hash(deviceId); + } + + private static string GetCpuId() + { + var cpuId = string.Empty; + var searcher = new ManagementObjectSearcher("SELECT ProcessorId FROM Win32_Processor"); + foreach (var item in searcher.Get()) + { + cpuId = item["ProcessorId"].ToString(); + break; + } + + return cpuId; + } + + private static string GetMotherboardId() + { + var motherboardId = string.Empty; + var searcher = new ManagementObjectSearcher("SELECT SerialNumber FROM Win32_BaseBoard"); + foreach (var item in searcher.Get()) + { + motherboardId = item["SerialNumber"].ToString(); + break; + } + + return motherboardId; + } + + private static string GetDiskDriveId() + { + string diskDriveId = string.Empty; + var searcher = new ManagementObjectSearcher("SELECT SerialNumber FROM Win32_DiskDrive"); + foreach (var item in searcher.Get()) + { + diskDriveId = item["SerialNumber"].ToString(); + break; + } + + return diskDriveId; + } + + private static string GetMacAddress() + { + string macAddress = string.Empty; + var searcher = new ManagementObjectSearcher( + "SELECT MACAddress FROM Win32_NetworkAdapter WHERE MACAddress IS NOT NULL AND NOT (MACAddress LIKE '')"); + foreach (var item in searcher.Get()) + { + macAddress = item["MACAddress"].ToString(); + break; + } + + return macAddress.Replace(":", string.Empty); + } + + private static string ComputeSha256Hash(string rawData) + { + using SHA256 sha256Hash = SHA256.Create(); + + var bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(rawData)); + + var builder = new StringBuilder(); + foreach (var t in bytes) + { + builder.Append(t.ToString("x2")); + } + + return builder.ToString(); + } +} \ No newline at end of file diff --git a/MasstransferCommon/Utils/JsonUtil.cs b/MasstransferCommon/Utils/JsonUtil.cs new file mode 100644 index 0000000..19dfb49 --- /dev/null +++ b/MasstransferCommon/Utils/JsonUtil.cs @@ -0,0 +1,42 @@ +using Newtonsoft.Json; + +namespace MasstransferCommon.Utils; + +public class JsonUtil +{ + public static string ToJson(object obj) + { + try + { + return JsonConvert.SerializeObject(obj); + } + catch (Exception e) + { + throw new ArgumentException($" 无效的json 对象 {obj} "); + } + } + + public static T FromJson(string json) + { + try + { + return JsonConvert.DeserializeObject(json); + } + catch (Exception e) + { + throw new ArgumentException($" 无效的json 字符串 {json} "); + } + } + + public static T FromJsonOrDefault(string json) + { + try + { + return JsonConvert.DeserializeObject(json); + } + catch (Exception e) + { + return default; + } + } +} \ No newline at end of file diff --git a/MasstransferCommon/Utils/Md5Util.cs b/MasstransferCommon/Utils/Md5Util.cs new file mode 100644 index 0000000..51a1869 --- /dev/null +++ b/MasstransferCommon/Utils/Md5Util.cs @@ -0,0 +1,24 @@ +using System.Security.Cryptography; +using System.Text; + +namespace MasstransferCommon.Utils; + +/// +/// MD5 加密工具类 +/// +public class Md5Util +{ + public static string Md5(string input) + { + // 创建一个MD5对象 + // 将输入字符串转换为字节数组 + var inputBytes = Encoding.UTF8.GetBytes(input); + // 计算输入字节数组的哈希值 + var bytes = MD5.HashData(inputBytes); + // 将字节数组转换为字符串 + var hashString = new StringBuilder(); + foreach (var b in bytes) hashString.Append($"{b:x2}"); + + return hashString.ToString(); + } +} \ No newline at end of file diff --git a/MasstransferCommon/Utils/RegistryHelper.cs b/MasstransferCommon/Utils/RegistryHelper.cs new file mode 100644 index 0000000..3346c85 --- /dev/null +++ b/MasstransferCommon/Utils/RegistryHelper.cs @@ -0,0 +1,32 @@ +namespace MasstransferCommon.Utils; + +using Microsoft.Win32; + +/// +/// 注册表工具类 +/// +public static class RegistryHelper +{ + public static void WriteValue(string keyPath, string valueName, object value, RegistryValueKind valueKind) + { + using var key = Registry.CurrentUser.CreateSubKey(keyPath); + key.SetValue(valueName, value, valueKind); + } + + public static object? ReadValue(string keyPath, string valueName) + { + using var key = Registry.CurrentUser.OpenSubKey(keyPath); + return key?.GetValue(valueName); + } + + public static void DeleteValue(string keyPath, string valueName) + { + using var key = Registry.CurrentUser.OpenSubKey(keyPath, writable: true); + key?.DeleteValue(valueName); + } + + public static void DeleteKey(string keyPath) + { + Registry.CurrentUser.DeleteSubKeyTree(keyPath, throwOnMissingSubKey: false); + } +} \ No newline at end of file diff --git a/MasstransferCommon/Utils/TimeUtil.cs b/MasstransferCommon/Utils/TimeUtil.cs new file mode 100644 index 0000000..361324b --- /dev/null +++ b/MasstransferCommon/Utils/TimeUtil.cs @@ -0,0 +1,63 @@ +using System.Text; + +namespace MasstransferCommon.Utils; + +public class TimeUtil +{ + + public static void Sleep(int milliseconds) + { + Thread.Sleep(milliseconds); + } + + /// + /// 获取当前的时间戳 + /// + /// + public static long Now() + { + return new DateTimeOffset(DateTime.UtcNow).ToUnixTimeMilliseconds(); + } + + + /// + /// 格式化时间 + /// + /// + /// + /// + public static string FormatTime(long time, string format = "yyyy-MM-dd HH:mm:ss") + { + var dateTime = DateTimeOffset.FromUnixTimeMilliseconds(time).DateTime; + return dateTime.ToString(format); + } + + public static string ToTimeSpan(long time) + { + // 使用TimeSpan.FromMilliseconds来创建TimeSpan对象 + var timeSpan = TimeSpan.FromMilliseconds(time); + + // 获取小时、分钟和秒 + var hours = timeSpan.Hours; + var minutes = timeSpan.Minutes; + var seconds = timeSpan.Seconds; + + var sb = new StringBuilder(); + if (hours > 0) + { + sb.Append(hours).Append("小时"); + } + + if (minutes > 0) + { + sb.Append(minutes).Append('分'); + } + + if (seconds > 0) + { + sb.Append(seconds).Append('秒'); + } + + return sb.ToString(); + } +} \ No newline at end of file diff --git a/MasstransferCommon/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs b/MasstransferCommon/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs new file mode 100644 index 0000000..4257f4b --- /dev/null +++ b/MasstransferCommon/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")] diff --git a/MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.AssemblyInfo.cs b/MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.AssemblyInfo.cs new file mode 100644 index 0000000..efae774 --- /dev/null +++ b/MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.AssemblyInfo.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("MasstransferCommon")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyProductAttribute("MasstransferCommon")] +[assembly: System.Reflection.AssemblyTitleAttribute("MasstransferCommon")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// 由 MSBuild WriteCodeFragment 类生成。 + diff --git a/MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.AssemblyInfoInputs.cache b/MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.AssemblyInfoInputs.cache new file mode 100644 index 0000000..93e6b33 --- /dev/null +++ b/MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +55253de7166d1dd8e0b57bd70c6516d44d5416d0 diff --git a/MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.GeneratedMSBuildEditorConfig.editorconfig b/MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..d56473d --- /dev/null +++ b/MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,11 @@ +is_global = true +build_property.TargetFramework = net7.0 +build_property.TargetPlatformMinVersion = +build_property.UsingMicrosoftNETSdkWeb = +build_property.ProjectTypeGuids = +build_property.InvariantGlobalization = +build_property.PlatformNeutralAssembly = +build_property.EnforceExtendedAnalyzerRules = +build_property._SupportedPlatformList = Linux,macOS,Windows +build_property.RootNamespace = MasstransferCommon +build_property.ProjectDir = C:\workspace\code_repos\haiju\MasstransferExporter\MasstransferCommon\ diff --git a/MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.GlobalUsings.g.cs b/MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.GlobalUsings.g.cs new file mode 100644 index 0000000..8578f3d --- /dev/null +++ b/MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.GlobalUsings.g.cs @@ -0,0 +1,8 @@ +// +global using global::System; +global using global::System.Collections.Generic; +global using global::System.IO; +global using global::System.Linq; +global using global::System.Net.Http; +global using global::System.Threading; +global using global::System.Threading.Tasks; diff --git a/MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.assets.cache b/MasstransferCommon/obj/Debug/net7.0/MasstransferCommon.assets.cache new file mode 100644 index 0000000000000000000000000000000000000000..52a52ab866bdb522152ed3592b161b6886e4fc6c GIT binary patch literal 2321 zcmcIl%Wl&^6m4nx2+))y^ueR0Wx)e;? zq|q>|$7Y=ggR_?OxbSLHdoMh0EU#!KZN+fxLrlpBTFKb%dOU}RW;qV6Ph%Lk1kig1 z7zN%A#w*%FGFPj57PCCpcm&o`#QG4Ad%^q$=F6U|lF~kjbQ~bk3E_dMW%dc>JpNbNM>RS=)uvD##aE+p7MgYCV?C< z1zZF2KmnNTTU_r59j!t8p*2X#q&14L6VJWDkIW=8zrK9Sh>Ka|?>)@USW`J2>4!8lNqq`D}s(W^WowPh2?COZ1-1Swarq8AAqE5GLo=_gURfEbDRYDr^7;nRt6yrSX3&0&< z5m*AEaTgD{ZGV%=ouE}ztawE$s?%@KX>5;=1x0Fd$CO7E9)7xjZlVX>M2{6U3OiO6 zM>{2IKKur~K<}-Z^htl!Ty|I?)5C{4^uugC-vrTH;>d8O&8B{2nw$=QkNsl_pQspTd4 zdByo@C3;!K`FSyh#(D;N#xXgWNkFL*Gd+VCKZFV|pbEW|oE%0*pbZSYFJ+g=-{xRs zWaLLv!^jJgM*?8=Kt5wVkYH&5GJrG#;{p(=0uh-4WU?_q_(8#rh72qqRg4T@6Ys0n zQ!7LAvs3eIjSUi0Owv-#l8h3~ z5>r!CfaU`MBUhOTDCiB04J{cMBZ!N=;>zNZ)Lgyf{FKy`{M;A|paBN3xHAVbgCX+H zKzWz^Ttw8}s9C0T3mkQPs7k=Tg*XU8QV?_AZAVU5gv>VCwN1)eg5i<%zpb0!STdBb zh?*^beEMd6Jj;3h*22&glloR^zWytCe)n4I<$V8^?_I2vlhtd^<#U<&yNE}2-X5jM z)@2s%a(Q11&rDj9Xv47MSL!vHa}Q2G{hVxYa)G>KbLf2O_bO*J#gE+-e!SGt*h-f5 z=DthX7N@~}Ia4kC|E%uaK*m5+k0K%t9B9PETXM2_lA&>0T5^g}N=k~UAvAzc;w_G( zc*{-917^b9)Vva$QRfR+f{48?^A=@D>);CXHC>~h){>8_X7$2U=2UpM3h)vR2m8v8A>zZvzY`*T(k9BeD`HxJqRg>uw za!!>{$UQLG#5d~FWUya0*vHokUgff448ia#8F83oV4P-}W}aqfm||*>Xq<>84gq}u BwQB$X literal 0 HcmV?d00001 diff --git a/MasstransferCommon/obj/MasstransferCommon.csproj.nuget.dgspec.json b/MasstransferCommon/obj/MasstransferCommon.csproj.nuget.dgspec.json new file mode 100644 index 0000000..983f83e --- /dev/null +++ b/MasstransferCommon/obj/MasstransferCommon.csproj.nuget.dgspec.json @@ -0,0 +1,71 @@ +{ + "format": 1, + "restore": { + "C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommon\\MasstransferCommon.csproj": {} + }, + "projects": { + "C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommon\\MasstransferCommon.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommon\\MasstransferCommon.csproj", + "projectName": "MasstransferCommon", + "projectPath": "C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommon\\MasstransferCommon.csproj", + "packagesPath": "C:\\Users\\huangxianguo\\.nuget\\packages\\", + "outputPath": "C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommon\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\huangxianguo\\AppData\\Roaming\\NuGet\\NuGet.Config" + ], + "originalTargetFrameworks": [ + "net7.0" + ], + "sources": { + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net7.0": { + "targetAlias": "net7.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net7.0": { + "targetAlias": "net7.0", + "dependencies": { + "Newtonsoft.Json": { + "target": "Package", + "version": "[13.0.3, )" + }, + "System.Management": { + "target": "Package", + "version": "[8.0.0, )" + } + }, + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.407\\RuntimeIdentifierGraph.json" + } + } + } + } +} \ No newline at end of file diff --git a/MasstransferCommon/obj/MasstransferCommon.csproj.nuget.g.props b/MasstransferCommon/obj/MasstransferCommon.csproj.nuget.g.props new file mode 100644 index 0000000..f54a2f7 --- /dev/null +++ b/MasstransferCommon/obj/MasstransferCommon.csproj.nuget.g.props @@ -0,0 +1,15 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\huangxianguo\.nuget\packages\ + PackageReference + 6.9.1 + + + + + \ No newline at end of file diff --git a/MasstransferCommon/obj/MasstransferCommon.csproj.nuget.g.targets b/MasstransferCommon/obj/MasstransferCommon.csproj.nuget.g.targets new file mode 100644 index 0000000..3dc06ef --- /dev/null +++ b/MasstransferCommon/obj/MasstransferCommon.csproj.nuget.g.targets @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/MasstransferCommon/obj/project.assets.json b/MasstransferCommon/obj/project.assets.json new file mode 100644 index 0000000..e7839fc --- /dev/null +++ b/MasstransferCommon/obj/project.assets.json @@ -0,0 +1,227 @@ +{ + "version": 3, + "targets": { + "net7.0": { + "Newtonsoft.Json/13.0.3": { + "type": "package", + "compile": { + "lib/net6.0/Newtonsoft.Json.dll": { + "related": ".xml" + } + }, + "runtime": { + "lib/net6.0/Newtonsoft.Json.dll": { + "related": ".xml" + } + } + }, + "System.CodeDom/8.0.0": { + "type": "package", + "compile": { + "lib/net7.0/System.CodeDom.dll": { + "related": ".xml" + } + }, + "runtime": { + "lib/net7.0/System.CodeDom.dll": { + "related": ".xml" + } + }, + "build": { + "buildTransitive/net6.0/_._": {} + } + }, + "System.Management/8.0.0": { + "type": "package", + "dependencies": { + "System.CodeDom": "8.0.0" + }, + "compile": { + "lib/net7.0/System.Management.dll": { + "related": ".xml" + } + }, + "runtime": { + "lib/net7.0/System.Management.dll": { + "related": ".xml" + } + }, + "build": { + "buildTransitive/net6.0/_._": {} + }, + "runtimeTargets": { + "runtimes/win/lib/net7.0/System.Management.dll": { + "assetType": "runtime", + "rid": "win" + } + } + } + } + }, + "libraries": { + "Newtonsoft.Json/13.0.3": { + "sha512": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==", + "type": "package", + "path": "newtonsoft.json/13.0.3", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.md", + "README.md", + "lib/net20/Newtonsoft.Json.dll", + "lib/net20/Newtonsoft.Json.xml", + "lib/net35/Newtonsoft.Json.dll", + "lib/net35/Newtonsoft.Json.xml", + "lib/net40/Newtonsoft.Json.dll", + "lib/net40/Newtonsoft.Json.xml", + "lib/net45/Newtonsoft.Json.dll", + "lib/net45/Newtonsoft.Json.xml", + "lib/net6.0/Newtonsoft.Json.dll", + "lib/net6.0/Newtonsoft.Json.xml", + "lib/netstandard1.0/Newtonsoft.Json.dll", + "lib/netstandard1.0/Newtonsoft.Json.xml", + "lib/netstandard1.3/Newtonsoft.Json.dll", + "lib/netstandard1.3/Newtonsoft.Json.xml", + "lib/netstandard2.0/Newtonsoft.Json.dll", + "lib/netstandard2.0/Newtonsoft.Json.xml", + "newtonsoft.json.13.0.3.nupkg.sha512", + "newtonsoft.json.nuspec", + "packageIcon.png" + ] + }, + "System.CodeDom/8.0.0": { + "sha512": "WTlRjL6KWIMr/pAaq3rYqh0TJlzpouaQ/W1eelssHgtlwHAH25jXTkUphTYx9HaIIf7XA6qs/0+YhtLEQRkJ+Q==", + "type": "package", + "path": "system.codedom/8.0.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "Icon.png", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "buildTransitive/net461/System.CodeDom.targets", + "buildTransitive/net462/_._", + "buildTransitive/net6.0/_._", + "buildTransitive/netcoreapp2.0/System.CodeDom.targets", + "lib/net462/System.CodeDom.dll", + "lib/net462/System.CodeDom.xml", + "lib/net6.0/System.CodeDom.dll", + "lib/net6.0/System.CodeDom.xml", + "lib/net7.0/System.CodeDom.dll", + "lib/net7.0/System.CodeDom.xml", + "lib/net8.0/System.CodeDom.dll", + "lib/net8.0/System.CodeDom.xml", + "lib/netstandard2.0/System.CodeDom.dll", + "lib/netstandard2.0/System.CodeDom.xml", + "system.codedom.8.0.0.nupkg.sha512", + "system.codedom.nuspec", + "useSharedDesignerContext.txt" + ] + }, + "System.Management/8.0.0": { + "sha512": "jrK22i5LRzxZCfGb+tGmke2VH7oE0DvcDlJ1HAKYU8cPmD8XnpUT0bYn2Gy98GEhGjtfbR/sxKTVb+dE770pfA==", + "type": "package", + "path": "system.management/8.0.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "Icon.png", + "LICENSE.TXT", + "PACKAGE.md", + "THIRD-PARTY-NOTICES.TXT", + "buildTransitive/net6.0/_._", + "buildTransitive/netcoreapp2.0/System.Management.targets", + "lib/net462/_._", + "lib/net6.0/System.Management.dll", + "lib/net6.0/System.Management.xml", + "lib/net7.0/System.Management.dll", + "lib/net7.0/System.Management.xml", + "lib/net8.0/System.Management.dll", + "lib/net8.0/System.Management.xml", + "lib/netstandard2.0/System.Management.dll", + "lib/netstandard2.0/System.Management.xml", + "runtimes/win/lib/net6.0/System.Management.dll", + "runtimes/win/lib/net6.0/System.Management.xml", + "runtimes/win/lib/net7.0/System.Management.dll", + "runtimes/win/lib/net7.0/System.Management.xml", + "runtimes/win/lib/net8.0/System.Management.dll", + "runtimes/win/lib/net8.0/System.Management.xml", + "system.management.8.0.0.nupkg.sha512", + "system.management.nuspec", + "useSharedDesignerContext.txt" + ] + } + }, + "projectFileDependencyGroups": { + "net7.0": [ + "Newtonsoft.Json >= 13.0.3", + "System.Management >= 8.0.0" + ] + }, + "packageFolders": { + "C:\\Users\\huangxianguo\\.nuget\\packages\\": {} + }, + "project": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommon\\MasstransferCommon.csproj", + "projectName": "MasstransferCommon", + "projectPath": "C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommon\\MasstransferCommon.csproj", + "packagesPath": "C:\\Users\\huangxianguo\\.nuget\\packages\\", + "outputPath": "C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommon\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\huangxianguo\\AppData\\Roaming\\NuGet\\NuGet.Config" + ], + "originalTargetFrameworks": [ + "net7.0" + ], + "sources": { + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net7.0": { + "targetAlias": "net7.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net7.0": { + "targetAlias": "net7.0", + "dependencies": { + "Newtonsoft.Json": { + "target": "Package", + "version": "[13.0.3, )" + }, + "System.Management": { + "target": "Package", + "version": "[8.0.0, )" + } + }, + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.407\\RuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/MasstransferCommon/obj/project.nuget.cache b/MasstransferCommon/obj/project.nuget.cache new file mode 100644 index 0000000..4d70ace --- /dev/null +++ b/MasstransferCommon/obj/project.nuget.cache @@ -0,0 +1,12 @@ +{ + "version": 2, + "dgSpecHash": "ddfrsTX7KLhu5ZmICCDs8Mipbnrk5Hh+8evf7znqlXsdxc4qMFY9k3ScATZwRP6Xqz0Wz52bncjXjvzLZAcd4g==", + "success": true, + "projectFilePath": "C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommon\\MasstransferCommon.csproj", + "expectedPackageFiles": [ + "C:\\Users\\huangxianguo\\.nuget\\packages\\newtonsoft.json\\13.0.3\\newtonsoft.json.13.0.3.nupkg.sha512", + "C:\\Users\\huangxianguo\\.nuget\\packages\\system.codedom\\8.0.0\\system.codedom.8.0.0.nupkg.sha512", + "C:\\Users\\huangxianguo\\.nuget\\packages\\system.management\\8.0.0\\system.management.8.0.0.nupkg.sha512" + ], + "logs": [] +} \ No newline at end of file diff --git a/MasstransferCommon/obj/project.packagespec.json b/MasstransferCommon/obj/project.packagespec.json new file mode 100644 index 0000000..5c62264 --- /dev/null +++ b/MasstransferCommon/obj/project.packagespec.json @@ -0,0 +1 @@ +"restore":{"projectUniqueName":"C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommon\\MasstransferCommon.csproj","projectName":"MasstransferCommon","projectPath":"C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommon\\MasstransferCommon.csproj","outputPath":"C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommon\\obj\\","projectStyle":"PackageReference","originalTargetFrameworks":["net7.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net7.0":{"targetAlias":"net7.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net7.0":{"targetAlias":"net7.0","dependencies":{"Newtonsoft.Json":{"target":"Package","version":"[13.0.3, )"},"System.Management":{"target":"Package","version":"[8.0.0, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\7.0.407\\RuntimeIdentifierGraph.json"}} \ No newline at end of file diff --git a/MasstransferCommon/obj/rider.project.model.nuget.info b/MasstransferCommon/obj/rider.project.model.nuget.info new file mode 100644 index 0000000..7282d8a --- /dev/null +++ b/MasstransferCommon/obj/rider.project.model.nuget.info @@ -0,0 +1 @@ +17173821281053621 \ No newline at end of file diff --git a/MasstransferCommon/obj/rider.project.restore.info b/MasstransferCommon/obj/rider.project.restore.info new file mode 100644 index 0000000..a10ece8 --- /dev/null +++ b/MasstransferCommon/obj/rider.project.restore.info @@ -0,0 +1 @@ +17173822294577400 \ No newline at end of file diff --git a/MasstransferCommunicate/MasstransferCommunicate.csproj b/MasstransferCommunicate/MasstransferCommunicate.csproj new file mode 100644 index 0000000..d274234 --- /dev/null +++ b/MasstransferCommunicate/MasstransferCommunicate.csproj @@ -0,0 +1,24 @@ + + + + net7.0 + enable + enable + preview + + + + + + + + + + + + + + + + + diff --git a/MasstransferCommunicate/Mqtt/Client/MessageQueueHelper.cs b/MasstransferCommunicate/Mqtt/Client/MessageQueueHelper.cs new file mode 100644 index 0000000..9f42de8 --- /dev/null +++ b/MasstransferCommunicate/Mqtt/Client/MessageQueueHelper.cs @@ -0,0 +1,96 @@ +using MasstransferCommon.Utils; +using MasstransferInfrastructure.Mqtt.Model; +using MQTTnet; +using MQTTnet.Client; +using MQTTnet.Protocol; +using Serilog; + +namespace MasstransferInfrastructure.Mqtt.Client; + +public class MessageQueueHelper +{ + private static readonly Dictionary>> Subscribers = new(); + + // ReSharper disable once StaticMemberInGenericType + private static readonly MqttClient Client = new(); + + + /// + /// 初始化连接 + /// + /// + public static async Task InitConnect(MqttConnectOptions options) + { + try + { + if (!await Client.ConnectAsync(options)) return false; + // 连接成功后监听消息 + Client.MessageReceived += HandleMessageReceived; + return true; + } + catch (Exception e) + { + Log.Error(e, "连接MQTT服务器失败"); + return false; + } + } + + /// + /// 订阅某个主题 + /// + /// + /// + /// + public static async Task Subscribe(string topic, Action @delegate, + MqttQualityOfServiceLevel qos = MqttQualityOfServiceLevel.AtMostOnce) + { + if (!Subscribers.ContainsKey(topic)) + { + Subscribers.Add(topic, []); + } + + Subscribers[topic].Add(@delegate); + + return await Client.Subscribe(topic, qos); + } + + /// + /// 发送消息 + /// + /// + /// + /// + public static async Task Publish(string topic, object message, + MqttQualityOfServiceLevel qos = MqttQualityOfServiceLevel.AtMostOnce) + { + return await Client.Publish(topic, message, qos); + } + + /// + /// 处理接收到的消息 + /// + /// + /// + /// + private static void HandleMessageReceived(object? sender, MqttApplicationMessageReceivedEventArgs e) + { + var applicationMessage = e.ApplicationMessage; + var topic = applicationMessage.Topic; + var message = applicationMessage.ConvertPayloadToString(); + + if (!Subscribers.TryGetValue(topic, out var subscribers)) return; + + foreach (var subscriber in subscribers) + { + try + { + // 通知订阅者 + subscriber(topic, JsonUtil.FromJson(message)); + } + catch (Exception exception) + { + Log.Error(exception, "订阅主题 {Topic} 时发生错误", topic); + } + } + } +} \ No newline at end of file diff --git a/MasstransferCommunicate/Mqtt/Client/MqttClient.cs b/MasstransferCommunicate/Mqtt/Client/MqttClient.cs new file mode 100644 index 0000000..fb915a3 --- /dev/null +++ b/MasstransferCommunicate/Mqtt/Client/MqttClient.cs @@ -0,0 +1,153 @@ +using System.Security.Cryptography.X509Certificates; +using MasstransferCommon.Utils; +using MasstransferInfrastructure.Mqtt.Model; +using MasstransferSecurity.Utils; +using MQTTnet; +using MQTTnet.Client; +using MQTTnet.Protocol; + +namespace MasstransferInfrastructure.Mqtt.Client; + +class MqttClient +{ + private IMqttClient? _client; + + public event EventHandler MessageReceived; + + public bool IsConnected => _client is { IsConnected: true }; + + /// + /// 获取连接参数 + /// + /// + /// + private MqttClientOptions GetConnectionOptions(MqttConnectOptions options) + { + var clientId = DeviceInfoUtil.GenerateUniqueID(); + + var caCert = GetCertificate(options.CaCert); + var clientCert = GetCertificate(options.ClientCert); + + var chain = new X509Certificate2Collection(new[] { caCert, clientCert }); + + return new MqttClientOptionsBuilder() + .WithTcpServer(options.ServerAddress, options.Port) + .WithCredentials(options.UserName, options.Password) + .WithClientId(clientId) + .WithCleanSession() + .WithTlsOptions( + o => + { + o.UseTls(options.EnableTls); + o.WithSslProtocols(options.Protocols); + o.WithTrustChain(chain); + } + ) + .Build(); + } + + private X509Certificate2 GetCertificate(string certBase64) + { + var certBytes = Convert.FromBase64String(certBase64); + return new X509Certificate2(certBytes); + } + + /// + /// 连接MQTT + /// + /// + public async Task ConnectAsync(MqttConnectOptions options) + { + var optionsBuilder = GetConnectionOptions(options); + var client = new MqttFactory().CreateMqttClient(); + var connectResult = await client.ConnectAsync(optionsBuilder); + if (!connectResult.IsSessionPresent) + { + return false; + } + + client.ApplicationMessageReceivedAsync += (e) => + { + MessageReceived?.Invoke(client, e); + return Task.CompletedTask; + }; + + _client = client; + + return true; + } + + /// + /// 断开连接 + /// + public async Task DisconnectAsync() + { + if (_client is { IsConnected: true }) + { + return; + } + + await _client.DisconnectAsync(); + _client = null; + } + + /// + /// 发送消息 + /// + /// + /// + /// + /// + public async Task Publish(string topic, object message, + MqttQualityOfServiceLevel qos) + { + if (_client is not { IsConnected: true }) + { + return false; + } + + var payload = message as string ?? JsonUtil.ToJson(message); + + await _client.PublishAsync(new MqttApplicationMessageBuilder() + .WithTopic(topic) + .WithPayload(payload) + .WithQualityOfServiceLevel(qos) + .Build()); + return true; + } + + /// + /// 订阅主题 + /// + /// + /// + /// + public async Task Subscribe(string topic, + MqttQualityOfServiceLevel qos) + { + if (_client is not { IsConnected: true }) + { + return false; + } + + await _client.SubscribeAsync(new MqttTopicFilterBuilder().WithTopic(topic).WithQualityOfServiceLevel(qos) + .Build()); + return true; + } + + /// + /// 取消订阅主题 + /// + /// + /// + public async Task Unsubscribe(string topic) + { + if (_client is not { IsConnected: true }) + { + return false; + } + + await _client.UnsubscribeAsync(topic); + return true; + } +} \ No newline at end of file diff --git a/MasstransferCommunicate/Mqtt/Model/Message.cs b/MasstransferCommunicate/Mqtt/Model/Message.cs new file mode 100644 index 0000000..93ecb04 --- /dev/null +++ b/MasstransferCommunicate/Mqtt/Model/Message.cs @@ -0,0 +1,8 @@ +namespace MasstransferInfrastructure.Mqtt.Model; + +public class Message +{ + public string Topic { get; set; } + + public string Payload { get; set; } +} \ No newline at end of file diff --git a/MasstransferCommunicate/Mqtt/Model/MqttConnectOptions.cs b/MasstransferCommunicate/Mqtt/Model/MqttConnectOptions.cs new file mode 100644 index 0000000..c701464 --- /dev/null +++ b/MasstransferCommunicate/Mqtt/Model/MqttConnectOptions.cs @@ -0,0 +1,25 @@ +using System.Security.Authentication; + +namespace MasstransferInfrastructure.Mqtt.Model; + +/// +/// Mqtt 连接参数 +/// +public class MqttConnectOptions +{ + public string ServerAddress { get; set; } + + public int Port { get; set; } + + public string UserName { get; set; } + + public string Password { get; set; } + + public bool EnableTls { get; set; } + + public SslProtocols Protocols { get; set; } + + public string CaCert { get; set; } + + public string ClientCert { get; set; } +} \ No newline at end of file diff --git a/MasstransferCommunicate/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs b/MasstransferCommunicate/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs new file mode 100644 index 0000000..4257f4b --- /dev/null +++ b/MasstransferCommunicate/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")] diff --git a/MasstransferCommunicate/obj/Debug/net7.0/MasstransferCommunicate.AssemblyInfo.cs b/MasstransferCommunicate/obj/Debug/net7.0/MasstransferCommunicate.AssemblyInfo.cs new file mode 100644 index 0000000..aadb4ff --- /dev/null +++ b/MasstransferCommunicate/obj/Debug/net7.0/MasstransferCommunicate.AssemblyInfo.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("MasstransferCommunicate")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyProductAttribute("MasstransferCommunicate")] +[assembly: System.Reflection.AssemblyTitleAttribute("MasstransferCommunicate")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// 由 MSBuild WriteCodeFragment 类生成。 + diff --git a/MasstransferCommunicate/obj/Debug/net7.0/MasstransferCommunicate.AssemblyInfoInputs.cache b/MasstransferCommunicate/obj/Debug/net7.0/MasstransferCommunicate.AssemblyInfoInputs.cache new file mode 100644 index 0000000..b213e55 --- /dev/null +++ b/MasstransferCommunicate/obj/Debug/net7.0/MasstransferCommunicate.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +c621dbd9f14cea322f52ce3b44077fee0bdfab83 diff --git a/MasstransferCommunicate/obj/Debug/net7.0/MasstransferCommunicate.GeneratedMSBuildEditorConfig.editorconfig b/MasstransferCommunicate/obj/Debug/net7.0/MasstransferCommunicate.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..c2cc3bc --- /dev/null +++ b/MasstransferCommunicate/obj/Debug/net7.0/MasstransferCommunicate.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,11 @@ +is_global = true +build_property.TargetFramework = net7.0 +build_property.TargetPlatformMinVersion = +build_property.UsingMicrosoftNETSdkWeb = +build_property.ProjectTypeGuids = +build_property.InvariantGlobalization = +build_property.PlatformNeutralAssembly = +build_property.EnforceExtendedAnalyzerRules = +build_property._SupportedPlatformList = Linux,macOS,Windows +build_property.RootNamespace = MasstransferCommunicate +build_property.ProjectDir = C:\workspace\code_repos\haiju\MasstransferExporter\MasstransferCommunicate\ diff --git a/MasstransferCommunicate/obj/Debug/net7.0/MasstransferCommunicate.GlobalUsings.g.cs b/MasstransferCommunicate/obj/Debug/net7.0/MasstransferCommunicate.GlobalUsings.g.cs new file mode 100644 index 0000000..8578f3d --- /dev/null +++ b/MasstransferCommunicate/obj/Debug/net7.0/MasstransferCommunicate.GlobalUsings.g.cs @@ -0,0 +1,8 @@ +// +global using global::System; +global using global::System.Collections.Generic; +global using global::System.IO; +global using global::System.Linq; +global using global::System.Net.Http; +global using global::System.Threading; +global using global::System.Threading.Tasks; diff --git a/MasstransferCommunicate/obj/Debug/net7.0/MasstransferCommunicate.assets.cache b/MasstransferCommunicate/obj/Debug/net7.0/MasstransferCommunicate.assets.cache new file mode 100644 index 0000000000000000000000000000000000000000..bbccf4b7d0e60a4ad000338d7158815681fa5f9f GIT binary patch literal 3085 zcmcImTTc@~6h>(&7XfMIB7&kKUJ|!p6^U{QtpZ9-H%&&e=>qoD@{dn{4UOY6{7pfth)Lnm&2=~n`WoC_bEJ21N1)v z5ZCi?T(&rnj_o=-QhDh*wmO$mW|frBHxItG+Kd&<;JjVnA>J53yxqV`I9^!6Fr5O< zI13K%ctn@2e&94@MWX2ih^7yC7LumoN?|E^M;E$dsSBKqjG3)|U&8maV{uaQFOl{G zL^=Sx_%BjRv*Aul*z&Kut0z-9^&qG?^;!H68sz4f7Y_7&u)$R%i+T2>_ksG;l4!^i z)f6Eqk;lD_leH)$z9E3ZEe=q)C4h6lFfam)0%JhG$BX4~u)mT#Nh`^dK`YNgPP@;9 zGc;x%$9hZi>d-Rj{4{u8wJo0*AJ3;&i#fSZ6nZsBEMt-LJcMzx#C=zfJtaPd<#L55@Z){0C2 zh9-A2wzq5q9YM0%@FZEo(^%oUs_n`}Z#MdeWJ3+41Nt>EdR&YAt!XlAHX4d!^te@+ zWNOqGPujP+cuqCXueWt%O|wMIJAESKW~`!Vln$a)rCSIAtYC}LhH^(;BX%3~+5nGp$<;%VVZ!`396m@RLU zf_= + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\huangxianguo\.nuget\packages\ + PackageReference + 6.9.1 + + + + + \ No newline at end of file diff --git a/MasstransferCommunicate/obj/MasstransferCommunicate.csproj.nuget.g.targets b/MasstransferCommunicate/obj/MasstransferCommunicate.csproj.nuget.g.targets new file mode 100644 index 0000000..3dc06ef --- /dev/null +++ b/MasstransferCommunicate/obj/MasstransferCommunicate.csproj.nuget.g.targets @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/MasstransferCommunicate/obj/project.assets.json b/MasstransferCommunicate/obj/project.assets.json new file mode 100644 index 0000000..cbd730b --- /dev/null +++ b/MasstransferCommunicate/obj/project.assets.json @@ -0,0 +1,335 @@ +{ + "version": 3, + "targets": { + "net7.0": { + "MQTTnet/4.3.6.1152": { + "type": "package", + "compile": { + "lib/net7.0/MQTTnet.dll": { + "related": ".xml" + } + }, + "runtime": { + "lib/net7.0/MQTTnet.dll": { + "related": ".xml" + } + } + }, + "Newtonsoft.Json/13.0.3": { + "type": "package", + "compile": { + "lib/net6.0/Newtonsoft.Json.dll": { + "related": ".xml" + } + }, + "runtime": { + "lib/net6.0/Newtonsoft.Json.dll": { + "related": ".xml" + } + } + }, + "Serilog/4.0.0": { + "type": "package", + "compile": { + "lib/net6.0/Serilog.dll": { + "related": ".xml" + } + }, + "runtime": { + "lib/net6.0/Serilog.dll": { + "related": ".xml" + } + } + }, + "System.CodeDom/8.0.0": { + "type": "package", + "compile": { + "lib/net7.0/System.CodeDom.dll": { + "related": ".xml" + } + }, + "runtime": { + "lib/net7.0/System.CodeDom.dll": { + "related": ".xml" + } + }, + "build": { + "buildTransitive/net6.0/_._": {} + } + }, + "System.Management/8.0.0": { + "type": "package", + "dependencies": { + "System.CodeDom": "8.0.0" + }, + "compile": { + "lib/net7.0/System.Management.dll": { + "related": ".xml" + } + }, + "runtime": { + "lib/net7.0/System.Management.dll": { + "related": ".xml" + } + }, + "build": { + "buildTransitive/net6.0/_._": {} + }, + "runtimeTargets": { + "runtimes/win/lib/net7.0/System.Management.dll": { + "assetType": "runtime", + "rid": "win" + } + } + }, + "MasstransferCommon/1.0.0": { + "type": "project", + "framework": ".NETCoreApp,Version=v7.0", + "dependencies": { + "Newtonsoft.Json": "13.0.3", + "System.Management": "8.0.0" + }, + "compile": { + "bin/placeholder/MasstransferCommon.dll": {} + }, + "runtime": { + "bin/placeholder/MasstransferCommon.dll": {} + } + } + } + }, + "libraries": { + "MQTTnet/4.3.6.1152": { + "sha512": "XBgqx60FIWiBqTiLNF40EIhENLrLDzE3I9ujzZ7343QCeAWTHP70fO0mN6LeElSfubzfRSugLpPnd0cZiccUOw==", + "type": "package", + "path": "mqttnet/4.3.6.1152", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/net452/MQTTnet.dll", + "lib/net452/MQTTnet.xml", + "lib/net461/MQTTnet.dll", + "lib/net461/MQTTnet.xml", + "lib/net48/MQTTnet.dll", + "lib/net48/MQTTnet.xml", + "lib/net5.0/MQTTnet.dll", + "lib/net5.0/MQTTnet.xml", + "lib/net6.0/MQTTnet.dll", + "lib/net6.0/MQTTnet.xml", + "lib/net7.0/MQTTnet.dll", + "lib/net7.0/MQTTnet.xml", + "lib/netcoreapp3.1/MQTTnet.dll", + "lib/netcoreapp3.1/MQTTnet.xml", + "lib/netstandard1.3/MQTTnet.dll", + "lib/netstandard1.3/MQTTnet.xml", + "lib/netstandard2.0/MQTTnet.dll", + "lib/netstandard2.0/MQTTnet.xml", + "lib/netstandard2.1/MQTTnet.dll", + "lib/netstandard2.1/MQTTnet.xml", + "lib/uap10.0.10240/MQTTnet.dll", + "lib/uap10.0.10240/MQTTnet.pri", + "lib/uap10.0.10240/MQTTnet.xml", + "mqttnet.4.3.6.1152.nupkg.sha512", + "mqttnet.nuspec", + "nuget.png" + ] + }, + "Newtonsoft.Json/13.0.3": { + "sha512": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==", + "type": "package", + "path": "newtonsoft.json/13.0.3", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.md", + "README.md", + "lib/net20/Newtonsoft.Json.dll", + "lib/net20/Newtonsoft.Json.xml", + "lib/net35/Newtonsoft.Json.dll", + "lib/net35/Newtonsoft.Json.xml", + "lib/net40/Newtonsoft.Json.dll", + "lib/net40/Newtonsoft.Json.xml", + "lib/net45/Newtonsoft.Json.dll", + "lib/net45/Newtonsoft.Json.xml", + "lib/net6.0/Newtonsoft.Json.dll", + "lib/net6.0/Newtonsoft.Json.xml", + "lib/netstandard1.0/Newtonsoft.Json.dll", + "lib/netstandard1.0/Newtonsoft.Json.xml", + "lib/netstandard1.3/Newtonsoft.Json.dll", + "lib/netstandard1.3/Newtonsoft.Json.xml", + "lib/netstandard2.0/Newtonsoft.Json.dll", + "lib/netstandard2.0/Newtonsoft.Json.xml", + "newtonsoft.json.13.0.3.nupkg.sha512", + "newtonsoft.json.nuspec", + "packageIcon.png" + ] + }, + "Serilog/4.0.0": { + "sha512": "2jDkUrSh5EofOp7Lx5Zgy0EB+7hXjjxE2ktTb1WVQmU00lDACR2TdROGKU0K1pDTBSJBN1PqgYpgOZF8mL7NJw==", + "type": "package", + "path": "serilog/4.0.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "README.md", + "icon.png", + "lib/net462/Serilog.dll", + "lib/net462/Serilog.xml", + "lib/net471/Serilog.dll", + "lib/net471/Serilog.xml", + "lib/net6.0/Serilog.dll", + "lib/net6.0/Serilog.xml", + "lib/net8.0/Serilog.dll", + "lib/net8.0/Serilog.xml", + "lib/netstandard2.0/Serilog.dll", + "lib/netstandard2.0/Serilog.xml", + "serilog.4.0.0.nupkg.sha512", + "serilog.nuspec" + ] + }, + "System.CodeDom/8.0.0": { + "sha512": "WTlRjL6KWIMr/pAaq3rYqh0TJlzpouaQ/W1eelssHgtlwHAH25jXTkUphTYx9HaIIf7XA6qs/0+YhtLEQRkJ+Q==", + "type": "package", + "path": "system.codedom/8.0.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "Icon.png", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "buildTransitive/net461/System.CodeDom.targets", + "buildTransitive/net462/_._", + "buildTransitive/net6.0/_._", + "buildTransitive/netcoreapp2.0/System.CodeDom.targets", + "lib/net462/System.CodeDom.dll", + "lib/net462/System.CodeDom.xml", + "lib/net6.0/System.CodeDom.dll", + "lib/net6.0/System.CodeDom.xml", + "lib/net7.0/System.CodeDom.dll", + "lib/net7.0/System.CodeDom.xml", + "lib/net8.0/System.CodeDom.dll", + "lib/net8.0/System.CodeDom.xml", + "lib/netstandard2.0/System.CodeDom.dll", + "lib/netstandard2.0/System.CodeDom.xml", + "system.codedom.8.0.0.nupkg.sha512", + "system.codedom.nuspec", + "useSharedDesignerContext.txt" + ] + }, + "System.Management/8.0.0": { + "sha512": "jrK22i5LRzxZCfGb+tGmke2VH7oE0DvcDlJ1HAKYU8cPmD8XnpUT0bYn2Gy98GEhGjtfbR/sxKTVb+dE770pfA==", + "type": "package", + "path": "system.management/8.0.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "Icon.png", + "LICENSE.TXT", + "PACKAGE.md", + "THIRD-PARTY-NOTICES.TXT", + "buildTransitive/net6.0/_._", + "buildTransitive/netcoreapp2.0/System.Management.targets", + "lib/net462/_._", + "lib/net6.0/System.Management.dll", + "lib/net6.0/System.Management.xml", + "lib/net7.0/System.Management.dll", + "lib/net7.0/System.Management.xml", + "lib/net8.0/System.Management.dll", + "lib/net8.0/System.Management.xml", + "lib/netstandard2.0/System.Management.dll", + "lib/netstandard2.0/System.Management.xml", + "runtimes/win/lib/net6.0/System.Management.dll", + "runtimes/win/lib/net6.0/System.Management.xml", + "runtimes/win/lib/net7.0/System.Management.dll", + "runtimes/win/lib/net7.0/System.Management.xml", + "runtimes/win/lib/net8.0/System.Management.dll", + "runtimes/win/lib/net8.0/System.Management.xml", + "system.management.8.0.0.nupkg.sha512", + "system.management.nuspec", + "useSharedDesignerContext.txt" + ] + }, + "MasstransferCommon/1.0.0": { + "type": "project", + "path": "../MasstransferCommon/MasstransferCommon.csproj", + "msbuildProject": "../MasstransferCommon/MasstransferCommon.csproj" + } + }, + "projectFileDependencyGroups": { + "net7.0": [ + "MQTTnet >= 4.3.6.1152", + "MasstransferCommon >= 1.0.0", + "Serilog >= 4.0.0" + ] + }, + "packageFolders": { + "C:\\Users\\huangxianguo\\.nuget\\packages\\": {} + }, + "project": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommunicate\\MasstransferCommunicate.csproj", + "projectName": "MasstransferCommunicate", + "projectPath": "C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommunicate\\MasstransferCommunicate.csproj", + "packagesPath": "C:\\Users\\huangxianguo\\.nuget\\packages\\", + "outputPath": "C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommunicate\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\huangxianguo\\AppData\\Roaming\\NuGet\\NuGet.Config" + ], + "originalTargetFrameworks": [ + "net7.0" + ], + "sources": { + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net7.0": { + "targetAlias": "net7.0", + "projectReferences": { + "C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommon\\MasstransferCommon.csproj": { + "projectPath": "C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommon\\MasstransferCommon.csproj" + } + } + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net7.0": { + "targetAlias": "net7.0", + "dependencies": { + "MQTTnet": { + "target": "Package", + "version": "[4.3.6.1152, )" + }, + "Serilog": { + "target": "Package", + "version": "[4.0.0, )" + } + }, + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.407\\RuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/MasstransferCommunicate/obj/project.nuget.cache b/MasstransferCommunicate/obj/project.nuget.cache new file mode 100644 index 0000000..67aaadf --- /dev/null +++ b/MasstransferCommunicate/obj/project.nuget.cache @@ -0,0 +1,14 @@ +{ + "version": 2, + "dgSpecHash": "myny0oToHxs0CsvNk62qq18WZteUByxnUHWESOWjVjvWG7USy6Jp9OIbP0CdeGvRiG54WXV8n6tKvd5Mb9GFyw==", + "success": true, + "projectFilePath": "C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommunicate\\MasstransferCommunicate.csproj", + "expectedPackageFiles": [ + "C:\\Users\\huangxianguo\\.nuget\\packages\\mqttnet\\4.3.6.1152\\mqttnet.4.3.6.1152.nupkg.sha512", + "C:\\Users\\huangxianguo\\.nuget\\packages\\newtonsoft.json\\13.0.3\\newtonsoft.json.13.0.3.nupkg.sha512", + "C:\\Users\\huangxianguo\\.nuget\\packages\\serilog\\4.0.0\\serilog.4.0.0.nupkg.sha512", + "C:\\Users\\huangxianguo\\.nuget\\packages\\system.codedom\\8.0.0\\system.codedom.8.0.0.nupkg.sha512", + "C:\\Users\\huangxianguo\\.nuget\\packages\\system.management\\8.0.0\\system.management.8.0.0.nupkg.sha512" + ], + "logs": [] +} \ No newline at end of file diff --git a/MasstransferCommunicate/obj/project.packagespec.json b/MasstransferCommunicate/obj/project.packagespec.json new file mode 100644 index 0000000..9d5b0ed --- /dev/null +++ b/MasstransferCommunicate/obj/project.packagespec.json @@ -0,0 +1 @@ +"restore":{"projectUniqueName":"C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommunicate\\MasstransferCommunicate.csproj","projectName":"MasstransferCommunicate","projectPath":"C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommunicate\\MasstransferCommunicate.csproj","outputPath":"C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommunicate\\obj\\","projectStyle":"PackageReference","originalTargetFrameworks":["net7.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net7.0":{"targetAlias":"net7.0","projectReferences":{"C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommon\\MasstransferCommon.csproj":{"projectPath":"C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommon\\MasstransferCommon.csproj"}}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net7.0":{"targetAlias":"net7.0","dependencies":{"MQTTnet":{"target":"Package","version":"[4.3.6.1152, )"},"Serilog":{"target":"Package","version":"[4.0.0, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\7.0.407\\RuntimeIdentifierGraph.json"}} \ No newline at end of file diff --git a/MasstransferCommunicate/obj/rider.project.restore.info b/MasstransferCommunicate/obj/rider.project.restore.info new file mode 100644 index 0000000..c50905b --- /dev/null +++ b/MasstransferCommunicate/obj/rider.project.restore.info @@ -0,0 +1 @@ +17173822294614410 \ No newline at end of file diff --git a/MasstransferExporter.sln b/MasstransferExporter.sln index c1d0283..0f685e4 100644 --- a/MasstransferExporter.sln +++ b/MasstransferExporter.sln @@ -2,6 +2,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MasstransferExporter", "MasstransferExporter\MasstransferExporter.csproj", "{4675176C-487E-4D48-B904-C854D8501954}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MasstransferCommunicate", "MasstransferCommunicate\MasstransferCommunicate.csproj", "{D790D484-1314-4476-93EC-4151F9A6E762}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MasstransferCommon", "MasstransferCommon\MasstransferCommon.csproj", "{66C6D73C-BADB-4E28-9C83-E701B019626D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -12,5 +16,13 @@ Global {4675176C-487E-4D48-B904-C854D8501954}.Debug|Any CPU.Build.0 = Debug|Any CPU {4675176C-487E-4D48-B904-C854D8501954}.Release|Any CPU.ActiveCfg = Release|Any CPU {4675176C-487E-4D48-B904-C854D8501954}.Release|Any CPU.Build.0 = Release|Any CPU + {D790D484-1314-4476-93EC-4151F9A6E762}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D790D484-1314-4476-93EC-4151F9A6E762}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D790D484-1314-4476-93EC-4151F9A6E762}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D790D484-1314-4476-93EC-4151F9A6E762}.Release|Any CPU.Build.0 = Release|Any CPU + {66C6D73C-BADB-4E28-9C83-E701B019626D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {66C6D73C-BADB-4E28-9C83-E701B019626D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {66C6D73C-BADB-4E28-9C83-E701B019626D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {66C6D73C-BADB-4E28-9C83-E701B019626D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/MasstransferExporter/obj/rider.project.restore.info b/MasstransferExporter/obj/rider.project.restore.info index 99674da..e5b1da3 100644 --- a/MasstransferExporter/obj/rider.project.restore.info +++ b/MasstransferExporter/obj/rider.project.restore.info @@ -1 +1 @@ -17173810876283690 \ No newline at end of file +17173822294380307 \ No newline at end of file diff --git a/global.json b/global.json new file mode 100644 index 0000000..7cd6a1f --- /dev/null +++ b/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "7.0.0", + "rollForward": "latestMajor", + "allowPrerelease": true + } +} \ No newline at end of file