添加采集应用程序仓库

This commit is contained in:
huangxianguo 2024-06-03 16:35:49 +08:00
parent d53431bca3
commit c5ae08e8c5
45 changed files with 1564 additions and 2 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
.idea
**/bin
**/obj
global.json

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Management" Version="8.0.0" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,39 @@
namespace MasstransferCommon.Utils;
/// <summary>
/// bean 工具类
/// </summary>
public class BeanUtil
{
/// <summary>
/// 实现Bean的属性复制
/// </summary>
/// <param name="source"></param>
/// <param name="target"></param>
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<T>(object source)
{
var instance = Activator.CreateInstance<T>();
CopyProperties(source, instance);
return instance;
}
public static List<T> CopyProperties<T>(IEnumerable<object> source)
{
return source.Select(CopyProperties<T>).ToList();
}
}

View File

@ -0,0 +1,90 @@
using System.Management;
using System.Security.Cryptography;
using System.Text;
namespace MasstransferSecurity.Utils;
/// <summary>
/// 设备信息工具类方法
/// </summary>
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();
}
}

View File

@ -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<T>(string json)
{
try
{
return JsonConvert.DeserializeObject<T>(json);
}
catch (Exception e)
{
throw new ArgumentException($" 无效的json 字符串 {json} ");
}
}
public static T FromJsonOrDefault<T>(string json)
{
try
{
return JsonConvert.DeserializeObject<T>(json);
}
catch (Exception e)
{
return default;
}
}
}

View File

@ -0,0 +1,24 @@
using System.Security.Cryptography;
using System.Text;
namespace MasstransferCommon.Utils;
/// <summary>
/// MD5 加密工具类
/// </summary>
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();
}
}

View File

@ -0,0 +1,32 @@
namespace MasstransferCommon.Utils;
using Microsoft.Win32;
/// <summary>
/// 注册表工具类
/// </summary>
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);
}
}

View File

@ -0,0 +1,63 @@
using System.Text;
namespace MasstransferCommon.Utils;
public class TimeUtil
{
public static void Sleep(int milliseconds)
{
Thread.Sleep(milliseconds);
}
/// <summary>
/// 获取当前的时间戳
/// </summary>
/// <returns></returns>
public static long Now()
{
return new DateTimeOffset(DateTime.UtcNow).ToUnixTimeMilliseconds();
}
/// <summary>
/// 格式化时间
/// </summary>
/// <param name="time"></param>
/// <param name="format"></param>
/// <returns></returns>
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();
}
}

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")]

View File

@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
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 类生成。

View File

@ -0,0 +1 @@
55253de7166d1dd8e0b57bd70c6516d44d5416d0

View File

@ -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\

View File

@ -0,0 +1,8 @@
// <auto-generated/>
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;

View File

@ -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"
}
}
}
}
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\huangxianguo\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.9.1</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\huangxianguo\.nuget\packages\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View File

@ -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"
}
}
}
}

View File

@ -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": []
}

View File

@ -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"}}

View File

@ -0,0 +1 @@
17173821281053621

View File

@ -0,0 +1 @@
17173822294577400

View File

@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
</PropertyGroup>
<ItemGroup>
<Folder Include="Http\" />
<Folder Include="Mqtt\Service\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MQTTnet" Version="4.3.6.1152" />
<PackageReference Include="Serilog" Version="4.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MasstransferCommon\MasstransferCommon.csproj" />
</ItemGroup>
</Project>

View File

@ -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<T>
{
private static readonly Dictionary<string, List<Action<string, T>>> Subscribers = new();
// ReSharper disable once StaticMemberInGenericType
private static readonly MqttClient Client = new();
/// <summary>
/// 初始化连接
/// </summary>
/// <param name="options"></param>
public static async Task<bool> 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;
}
}
/// <summary>
/// 订阅某个主题
/// </summary>
/// <param name="topic"></param>
/// <param name="delegate"></param>
/// <param name="qos"></param>
public static async Task<bool> Subscribe(string topic, Action<string, T> @delegate,
MqttQualityOfServiceLevel qos = MqttQualityOfServiceLevel.AtMostOnce)
{
if (!Subscribers.ContainsKey(topic))
{
Subscribers.Add(topic, []);
}
Subscribers[topic].Add(@delegate);
return await Client.Subscribe(topic, qos);
}
/// <summary>
/// 发送消息
/// </summary>
/// <param name="topic"></param>
/// <param name="message"></param>
/// <param name="qos"></param>
public static async Task<bool> Publish(string topic, object message,
MqttQualityOfServiceLevel qos = MqttQualityOfServiceLevel.AtMostOnce)
{
return await Client.Publish(topic, message, qos);
}
/// <summary>
/// 处理接收到的消息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <returns></returns>
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<T>(message));
}
catch (Exception exception)
{
Log.Error(exception, "订阅主题 {Topic} 时发生错误", topic);
}
}
}
}

View File

@ -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<MqttApplicationMessageReceivedEventArgs> MessageReceived;
public bool IsConnected => _client is { IsConnected: true };
/// <summary>
/// 获取连接参数
/// </summary>
/// <param name="options"></param>
/// <returns></returns>
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);
}
/// <summary>
/// 连接MQTT
/// </summary>
/// <param name="options"></param>
public async Task<bool> 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;
}
/// <summary>
/// 断开连接
/// </summary>
public async Task DisconnectAsync()
{
if (_client is { IsConnected: true })
{
return;
}
await _client.DisconnectAsync();
_client = null;
}
/// <summary>
/// 发送消息
/// </summary>
/// <param name="topic"></param>
/// <param name="message"></param>
/// <param name="qos"></param>
/// <returns></returns>
public async Task<bool> 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;
}
/// <summary>
/// 订阅主题
/// </summary>
/// <param name="topic"></param>
/// <param name="qos"></param>
/// <returns></returns>
public async Task<bool> 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;
}
/// <summary>
/// 取消订阅主题
/// </summary>
/// <param name="topic"></param>
/// <returns></returns>
public async Task<bool> Unsubscribe(string topic)
{
if (_client is not { IsConnected: true })
{
return false;
}
await _client.UnsubscribeAsync(topic);
return true;
}
}

View File

@ -0,0 +1,8 @@
namespace MasstransferInfrastructure.Mqtt.Model;
public class Message
{
public string Topic { get; set; }
public string Payload { get; set; }
}

View File

@ -0,0 +1,25 @@
using System.Security.Authentication;
namespace MasstransferInfrastructure.Mqtt.Model;
/// <summary>
/// Mqtt 连接参数
/// </summary>
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; }
}

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")]

View File

@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
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 类生成。

View File

@ -0,0 +1 @@
c621dbd9f14cea322f52ce3b44077fee0bdfab83

View File

@ -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\

View File

@ -0,0 +1,8 @@
// <auto-generated/>
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;

View File

@ -0,0 +1,138 @@
{
"format": 1,
"restore": {
"C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommunicate\\MasstransferCommunicate.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"
}
}
},
"C:\\workspace\\code_repos\\haiju\\MasstransferExporter\\MasstransferCommunicate\\MasstransferCommunicate.csproj": {
"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"
}
}
}
}
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\huangxianguo\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.9.1</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\huangxianguo\.nuget\packages\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View File

@ -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"
}
}
}
}

View File

@ -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": []
}

View File

@ -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"}}

View File

@ -0,0 +1 @@
17173822294614410

View File

@ -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

View File

@ -1 +1 @@
17173810876283690
17173822294380307

7
global.json Normal file
View File

@ -0,0 +1,7 @@
{
"sdk": {
"version": "7.0.0",
"rollForward": "latestMajor",
"allowPrerelease": true
}
}