代码清理

This commit is contained in:
Diego
2024-12-25 10:53:43 +08:00
parent 4a35fade46
commit 4497c13634
13 changed files with 20 additions and 20 deletions

2
Admin

Submodule Admin updated: 22af559418...273310cba0

View File

@@ -1,8 +1,8 @@
<Project>
<PropertyGroup>
<PluginVersion>9.0.2.63</PluginVersion>
<ProPluginVersion>9.0.2.82</ProPluginVersion>
<PluginVersion>9.0.2.64</PluginVersion>
<ProPluginVersion>9.0.2.83</ProPluginVersion>
</PropertyGroup>
<PropertyGroup>

View File

@@ -102,7 +102,7 @@ public abstract class VariableObject
throw new ArgumentException("Can only access properties");
}
// 从字典中获取与属性对应的变量信息
if (!this.VariableRuntimePropertyDict.TryGetValue(memberExpression.Member.Name, out var variable))
if (!VariableRuntimePropertyDict.TryGetValue(memberExpression.Member.Name, out var variable))
{
throw new KeyNotFoundException($"Variable for {memberExpression.Member.Name} not found.");
}

View File

@@ -116,19 +116,19 @@ public class ChannelData
switch (channelData.ChannelType)
{
case ChannelTypeEnum.TcpClient:
channelData.Channel =await channelData.TouchSocketConfig.GetTcpClientWithIPHostAsync(channelData.RemoteUrl, channelData.BindUrl).ConfigureAwait(false);
channelData.Channel = await channelData.TouchSocketConfig.GetTcpClientWithIPHostAsync(channelData.RemoteUrl, channelData.BindUrl).ConfigureAwait(false);
break;
case ChannelTypeEnum.TcpService:
channelData.Channel =await channelData.TouchSocketConfig.GetTcpServiceWithBindIPHostAsync(channelData.BindUrl).ConfigureAwait(false);
channelData.Channel = await channelData.TouchSocketConfig.GetTcpServiceWithBindIPHostAsync(channelData.BindUrl).ConfigureAwait(false);
break;
case ChannelTypeEnum.SerialPort:
channelData.Channel =await channelData.TouchSocketConfig.GetSerialPortWithOptionAsync(channelData.Map<SerialPortOption>()).ConfigureAwait(false);
channelData.Channel = await channelData.TouchSocketConfig.GetSerialPortWithOptionAsync(channelData.Map<SerialPortOption>()).ConfigureAwait(false);
break;
case ChannelTypeEnum.UdpSession:
channelData.Channel =await channelData.TouchSocketConfig.GetUdpSessionWithIPHostAsync(channelData.RemoteUrl, channelData.BindUrl).ConfigureAwait(false);
channelData.Channel = await channelData.TouchSocketConfig.GetUdpSessionWithIPHostAsync(channelData.RemoteUrl, channelData.BindUrl).ConfigureAwait(false);
break;
}
}

View File

@@ -21,5 +21,5 @@ public interface IDtu : ITcpService
/// <summary>
/// 默认Dtu注册包,utf-8字符串
/// </summary>
public string DtuId { get; set; }
public string DtuId { get; set; }
}

View File

@@ -118,7 +118,7 @@ public class SerialPortChannel : SerialPortClient, IClientChannel
/// <inheritdoc/>
public override string? ToString()
{
var port = this.Config?.GetValue(SerialPortConfigExtension.SerialPortOptionProperty);
var port = Config?.GetValue(SerialPortConfigExtension.SerialPortOptionProperty);
if (port != null)
return $"{port.PortName}[{port.BaudRate},{port.DataBits},{port.StopBits},{port.Parity}]";
return base.ToString();

View File

@@ -22,7 +22,7 @@ public class TcpClientChannel : TcpClient, IClientChannel
{
WaitHandlePool.MaxSign = ushort.MaxValue;
}
public int MaxSign { get => WaitHandlePool.MaxSign; set => WaitHandlePool.MaxSign = value; }
public int MaxSign { get => WaitHandlePool.MaxSign; set => WaitHandlePool.MaxSign = value; }
/// <inheritdoc/>
public ChannelReceivedEventHandler ChannelReceived { get; set; } = new();

View File

@@ -62,7 +62,7 @@ public abstract class BusinessBaseWithCacheIntervalAlarmModel<VarModel, DevModel
GlobalData.DeviceStatusChangeEvent -= DeviceStatusChange;
// 根据业务属性的缓存是否为间隔上传来决定事件绑定
if (_businessPropertyWithCacheInterval.BusinessUpdateEnum!= BusinessUpdateEnum.Interval)
if (_businessPropertyWithCacheInterval.BusinessUpdateEnum != BusinessUpdateEnum.Interval)
{
// 绑定全局数据的事件
GlobalData.DeviceStatusChangeEvent += DeviceStatusChange;

View File

@@ -66,11 +66,11 @@ public abstract class BusinessBaseWithCacheIntervalDeviceModel<VarModel, DevMode
GlobalData.DeviceStatusChangeEvent -= DeviceStatusChange;
// 如果不是间隔上传,则订阅全局变量值改变事件和设备状态改变事件,并触发一次事件处理
if (_businessPropertyWithCacheInterval.BusinessUpdateEnum!= BusinessUpdateEnum.Interval)
if (_businessPropertyWithCacheInterval.BusinessUpdateEnum != BusinessUpdateEnum.Interval)
{
GlobalData.DeviceStatusChangeEvent += DeviceStatusChange;
GlobalData.VariableValueChangeEvent += VariableValueChange;
}
CollectDevices.ForEach(a =>
{
@@ -134,7 +134,7 @@ public abstract class BusinessBaseWithCacheIntervalDeviceModel<VarModel, DevMode
}
// 如果是间隔上传,根据定时器触发事件上传设备和变量信息
if (_businessPropertyWithCacheInterval.BusinessUpdateEnum!= BusinessUpdateEnum.Change)
if (_businessPropertyWithCacheInterval.BusinessUpdateEnum != BusinessUpdateEnum.Change)
{
try
{

View File

@@ -60,10 +60,10 @@ public abstract class BusinessBaseWithCacheIntervalVariableModel<T> : BusinessBa
// 注册变量值变化事件处理程序
GlobalData.VariableValueChangeEvent -= VariableValueChange;
if (_businessPropertyWithCacheInterval.BusinessUpdateEnum!= BusinessUpdateEnum.Interval)
if (_businessPropertyWithCacheInterval.BusinessUpdateEnum != BusinessUpdateEnum.Interval)
{
GlobalData.VariableValueChangeEvent += VariableValueChange;
}
// 触发一次变量值变化事件
CurrentDevice.VariableRunTimes.ForEach(a =>

View File

@@ -81,7 +81,7 @@ public interface IVariableService
/// <summary>
/// 创建n个modbus变量
/// </summary>
Task InsertTestDataAsync(int variableCount, int deviceCount,string slaveUrl="127.0.0.1:502");
Task InsertTestDataAsync(int variableCount, int deviceCount, string slaveUrl = "127.0.0.1:502");
/// <summary>
/// 表格查询

View File

@@ -318,7 +318,7 @@ public partial class VariablePage : IDisposable
{
await Task.Run(async () =>
{
await VariableService.InsertTestDataAsync(TestVariableCount,TestDeviceCount, SlaveUrl);
await VariableService.InsertTestDataAsync(TestVariableCount, TestDeviceCount, SlaveUrl);
await InvokeAsync(async () =>
{
await ToastService.Default();

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>7.2.0.93</Version>
<Version>7.2.0.94</Version>
</PropertyGroup>
<ItemGroup>