Skip to content

Commit 7930e98

Browse files
committed
refactor: 代码重构
1 parent 8c17d57 commit 7930e98

5 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/extensions/BootstrapBlazor.OpcDa/Extensions/ServiceCollectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace Microsoft.Extensions.DependencyInjection;
99

1010
/// <summary>
11-
/// Opc Da 服务扩展类
11+
/// OpcDaServer 服务扩展类
1212
/// </summary>
1313
public static class ServiceCollectionExtensions
1414
{

src/extensions/BootstrapBlazor.OpcDa/IOpcDaServer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace BootstrapBlazor.OpcDa;
66

77
/// <summary>
8-
/// Opc Server 接口定义
8+
/// OpcDaServer 接口定义
99
/// </summary>
1010
public interface IOpcDaServer : IDisposable
1111
{

src/extensions/BootstrapBlazor.OpcDa/Mock/MockOpcDaServer.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
1+
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33
// Website: https://www.blazor.zone or https://argozhang.github.io/
44

@@ -52,16 +52,17 @@ public void CancelSubscription(IOpcSubscription subscription)
5252
public HashSet<OpcReadItem> Read(params HashSet<string> items)
5353
{
5454
return items.Select(i => new OpcReadItem(i, Quality.Good, DateTime.Now, Random.Shared.Next(1000, 2000)))
55-
.ToHashSet(OpcItemEqualityComparer<OpcReadItem>.Default);
55+
.ToHashSet(OpcItemEqualityComparer<OpcReadItem>.Default);
5656
}
5757

5858
public HashSet<OpcWriteItem> Write(params HashSet<OpcWriteItem> items)
5959
{
6060
return items.Select(i => new OpcWriteItem(i.Name, i.Value) { Result = true })
61-
.ToHashSet(OpcItemEqualityComparer<OpcWriteItem>.Default);
61+
.ToHashSet(OpcItemEqualityComparer<OpcWriteItem>.Default);
6262
}
6363

6464
public void Dispose()
6565
{
66+
6667
}
6768
}

src/extensions/BootstrapBlazor.OpcDa/Mock/MockOpcSubscription.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
1+
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33
// Website: https://www.blazor.zone or https://argozhang.github.io/
44

@@ -54,8 +54,7 @@ private async Task DoTask(CancellationToken token)
5454

5555
await Task.Delay(_updateRate, token);
5656
}
57-
catch (OperationCanceledException) { }
58-
catch (Exception)
57+
catch (OperationCanceledException)
5958
{
6059
// ignored
6160
}

src/extensions/BootstrapBlazor.OpcDa/OpcSubscription.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace BootstrapBlazor.OpcDa;
66

7-
class OpcSubscription(Opc.Da.ISubscription subscription) : IOpcSubscription
7+
sealed class OpcSubscription(Opc.Da.ISubscription subscription) : IOpcSubscription
88
{
99
public Action<List<OpcReadItem>>? DataChanged { get; set; }
1010

0 commit comments

Comments
 (0)