Compare commits

..

15 Commits

Author SHA1 Message Date
Kimdiego2098
ac3525a953 更新版本 2024-02-02 15:15:32 +08:00
Kimdiego2098
c8c3f5b134 更新构建脚本 2024-02-02 15:14:37 +08:00
Kimdiego2098
51319c0718 mqttClient每次发布都作为遗嘱消息 2024-02-02 14:38:24 +08:00
Kimdiego2098
43399b8b47 mqttClient连接失败时缓存数据 2024-02-02 14:36:49 +08:00
Kimdiego2098
a6596042b7 修复上传业务缓存删除逻辑 2024-02-02 14:26:00 +08:00
Kimdiego2098
23ae85fc9c Revert "修复上传业务缓存删除逻辑"
This reverts commit 2da54862f1.
2024-02-02 14:25:21 +08:00
Kimdiego2098
2da54862f1 修复上传业务缓存删除逻辑 2024-02-02 14:24:49 +08:00
Kimdiego2098
f272fb0559 更新版本 2024-02-02 13:00:04 +08:00
Kimdiego2098
bd04e33586 底层通道设备列表更换为线程安全列表 2024-02-02 12:29:19 +08:00
Kimdiego2098
b09b9752ca mqttServer修复客户端连接时,发送初始数据分组错误 2024-02-02 12:16:43 +08:00
Kimdiego2098
a810a48158 更新dockerfile 2024-02-02 08:40:10 +08:00
Kimdiego2098
b4f5792aa8 串口流BeginRead更换为ReadAsync 2024-02-01 16:50:01 +08:00
Kimdiego2098
fdf0330b4f 更新版本 2024-02-01 12:20:11 +08:00
Kimdiego2098
ca73743082 调整服务启动顺序 2024-02-01 12:19:44 +08:00
Kimdiego2098
df0cde2cfd 定长字符串写入时,长度不足也覆盖剩余字节 2024-01-30 17:37:44 +08:00
36 changed files with 216 additions and 125 deletions

View File

@@ -6,7 +6,7 @@
<LangVersion>11.0</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>5.0.0.9</Version>
<Version>5.0.0.12</Version>
<Authors>Diego</Authors>
<Company>Diego</Company>
<Product>Diego</Product>

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0;</TargetFrameworks>
<TargetFrameworks>net6.0;</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

View File

@@ -43,7 +43,7 @@ public static class LiteDBCacheUtil
var dir = GetFilePath(id);
var fileStart = GetFileStartName(typeName);
var maxNum = GetMaxNumFileName(id, typeName);
var fullName = dir.CombinePath($"{fileStart}{maxNum}{ex}");
var fullName = dir.CombinePath($"{fileStart}_{maxNum}{ex}");
if (isDeleteRule)
{
//磁盘使用率限制
@@ -59,9 +59,14 @@ public static class LiteDBCacheUtil
foreach (var d in dirs)
{
string[] files = Directory.GetFiles(d);
//如果文件数量小于4的退出循环
if (files.Length < 4)
{
break;
}
//数量超限就删除旧文件
//按文件更改时间降序排序
var sortedFiles = files.OrderByDescending(file => File.GetLastWriteTime(file));
//按文件更改时间排序
var sortedFiles = files.OrderBy(file => File.GetLastWriteTime(file)).ToArray();
// 需要删除的文件数量
int filesToDeleteCount = files.Length - Math.Max(2, (int)(files.Length * 0.1));
@@ -69,14 +74,14 @@ public static class LiteDBCacheUtil
// 删除较旧的文件
for (int i = 0; i < filesToDeleteCount; i++)
{
var fileName = sortedFiles.ElementAt(i);
var fileName = sortedFiles[i];
if (_dict.TryGetValue(fileName, out object cache1))
{
DisposeAndDeleteFile(fileName, cache1);
}
else
{
DeleteFile(fullName);
DeleteFile(fileName);
}
}
}
@@ -90,7 +95,7 @@ public static class LiteDBCacheUtil
{
//数量超限就删除旧文件
//按文件更改时间降序排序
var sortedFiles = files.OrderByDescending(file => File.GetLastWriteTime(file));
var sortedFiles = files.OrderBy(file => File.GetLastWriteTime(file)).ToArray();
// 需要删除的文件数量
int filesToDeleteCount = files.Length - LiteDBCacheUtil.config.MaxFileCount;
@@ -98,14 +103,14 @@ public static class LiteDBCacheUtil
// 删除较旧的文件
for (int i = 0; i < filesToDeleteCount; i++)
{
var fileName = sortedFiles.ElementAt(i);
var fileName = sortedFiles[i];
if (_dict.TryGetValue(fileName, out object cache1))
{
DisposeAndDeleteFile(fileName, cache1);
}
else
{
DeleteFile(fullName);
DeleteFile(fileName);
}
}
}
@@ -126,7 +131,7 @@ public static class LiteDBCacheUtil
if (mb1 > LiteDBCacheUtil.config.MaxFileLength)
{
//大小超限就返回新的文件
var newFullName = dir.CombinePath($"{fileStart}{maxNum + 1}{ex}");
var newFullName = dir.CombinePath($"{fileStart}_{maxNum + 1}{ex}");
{
if (_dict.TryGetValue(fullName, out object cache1))
{
@@ -239,14 +244,14 @@ public static class LiteDBCacheUtil
var fileStart = GetFileStartName(typeName);
//搜索全部符合条件的文件
if (!File.Exists(dir.CombinePath($"{fileStart}{ex}")))
if (!File.Exists(dir.CombinePath($"{fileStart}_{ex}")))
{
return null;
}
var index = 1;
while (true)
{
var newFileName = dir.CombinePath($"{fileStart}{index}{ex}");
var newFileName = dir.CombinePath($"{fileStart}_{index}{ex}");
if (System.IO.File.Exists(newFileName))
{
index++;

View File

@@ -2,9 +2,9 @@
<Import Project="$(SolutionDir)PackNuget.props" />
<ItemGroup>
<PackageReference Include="Furion.Pure" Version="4.9.1.27" />
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.1.27" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.1.27" />
<PackageReference Include="Furion.Pure" Version="4.9.1.28" />
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.1.28" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.1.28" />
<PackageReference Include="NewLife.Redis" Version="5.6.2024.105" />
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
<PackageReference Include="LiteDB" Version="5.0.17" />

View File

@@ -3,7 +3,7 @@
<ItemGroup>
<PackageReference Include="NewLife.Core" Version="10.6.2024.101" />
<PackageReference Include="NewLife.Core" Version="10.7.2024.202" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

View File

@@ -44,7 +44,7 @@ public class FileLogCleanJob : IJob
{
if (!data.Contains(item))
{
Directory.Delete(item, true);
Directory.Delete(dir.CombinePath(item), true);
}
}
catch { }
@@ -68,7 +68,7 @@ public class FileLogCleanJob : IJob
{
if (!channelConfig.ChannelDatas.Select(a => a.Id.ToString()).Contains(item))
{
Directory.Delete(item, true);
Directory.Delete(debugDir.CombinePath(item), true);
}
}
catch { }

View File

@@ -448,13 +448,22 @@ public class AlarmWorker : BackgroundService
#region worker服务
private EasyLock _easyLock = new();
private EasyLock _easyLock = new(false);
private async Task CollectDeviceWorker_Starting()
{
await StartAsync();
}
private async Task CollectDeviceWorker_Stoping()
{
await StopAsync();
}
/// <inheritdoc/>
public override async Task StartAsync(CancellationToken cancellationToken)
{
_logger?.LogInformation("报警服务启动");
await _easyLock.WaitAsync();
_appLifetime.ApplicationStarted.Register(() => { _easyLock.Release(); _easyLock = null; });
await base.StartAsync(cancellationToken);
}
@@ -470,7 +479,8 @@ public class AlarmWorker : BackgroundService
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
await _easyLock?.WaitAsync();
WorkerUtil.GetWoker<CollectDeviceWorker>().Starting += CollectDeviceWorker_Starting;
WorkerUtil.GetWoker<CollectDeviceWorker>().Stoping += CollectDeviceWorker_Stoping;
GlobalData = _serviceScope.ServiceProvider.GetService<GlobalData>();
while (!stoppingToken.IsCancellationRequested)
{

View File

@@ -51,10 +51,36 @@ public class BusinessDeviceWorker : DeviceWorker
if (ChannelThreads.Count == 0)
{
await CreatAllChannelThreadsAsync();
await StartAllChannelThreadsAsync();
await ProtectedStarting();
}
await StartAllChannelThreadsAsync();
await ProtectedStarted();
}
catch (Exception ex)
{
_logger.LogError(ex, "启动发生错误");
}
finally
{
singleRestartLock.Release();
restartLock.Release();
}
}
/// <summary>
/// 开始
/// </summary>
public async Task CreatThreadsAsync()
{
try
{
await restartLock.WaitAsync();
await singleRestartLock.WaitAsync();
if (ChannelThreads.Count == 0)
{
await CreatAllChannelThreadsAsync();
await ProtectedStarting();
}
if (Start != null)
await Start.Invoke();
}
catch (Exception ex)
{
@@ -76,14 +102,14 @@ public class BusinessDeviceWorker : DeviceWorker
{
await restartLock.WaitAsync();
await singleRestartLock.WaitAsync();
await BeforeRemoveAllChannelThreadAsync();
await ProtectedStoping();
await RemoveAllChannelThreadAsync();
await ProtectedStoped();
//清空内存列表
GlobalData.BusinessDevices.Clear();
if (Stop != null)
await Stop.Invoke();
}
catch (Exception ex)
{
@@ -160,6 +186,27 @@ public class BusinessDeviceWorker : DeviceWorker
#region worker服务
public override async Task StartAsync(CancellationToken cancellationToken)
{
await base.StartAsync(cancellationToken);
}
private async Task CollectDeviceWorker_Starting()
{
await CreatThreadsAsync();
}
private async Task CollectDeviceWorker_Started()
{
await Task.Delay(1000);
await StartAsync();
}
private async Task CollectDeviceWorker_Stoping()
{
await StopAsync();
}
/// <inheritdoc/>
public override async Task StopAsync(CancellationToken cancellationToken)
{
@@ -169,14 +216,15 @@ public class BusinessDeviceWorker : DeviceWorker
await base.StopAsync(cancellationToken);
}
protected override Task StartOtherHostService()
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
return Task.CompletedTask;
}
protected override Task StopOtherHostService()
{
return Task.CompletedTask;
await _easyLock?.WaitAsync();
WorkerUtil.GetWoker<CollectDeviceWorker>().Starting += CollectDeviceWorker_Starting;
WorkerUtil.GetWoker<CollectDeviceWorker>().Started += CollectDeviceWorker_Started;
WorkerUtil.GetWoker<CollectDeviceWorker>().Stoping += CollectDeviceWorker_Stoping;
PluginService = _serviceScope.ServiceProvider.GetService<IPluginService>();
GlobalData = _serviceScope.ServiceProvider.GetService<GlobalData>();
await WhileExecuteAsync(stoppingToken);
}
protected override async Task<IEnumerable<DeviceRunTime>> GetDeviceRunTimeAsync(long deviceId)
@@ -185,8 +233,4 @@ public class BusinessDeviceWorker : DeviceWorker
}
#endregion worker服务
public event RestartEventHandler Stop;
public event RestartEventHandler Start;
}

View File

@@ -43,20 +43,21 @@ public class CollectDeviceWorker : DeviceWorker
//停止采集服务
await BeforeRemoveAllChannelThreadAsync();
//停止其他后台服务
await StopOtherHostService();
await ProtectedStoping();
//完全停止全部采集线程
await RemoveAllChannelThreadAsync();
await ProtectedStoped();
//清空内存列表
GlobalData.CollectDevices.Clear();
//创建全部采集线程
await CreatAllChannelThreadsAsync();
//开始其他后台服务
await StartOtherHostService();
await ProtectedStarting();
//开始全部采集线程
await StartAllChannelThreadsAsync();
await ProtectedStarted();
}
catch (Exception ex)
{
@@ -69,32 +70,6 @@ public class CollectDeviceWorker : DeviceWorker
}
}
/// <summary>
/// 启动其他后台服务
/// </summary>
protected override async Task StartOtherHostService()
{
var alarmHostService = WorkerUtil.GetWoker<AlarmWorker>();
var businessDeviceHostService = WorkerUtil.GetWoker<BusinessDeviceWorker>();
await businessDeviceHostService.StartAsync();
await alarmHostService.StartAsync();
if (Start != null)
await Start.Invoke();
}
/// <summary>
/// 停止其他后台服务
/// </summary>
protected override async Task StopOtherHostService()
{
var alarmHostService = WorkerUtil.GetWoker<AlarmWorker>();
var businessDeviceHostService = WorkerUtil.GetWoker<BusinessDeviceWorker>();
await alarmHostService.StopAsync();
await businessDeviceHostService.StopAsync();
if (Stop != null)
await Stop.Invoke();
}
#endregion public
#region Private
@@ -147,9 +122,11 @@ public class CollectDeviceWorker : DeviceWorker
stoppingToken.Cancel();
await BeforeRemoveAllChannelThreadAsync();
//停止其他后台服务
await StopOtherHostService();
await ProtectedStoping();
//停止全部采集线程
await RemoveAllChannelThreadAsync();
//停止其他后台服务
await ProtectedStoped();
await base.StopAsync(cancellationToken);
}
@@ -165,8 +142,4 @@ public class CollectDeviceWorker : DeviceWorker
}
#endregion worker服务
public event RestartEventHandler Stop;
public event RestartEventHandler Start;
}

View File

@@ -202,13 +202,15 @@ public abstract class DeviceWorker : BackgroundService
if (!_stoppingToken.IsCancellationRequested)
{
if (isChanged)
await StopOtherHostService();
await ProtectedStoping();
var channelThread = ChannelThreads.FirstOrDefault(it => it.Has(deviceId)) ?? throw new($"更新设备线程失败,不存在{deviceId}为id的设备");
var dev = isChanged ? (await GetDeviceRunTimeAsync(deviceId)).FirstOrDefault() : channelThread.GetDriver(deviceId).CurrentDevice;
//这里先停止采集,操作会使线程取消,需要重新恢复线程
await channelThread.RemoveDriverAsync(deviceId);
if (isChanged)
await ProtectedStoped();
if (dev != null)
{
//初始化
@@ -216,16 +218,39 @@ public abstract class DeviceWorker : BackgroundService
var newChannelThread = GetChannelThread(newDriverBase);
if (newChannelThread != null)
{
await newChannelThread.StartThreadAsync();
if (isChanged)
await ProtectedStarting();
try
{
await newChannelThread.StartThreadAsync();
if (isChanged)
await ProtectedStarted();
}
finally
{
if (isChanged)
await ProtectedStarted();
}
}
else
{
if (isChanged)
await ProtectedStarting();
if (isChanged)
await ProtectedStarted();
}
}
else
{
if (isChanged)
await ProtectedStarting();
if (isChanged)
await ProtectedStarted();
}
}
}
finally
{
if (!_stoppingToken.IsCancellationRequested)
if (isChanged)
await StartOtherHostService();
singleRestartLock.Release();
}
}
@@ -391,7 +416,7 @@ public abstract class DeviceWorker : BackgroundService
#region worker服务
protected EasyLock _easyLock = new();
protected EasyLock _easyLock = new(false);
/// <summary>
/// 在软件关闭时取消
@@ -401,7 +426,6 @@ public abstract class DeviceWorker : BackgroundService
/// <inheritdoc/>
public override async Task StartAsync(CancellationToken cancellationToken)
{
await _easyLock.WaitAsync(cancellationToken);
_appLifetime.ApplicationStarted.Register(() => { _easyLock.Release(); _easyLock = null; });
await base.StartAsync(cancellationToken);
}
@@ -411,16 +435,44 @@ public abstract class DeviceWorker : BackgroundService
/// </summary>
public const int CheckIntervalTime = 600;
protected abstract Task StartOtherHostService();
public event RestartEventHandler Stoping;
protected abstract Task StopOtherHostService();
public event RestartEventHandler Stoped;
public event RestartEventHandler Started;
public event RestartEventHandler Starting;
protected async Task ProtectedStarted()
{
if (Started != null)
await Started.Invoke();
}
protected async Task ProtectedStarting()
{
if (Starting != null)
await Starting.Invoke();
}
protected async Task ProtectedStoped()
{
if (Stoped != null)
await Stoped.Invoke();
}
protected async Task ProtectedStoping()
{
if (Stoping != null)
await Stoping.Invoke();
}
protected abstract Task<IEnumerable<DeviceRunTime>> GetDeviceRunTimeAsync(long deviceId);
/// <inheritdoc/>
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
await _easyLock?.WaitAsync(stoppingToken);
await _easyLock?.WaitAsync();
PluginService = _serviceScope.ServiceProvider.GetService<IPluginService>();
GlobalData = _serviceScope.ServiceProvider.GetService<GlobalData>();
await WhileExecuteAsync(stoppingToken);

View File

@@ -1,10 +1,13 @@
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
#aspnetcore6.0环境
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
COPY . /app
WORKDIR /app
EXPOSE 80
#linux安装
EXPOSE 7200
#图像库
RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ sid main contrib non-free" > /etc/apt/sources.list
RUN apt-get update && apt-get -y install libfontconfig1
ENTRYPOINT ["dotnet", "ThingsGateway.Web.Server.dll","--urls","http://*:7200"]
#7200端口
ENTRYPOINT ["dotnet", "ThingsGateway.Web.Entry.dll","--urls","http://*:7200"]

View File

@@ -22,7 +22,7 @@ public interface IChannel : IConnectObject, ICloseObject, ISetupConfigObject, ID
/// <summary>
/// 该通道下的所有设备
/// </summary>
public List<IProtocol> Collects { get; }
public ConcurrentList<IProtocol> Collects { get; }
/// <summary>
/// CanSend

View File

@@ -139,14 +139,14 @@ namespace ThingsGateway.Foundation
var byteBlock = new ByteBlock(this.ReceiveBufferSize);
try
{
var r = await Task<int>.Factory.FromAsync(this.m_serialPort.BaseStream.BeginRead, this.m_serialPort.BaseStream.EndRead, byteBlock.Buffer, 0, byteBlock.Capacity, default).ConfigureFalseAwait();
var r = await this.m_serialPort.BaseStream.ReadAsync(byteBlock.Buffer, 0, byteBlock.Capacity, default).ConfigureFalseAwait();
if (r == 0)
{
this.PrivateBreakOut(false, FoundationConst.RemoteClose);
return;
}
if (m_serialPort.BytesToRead > 0)
r += await Task<int>.Factory.FromAsync(this.m_serialPort.BaseStream.BeginRead, this.m_serialPort.BaseStream.EndRead, byteBlock.Buffer, r, byteBlock.Capacity - r, default);
r += await this.m_serialPort.BaseStream.ReadAsync(byteBlock.Buffer, r, byteBlock.Capacity - r, default).ConfigureFalseAwait();
byteBlock.SetLength(r);
this.HandleBuffer(byteBlock);

View File

@@ -29,7 +29,7 @@ namespace ThingsGateway.Foundation
public EasyLock WaitLock { get; } = new EasyLock();
/// <inheritdoc/>
public List<IProtocol> Collects { get; } = new();
public ConcurrentList<IProtocol> Collects { get; } = new();
/// <summary>
/// 接收到数据

View File

@@ -34,7 +34,7 @@ namespace ThingsGateway.Foundation
public EasyLock WaitLock { get; } = new EasyLock();
/// <inheritdoc/>
public List<IProtocol> Collects { get; } = new();
public ConcurrentList<IProtocol> Collects { get; } = new();
/// <inheritdoc/>
protected override void Dispose(bool disposing)

View File

@@ -20,7 +20,7 @@ namespace ThingsGateway.Foundation
public class TgTcpClient : TgTcpClientBase, IClientChannel
{
/// <inheritdoc/>
public List<IProtocol> Collects { get; } = new();
public ConcurrentList<IProtocol> Collects { get; } = new();
/// <inheritdoc/>
public EasyLock WaitLock { get; } = new EasyLock();

View File

@@ -26,7 +26,7 @@ namespace ThingsGateway.Foundation
}
/// <inheritdoc/>
public List<IProtocol> Collects { get; } = new();
public ConcurrentList<IProtocol> Collects { get; } = new();
#region

View File

@@ -56,7 +56,7 @@ namespace ThingsGateway.Foundation
DataHandlingAdapter IClientChannel.DataHandlingAdapter => DataHandlingAdapter;
/// <inheritdoc/>
public List<IProtocol> Collects { get; } = new();
public ConcurrentList<IProtocol> Collects { get; } = new();
/// <inheritdoc/>
public void SetDataHandlingAdapter(DataHandlingAdapter adapter)

View File

@@ -799,7 +799,8 @@ public abstract class ProtocolBase : DisposableObject, IProtocol
public virtual Task<OperResult> WriteAsync(string address, string value, CancellationToken cancellationToken = default)
{
IThingsGatewayBitConverter transformParameter = ByteTransUtil.GetTransByAddress(ref address, ThingsGatewayBitConverter);
return WriteAsync(address, transformParameter.GetBytes(value), cancellationToken);
var data = transformParameter.GetBytes(value);
return WriteAsync(address, data.ArrayExpandToLength(transformParameter.StringLength ?? data.Length), cancellationToken);
}
/// <inheritdoc/>
@@ -881,7 +882,8 @@ public abstract class ProtocolBase : DisposableObject, IProtocol
public virtual OperResult Write(string address, string value, CancellationToken cancellationToken = default)
{
IThingsGatewayBitConverter transformParameter = ByteTransUtil.GetTransByAddress(ref address, ThingsGatewayBitConverter);
return Write(address, transformParameter.GetBytes(value), cancellationToken);
var data = transformParameter.GetBytes(value);
return Write(address, data.ArrayExpandToLength(transformParameter.StringLength ?? data.Length), cancellationToken);
}
#endregion
@@ -953,9 +955,7 @@ public abstract class ProtocolBase : DisposableObject, IProtocol
value.ForEach((Action<string>)(a =>
{
var data = transformParameter.GetBytes(a);
if (a.Length > transformParameter.StringLength)
data = data.RemoveLast((int)(a.Length - transformParameter.StringLength.Value));
bytes.AddRange(data);
bytes.AddRange(data.ArrayExpandToLength(transformParameter.StringLength ?? data.Length));
}));
return await WriteAsync(address, bytes.ToArray(), cancellationToken);
}
@@ -1025,9 +1025,7 @@ public abstract class ProtocolBase : DisposableObject, IProtocol
value.ForEach((Action<string>)(a =>
{
var data = transformParameter.GetBytes(a);
if (a.Length > transformParameter.StringLength)
data = data.RemoveLast((int)(a.Length - transformParameter.StringLength.Value));
bytes.AddRange(data);
bytes.AddRange(data.ArrayExpandToLength(transformParameter.StringLength ?? data.Length));
}));
return Write(address, bytes.ToArray(), cancellationToken);
}

View File

@@ -11,7 +11,7 @@
<ItemGroup>
<PackageReference Include="NewLife.Core" Version="10.6.2024.101" />
<PackageReference Include="NewLife.Core" Version="10.7.2024.202" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="TouchSocket" Version="2.0.0-beta.270" />
</ItemGroup>

View File

@@ -3,7 +3,7 @@
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command=" set dir=&quot;$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\$(TargetFramework)\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist %25dir%25 md %25dir%25 &#xD;&#xA;copy &quot;$(TargetDir)*Dlt645*.dll&quot; %25dir%25&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;cd /d &quot;$(TargetDir)&quot;&#xD;&#xA;::设置要排除的文件格式,多个格式之间使用英文逗号隔开&#xD;&#xA;set Ext=dll&#xD;&#xA;::删除文件&#xD;&#xA;for /f &quot;delims=&quot; %25%25a in ('dir /a-d/s/b') do (&#xD;&#xA; if /i not &quot;%25%25~a&quot;==&quot;%25~f0&quot; (&#xD;&#xA; set &quot;Skip=&quot;&#xD;&#xA; for %25%25i in (%25Ext%25) do (&#xD;&#xA; if /i &quot;.%25%25~i&quot;==&quot;%25%25~xa&quot; (&#xD;&#xA; set Skip=OK&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA; if not defined Skip (&#xD;&#xA; del /f /q &quot;%25%25~a&quot;&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;for /d %25%25i in (*) do (&#xD;&#xA; rd /s /q &quot;%25%25i&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;" />
<Exec Command="@echo off&#xD;&#xA;setlocal enabledelayedexpansion&#xD;&#xA;&#xD;&#xA;set &quot;targetFWS=net6.0 net7.0 net8.0&quot;&#xD;&#xA;for %25%25f in (%25targetFWS%25) do (&#xD;&#xA; set &quot;dir=$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\%25%25f\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist &quot;!dir!&quot; md &quot;!dir!&quot;&#xD;&#xA; copy &quot;$(TargetDir)*Dlt645*.dll&quot; &quot;!dir!&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;endlocal&#xD;&#xA;" />
</Target>
<ItemGroup>

View File

@@ -3,7 +3,7 @@
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command=" set dir=&quot;$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\$(TargetFramework)\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist %25dir%25 md %25dir%25 &#xD;&#xA;copy &quot;$(TargetDir)*Kafka*.dll&quot; %25dir%25&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;cd /d &quot;$(TargetDir)&quot;&#xD;&#xA;::设置要排除的文件格式,多个格式之间使用英文逗号隔开&#xD;&#xA;set Ext=dll&#xD;&#xA;::删除文件&#xD;&#xA;for /f &quot;delims=&quot; %25%25a in ('dir /a-d/s/b') do (&#xD;&#xA; if /i not &quot;%25%25~a&quot;==&quot;%25~f0&quot; (&#xD;&#xA; set &quot;Skip=&quot;&#xD;&#xA; for %25%25i in (%25Ext%25) do (&#xD;&#xA; if /i &quot;.%25%25~i&quot;==&quot;%25%25~xa&quot; (&#xD;&#xA; set Skip=OK&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA; if not defined Skip (&#xD;&#xA; del /f /q &quot;%25%25~a&quot;&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;for /d %25%25i in (*) do (&#xD;&#xA; rd /s /q &quot;%25%25i&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;" />
<Exec Command="@echo off&#xD;&#xA;setlocal enabledelayedexpansion&#xD;&#xA;&#xD;&#xA;set &quot;targetFWS=net6.0 net7.0 net8.0&quot;&#xD;&#xA;for %25%25f in (%25targetFWS%25) do (&#xD;&#xA; set &quot;dir=$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\%25%25f\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist &quot;!dir!&quot; md &quot;!dir!&quot;&#xD;&#xA; copy &quot;$(TargetDir)*Kafka*.dll&quot; &quot;!dir!&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;endlocal&#xD;&#xA;" />
</Target>
<PropertyGroup>

View File

@@ -3,7 +3,7 @@
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command=" set dir=&quot;$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\$(TargetFramework)\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist %25dir%25 md %25dir%25 &#xD;&#xA;copy &quot;$(TargetDir)*Modbus*.dll&quot; %25dir%25&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;cd /d &quot;$(TargetDir)&quot;&#xD;&#xA;::设置要排除的文件格式,多个格式之间使用英文逗号隔开&#xD;&#xA;set Ext=dll&#xD;&#xA;::删除文件&#xD;&#xA;for /f &quot;delims=&quot; %25%25a in ('dir /a-d/s/b') do (&#xD;&#xA; if /i not &quot;%25%25~a&quot;==&quot;%25~f0&quot; (&#xD;&#xA; set &quot;Skip=&quot;&#xD;&#xA; for %25%25i in (%25Ext%25) do (&#xD;&#xA; if /i &quot;.%25%25~i&quot;==&quot;%25%25~xa&quot; (&#xD;&#xA; set Skip=OK&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA; if not defined Skip (&#xD;&#xA; del /f /q &quot;%25%25~a&quot;&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;for /d %25%25i in (*) do (&#xD;&#xA; rd /s /q &quot;%25%25i&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;" />
<Exec Command="@echo off&#xD;&#xA;setlocal enabledelayedexpansion&#xD;&#xA;&#xD;&#xA;set &quot;targetFWS=net6.0 net7.0 net8.0&quot;&#xD;&#xA;for %25%25f in (%25targetFWS%25) do (&#xD;&#xA; set &quot;dir=$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\%25%25f\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist &quot;!dir!&quot; md &quot;!dir!&quot;&#xD;&#xA; copy &quot;$(TargetDir)*Modbus*.dll&quot; &quot;!dir!&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;endlocal&#xD;&#xA;&#xD;&#xA;" />
</Target>
<ItemGroup>

View File

@@ -110,7 +110,7 @@ public partial class MqttClient : BusinessBaseWithCacheIntervalScript<VariableDa
success = clientResult.IsSuccess;
}
await Delay(cancellationToken);
return;
//return;
}
await Update(cancellationToken);

View File

@@ -295,7 +295,7 @@ public partial class MqttClient : BusinessBaseWithCacheIntervalScript<VariableDa
if (isConnect.IsSuccess)
{
var variableMessage = new MqttApplicationMessageBuilder()
.WithTopic(topic)
.WithTopic(topic).WithRetainFlag(true)
.WithPayload(payLoad).Build();
var result = await _mqttClient.PublishAsync(variableMessage, cancellationToken);
if (result.IsSuccess)

View File

@@ -207,13 +207,19 @@ public partial class MqttServer : BusinessBaseWithCacheIntervalScript<VariableDa
arg.ReasonCode = MqttConnectReasonCode.BadUserNameOrPassword;
return;
}
List<MqttApplicationMessage> data = GetRetainedMessages();
foreach (var item in data)
{
await _mqttServer.UpdateRetainedMessageAsync(item);
}
LogMessage?.LogInformation($"{ToString()}-{arg.ClientId}-客户端已连接成功");
_ = Task.Run(async () =>
{
//延时发送
await Task.Delay(1000);
List<MqttApplicationMessage> data = GetRetainedMessages();
foreach (var item in data)
{
await _mqttServer.InjectApplicationMessage(
new InjectedMqttApplicationMessage(item));
//await _mqttServer.UpdateRetainedMessageAsync(item);
}
});
}
/// <summary>

View File

@@ -3,7 +3,7 @@
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command=" set dir=&quot;$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\$(TargetFramework)\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist %25dir%25 md %25dir%25 &#xD;&#xA;copy &quot;$(TargetDir)*Mqtt*.dll&quot; %25dir%25&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;cd /d &quot;$(TargetDir)&quot;&#xD;&#xA;::设置要排除的文件格式,多个格式之间使用英文逗号隔开&#xD;&#xA;set Ext=dll&#xD;&#xA;::删除文件&#xD;&#xA;for /f &quot;delims=&quot; %25%25a in ('dir /a-d/s/b') do (&#xD;&#xA; if /i not &quot;%25%25~a&quot;==&quot;%25~f0&quot; (&#xD;&#xA; set &quot;Skip=&quot;&#xD;&#xA; for %25%25i in (%25Ext%25) do (&#xD;&#xA; if /i &quot;.%25%25~i&quot;==&quot;%25%25~xa&quot; (&#xD;&#xA; set Skip=OK&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA; if not defined Skip (&#xD;&#xA; del /f /q &quot;%25%25~a&quot;&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA;)&#xD;&#xA;for /d %25%25i in (*) do (&#xD;&#xA; rd /s /q &quot;%25%25i&quot;&#xD;&#xA;)&#xD;&#xA;" />
<Exec Command="@echo off&#xD;&#xA;setlocal enabledelayedexpansion&#xD;&#xA;&#xD;&#xA;set &quot;targetFWS=net6.0 net7.0 net8.0&quot;&#xD;&#xA;for %25%25f in (%25targetFWS%25) do (&#xD;&#xA; set &quot;dir=$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\%25%25f\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist &quot;!dir!&quot; md &quot;!dir!&quot;&#xD;&#xA; copy &quot;$(TargetDir)*Mqtt*.dll&quot; &quot;!dir!&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;endlocal&#xD;&#xA;" />
</Target>
<ItemGroup>

View File

@@ -7,7 +7,7 @@
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command=" set dir=&quot;$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\$(TargetFramework)\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist %25dir%25 md %25dir%25 &#xD;&#xA;copy &quot;$(TargetDir)*OpcDa*.dll&quot; %25dir%25&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;cd /d &quot;$(TargetDir)&quot;&#xD;&#xA;::设置要排除的文件格式,多个格式之间使用英文逗号隔开&#xD;&#xA;set Ext=dll&#xD;&#xA;::删除文件&#xD;&#xA;for /f &quot;delims=&quot; %25%25a in ('dir /a-d/s/b') do (&#xD;&#xA; if /i not &quot;%25%25~a&quot;==&quot;%25~f0&quot; (&#xD;&#xA; set &quot;Skip=&quot;&#xD;&#xA; for %25%25i in (%25Ext%25) do (&#xD;&#xA; if /i &quot;.%25%25~i&quot;==&quot;%25%25~xa&quot; (&#xD;&#xA; set Skip=OK&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA; if not defined Skip (&#xD;&#xA; del /f /q &quot;%25%25~a&quot;&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;for /d %25%25i in (*) do (&#xD;&#xA; rd /s /q &quot;%25%25i&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;" />
<Exec Command="@echo off&#xD;&#xA;setlocal enabledelayedexpansion&#xD;&#xA;&#xD;&#xA;set &quot;targetFWS=net6.0 net7.0 net8.0&quot;&#xD;&#xA;for %25%25f in (%25targetFWS%25) do (&#xD;&#xA; set &quot;dir=$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\%25%25f\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist &quot;!dir!&quot; md &quot;!dir!&quot;&#xD;&#xA; copy &quot;$(TargetDir)*OpcDa*.dll&quot; &quot;!dir!&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;endlocal&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;" />
</Target>
<ItemGroup>

View File

@@ -8,7 +8,7 @@
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command=" set dir=&quot;$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\$(TargetFramework)\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist %25dir%25 md %25dir%25 &#xD;&#xA;copy &quot;$(TargetDir)*OpcUa*.dll&quot; %25dir%25&#xD;&#xA;copy &quot;$(TargetDir)*Opc.Ua*.dll&quot; %25dir%25&#xD;&#xA;copy &quot;$(TargetDir)*System.Formats.Asn1*.dll&quot; %25dir%25&#xD;&#xA;&#xD;&#xA;cd /d &quot;$(TargetDir)&quot;&#xD;&#xA;::设置要排除的文件格式,多个格式之间使用英文逗号隔开&#xD;&#xA;set Ext=dll&#xD;&#xA;::删除文件&#xD;&#xA;for /f &quot;delims=&quot; %25%25a in ('dir /a-d/s/b') do (&#xD;&#xA; if /i not &quot;%25%25~a&quot;==&quot;%25~f0&quot; (&#xD;&#xA; set &quot;Skip=&quot;&#xD;&#xA; for %25%25i in (%25Ext%25) do (&#xD;&#xA; if /i &quot;.%25%25~i&quot;==&quot;%25%25~xa&quot; (&#xD;&#xA; set Skip=OK&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA; if not defined Skip (&#xD;&#xA; del /f /q &quot;%25%25~a&quot;&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA;)&#xD;&#xA;for /d %25%25i in (*) do (&#xD;&#xA; rd /s /q &quot;%25%25i&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;" />
<Exec Command="@echo off&#xD;&#xA;setlocal enabledelayedexpansion&#xD;&#xA;&#xD;&#xA;set &quot;targetFWS=net6.0 net7.0 net8.0&quot;&#xD;&#xA;for %25%25f in (%25targetFWS%25) do (&#xD;&#xA; set &quot;dir=$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\%25%25f\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist &quot;!dir!&quot; md &quot;!dir!&quot;&#xD;&#xA; copy &quot;$(TargetDir)*OpcUa*.dll&quot; &quot;!dir!&quot;&#xD;&#xA; copy &quot;$(TargetDir)*Opc.Ua*.dll&quot; &quot;!dir!&quot;&#xD;&#xA; copy &quot;$(TargetDir)*System.Formats.Asn1*.dll&quot; &quot;!dir!&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;endlocal&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;" />
</Target>
<ItemGroup>

View File

@@ -3,7 +3,7 @@
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command=" set dir=&quot;$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\$(TargetFramework)\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist %25dir%25 md %25dir%25 &#xD;&#xA;copy &quot;$(TargetDir)*QuestDB*.dll&quot; %25dir%25&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;cd /d &quot;$(TargetDir)&quot;&#xD;&#xA;::设置要排除的文件格式,多个格式之间使用英文逗号隔开&#xD;&#xA;set Ext=dll&#xD;&#xA;::删除文件&#xD;&#xA;for /f &quot;delims=&quot; %25%25a in ('dir /a-d/s/b') do (&#xD;&#xA; if /i not &quot;%25%25~a&quot;==&quot;%25~f0&quot; (&#xD;&#xA; set &quot;Skip=&quot;&#xD;&#xA; for %25%25i in (%25Ext%25) do (&#xD;&#xA; if /i &quot;.%25%25~i&quot;==&quot;%25%25~xa&quot; (&#xD;&#xA; set Skip=OK&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA; if not defined Skip (&#xD;&#xA; del /f /q &quot;%25%25~a&quot;&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;for /d %25%25i in (*) do (&#xD;&#xA; rd /s /q &quot;%25%25i&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;" />
<Exec Command="@echo off&#xD;&#xA;setlocal enabledelayedexpansion&#xD;&#xA;&#xD;&#xA;set &quot;targetFWS=net6.0 net7.0 net8.0&quot;&#xD;&#xA;for %25%25f in (%25targetFWS%25) do (&#xD;&#xA; set &quot;dir=$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\%25%25f\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist &quot;!dir!&quot; md &quot;!dir!&quot;&#xD;&#xA; copy &quot;$(TargetDir)*QuestDB*.dll&quot; &quot;!dir!&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;endlocal&#xD;&#xA;" />
</Target>

View File

@@ -4,7 +4,7 @@
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command=" set dir=&quot;$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\$(TargetFramework)\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist %25dir%25 md %25dir%25 &#xD;&#xA;copy &quot;$(TargetDir)*RabbitMQ*.dll&quot; %25dir%25&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;cd /d &quot;$(TargetDir)&quot;&#xD;&#xA;::设置要排除的文件格式,多个格式之间使用英文逗号隔开&#xD;&#xA;set Ext=dll&#xD;&#xA;::删除文件&#xD;&#xA;for /f &quot;delims=&quot; %25%25a in ('dir /a-d/s/b') do (&#xD;&#xA; if /i not &quot;%25%25~a&quot;==&quot;%25~f0&quot; (&#xD;&#xA; set &quot;Skip=&quot;&#xD;&#xA; for %25%25i in (%25Ext%25) do (&#xD;&#xA; if /i &quot;.%25%25~i&quot;==&quot;%25%25~xa&quot; (&#xD;&#xA; set Skip=OK&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA; if not defined Skip (&#xD;&#xA; del /f /q &quot;%25%25~a&quot;&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;for /d %25%25i in (*) do (&#xD;&#xA; rd /s /q &quot;%25%25i&quot;&#xD;&#xA;)&#xD;&#xA;" />
<Exec Command="@echo off&#xD;&#xA;setlocal enabledelayedexpansion&#xD;&#xA;&#xD;&#xA;set &quot;targetFWS=net6.0 net7.0 net8.0&quot;&#xD;&#xA;for %25%25f in (%25targetFWS%25) do (&#xD;&#xA; set &quot;dir=$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\%25%25f\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist &quot;!dir!&quot; md &quot;!dir!&quot;&#xD;&#xA; copy &quot;$(TargetDir)*RabbitMQ*.dll&quot; &quot;!dir!&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;endlocal&#xD;&#xA;" />
</Target>

View File

@@ -3,7 +3,7 @@
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command=" set dir=&quot;$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\$(TargetFramework)\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist %25dir%25 md %25dir%25 &#xD;&#xA;copy &quot;$(TargetDir)*Siemens*.dll&quot; %25dir%25&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;cd /d &quot;$(TargetDir)&quot;&#xD;&#xA;::设置要排除的文件格式,多个格式之间使用英文逗号隔开&#xD;&#xA;set Ext=dll&#xD;&#xA;::删除文件&#xD;&#xA;for /f &quot;delims=&quot; %25%25a in ('dir /a-d/s/b') do (&#xD;&#xA; if /i not &quot;%25%25~a&quot;==&quot;%25~f0&quot; (&#xD;&#xA; set &quot;Skip=&quot;&#xD;&#xA; for %25%25i in (%25Ext%25) do (&#xD;&#xA; if /i &quot;.%25%25~i&quot;==&quot;%25%25~xa&quot; (&#xD;&#xA; set Skip=OK&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA; if not defined Skip (&#xD;&#xA; del /f /q &quot;%25%25~a&quot;&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;for /d %25%25i in (*) do (&#xD;&#xA; rd /s /q &quot;%25%25i&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;" />
<Exec Command="@echo off&#xD;&#xA;setlocal enabledelayedexpansion&#xD;&#xA;&#xD;&#xA;set &quot;targetFWS=net6.0 net7.0 net8.0&quot;&#xD;&#xA;for %25%25f in (%25targetFWS%25) do (&#xD;&#xA; set &quot;dir=$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\%25%25f\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist &quot;!dir!&quot; md &quot;!dir!&quot;&#xD;&#xA; copy &quot;$(TargetDir)*Siemens*.dll&quot; &quot;!dir!&quot;&#xD;&#xA;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;endlocal&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;" />
</Target>
<ItemGroup>

View File

@@ -3,7 +3,7 @@
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command=" set dir=&quot;$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\$(TargetFramework)\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist %25dir%25 md %25dir%25 &#xD;&#xA;copy &quot;$(TargetDir)*SqlDB*.dll&quot; %25dir%25&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;cd /d &quot;$(TargetDir)&quot;&#xD;&#xA;::设置要排除的文件格式,多个格式之间使用英文逗号隔开&#xD;&#xA;set Ext=dll&#xD;&#xA;::删除文件&#xD;&#xA;for /f &quot;delims=&quot; %25%25a in ('dir /a-d/s/b') do (&#xD;&#xA; if /i not &quot;%25%25~a&quot;==&quot;%25~f0&quot; (&#xD;&#xA; set &quot;Skip=&quot;&#xD;&#xA; for %25%25i in (%25Ext%25) do (&#xD;&#xA; if /i &quot;.%25%25~i&quot;==&quot;%25%25~xa&quot; (&#xD;&#xA; set Skip=OK&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA; if not defined Skip (&#xD;&#xA; del /f /q &quot;%25%25~a&quot;&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;for /d %25%25i in (*) do (&#xD;&#xA; rd /s /q &quot;%25%25i&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;" />
<Exec Command="@echo off&#xD;&#xA;setlocal enabledelayedexpansion&#xD;&#xA;&#xD;&#xA;set &quot;targetFWS=net6.0 net7.0 net8.0&quot;&#xD;&#xA;for %25%25f in (%25targetFWS%25) do (&#xD;&#xA; set &quot;dir=$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\%25%25f\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist &quot;!dir!&quot; md &quot;!dir!&quot;&#xD;&#xA; copy &quot;$(TargetDir)*SqlDB*.dll&quot; &quot;!dir!&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;endlocal&#xD;&#xA;" />
</Target>

View File

@@ -4,7 +4,7 @@
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command=" set dir=&quot;$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\$(TargetFramework)\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist %25dir%25 md %25dir%25 &#xD;&#xA;copy &quot;$(TargetDir)*SqlHisAlarm*.dll&quot; %25dir%25&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;cd /d &quot;$(TargetDir)&quot;&#xD;&#xA;::设置要排除的文件格式,多个格式之间使用英文逗号隔开&#xD;&#xA;set Ext=dll&#xD;&#xA;::删除文件&#xD;&#xA;for /f &quot;delims=&quot; %25%25a in ('dir /a-d/s/b') do (&#xD;&#xA; if /i not &quot;%25%25~a&quot;==&quot;%25~f0&quot; (&#xD;&#xA; set &quot;Skip=&quot;&#xD;&#xA; for %25%25i in (%25Ext%25) do (&#xD;&#xA; if /i &quot;.%25%25~i&quot;==&quot;%25%25~xa&quot; (&#xD;&#xA; set Skip=OK&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA; if not defined Skip (&#xD;&#xA; del /f /q &quot;%25%25~a&quot;&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;for /d %25%25i in (*) do (&#xD;&#xA; rd /s /q &quot;%25%25i&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;" />
<Exec Command="@echo off&#xD;&#xA;setlocal enabledelayedexpansion&#xD;&#xA;&#xD;&#xA;set &quot;targetFWS=net6.0 net7.0 net8.0&quot;&#xD;&#xA;for %25%25f in (%25targetFWS%25) do (&#xD;&#xA; set &quot;dir=$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\%25%25f\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist &quot;!dir!&quot; md &quot;!dir!&quot;&#xD;&#xA; copy &quot;$(TargetDir)*SqlHisAlarm*.dll&quot; &quot;!dir!&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;endlocal&#xD;&#xA;" />
</Target>

View File

@@ -3,7 +3,7 @@
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command=" set dir=&quot;$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\$(TargetFramework)\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist %25dir%25 md %25dir%25 &#xD;&#xA;copy &quot;$(TargetDir)*TDengineDB*.dll&quot; %25dir%25&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;cd /d &quot;$(TargetDir)&quot;&#xD;&#xA;::设置要排除的文件格式,多个格式之间使用英文逗号隔开&#xD;&#xA;set Ext=dll&#xD;&#xA;::删除文件&#xD;&#xA;for /f &quot;delims=&quot; %25%25a in ('dir /a-d/s/b') do (&#xD;&#xA; if /i not &quot;%25%25~a&quot;==&quot;%25~f0&quot; (&#xD;&#xA; set &quot;Skip=&quot;&#xD;&#xA; for %25%25i in (%25Ext%25) do (&#xD;&#xA; if /i &quot;.%25%25~i&quot;==&quot;%25%25~xa&quot; (&#xD;&#xA; set Skip=OK&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA; if not defined Skip (&#xD;&#xA; del /f /q &quot;%25%25~a&quot;&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;for /d %25%25i in (*) do (&#xD;&#xA; rd /s /q &quot;%25%25i&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;" />
<Exec Command="@echo off&#xD;&#xA;setlocal enabledelayedexpansion&#xD;&#xA;&#xD;&#xA;set &quot;targetFWS=net6.0 net7.0 net8.0&quot;&#xD;&#xA;for %25%25f in (%25targetFWS%25) do (&#xD;&#xA; set &quot;dir=$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\%25%25f\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist &quot;!dir!&quot; md &quot;!dir!&quot;&#xD;&#xA; copy &quot;$(TargetDir)*TDengineDB*.dll&quot; &quot;!dir!&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;endlocal&#xD;&#xA;" />
</Target>

View File

@@ -3,7 +3,7 @@
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command=" set dir=&quot;$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\$(TargetFramework)\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist %25dir%25 md %25dir%25 &#xD;&#xA;copy &quot;$(TargetDir)*VariableExpression*.dll&quot; %25dir%25&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;cd /d &quot;$(TargetDir)&quot;&#xD;&#xA;::设置要排除的文件格式,多个格式之间使用英文逗号隔开&#xD;&#xA;set Ext=dll&#xD;&#xA;::删除文件&#xD;&#xA;for /f &quot;delims=&quot; %25%25a in ('dir /a-d/s/b') do (&#xD;&#xA; if /i not &quot;%25%25~a&quot;==&quot;%25~f0&quot; (&#xD;&#xA; set &quot;Skip=&quot;&#xD;&#xA; for %25%25i in (%25Ext%25) do (&#xD;&#xA; if /i &quot;.%25%25~i&quot;==&quot;%25%25~xa&quot; (&#xD;&#xA; set Skip=OK&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA; if not defined Skip (&#xD;&#xA; del /f /q &quot;%25%25~a&quot;&#xD;&#xA; )&#xD;&#xA; )&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;for /d %25%25i in (*) do (&#xD;&#xA; rd /s /q &quot;%25%25i&quot;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;" />
<Exec Command="@echo off&#xD;&#xA;setlocal enabledelayedexpansion&#xD;&#xA;&#xD;&#xA;set &quot;targetFWS=net6.0 net7.0 net8.0&quot;&#xD;&#xA;for %25%25f in (%25targetFWS%25) do (&#xD;&#xA; set &quot;dir=$(SolutionDir)bin\$(Configuration)\ThingsGateway.Web.Entry\%25%25f\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist &quot;!dir!&quot; md &quot;!dir!&quot;&#xD;&#xA; copy &quot;$(TargetDir)*VariableExpression*.dll&quot; &quot;!dir!&quot;&#xD;&#xA;&#xD;&#xA;)&#xD;&#xA;&#xD;&#xA;endlocal&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;" />
</Target>