Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions BootstrapBlazor.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
<File Path="localization/de.json" />
<File Path="localization/es.json" />
<File Path="localization/pt.json" />
<File Path="localization/ru-RU.json" />
<File Path="localization/th-TH.json" />
<File Path="localization/uk-UA.json" />
<File Path="localization/zh-TW.json" />
</Folder>
<Folder Name="/scripts/" />
Expand Down
12 changes: 6 additions & 6 deletions src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,22 @@
<PackageReference Include="BootstrapBlazor.RDKit" Version="9.0.2" />
<PackageReference Include="BootstrapBlazor.SignaturePad" Version="9.0.1" />
<PackageReference Include="BootstrapBlazor.SmilesDrawer" Version="9.0.2" />
<PackageReference Include="BootstrapBlazor.Socket" Version="9.0.14" />
<PackageReference Include="BootstrapBlazor.Sortable" Version="9.0.3" />
<PackageReference Include="BootstrapBlazor.Splitting" Version="9.0.3" />
<PackageReference Include="BootstrapBlazor.SvgEditor" Version="9.0.4" />
<PackageReference Include="BootstrapBlazor.SummerNote" Version="9.0.7" />
<PackageReference Include="BootstrapBlazor.TableExport" Version="9.2.6" />
<PackageReference Include="BootstrapBlazor.Tasks.Dashboard" Version="9.0.0" />
<PackageReference Include="BootstrapBlazor.TcpSocket" Version="9.0.5" />
<PackageReference Include="BootstrapBlazor.Topology" Version="9.0.1" />
<PackageReference Include="BootstrapBlazor.UniverIcon" Version="9.0.1" />
<PackageReference Include="BootstrapBlazor.UniverSheet" Version="9.0.5" />
<PackageReference Include="BootstrapBlazor.Vditor" Version="9.0.0" />
<PackageReference Include="BootstrapBlazor.VideoPlayer" Version="9.0.3" />
<PackageReference Include="BootstrapBlazor.WinBox" Version="9.0.7" />
<PackageReference Include="Longbow.Logging" Version="9.0.1" />
<PackageReference Include="Longbow.Socket" Version="9.0.1" />
<PackageReference Include="Longbow.Tasks" Version="9.0.2" />
<PackageReference Include="Longbow.TcpSocket" Version="9.0.1" />
</ItemGroup>

<ItemGroup>
Expand All @@ -97,10 +97,10 @@
<Using Include="BootstrapBlazor.Server.Data" />
<Using Include="BootstrapBlazor.Server.Extensions" />
<Using Include="BootstrapBlazor.Server.Services" />
<Using Include="BootstrapBlazor.Socket.DataAdapters" />
<Using Include="BootstrapBlazor.Socket.DataConverters" />
<Using Include="BootstrapBlazor.Socket.DataHandlers" />
<Using Include="BootstrapBlazor.TcpSocket" />
<Using Include="Longbow.Socket.DataAdapters" />
<Using Include="Longbow.Socket.DataConverters" />
<Using Include="Longbow.Socket.DataHandlers" />
<Using Include="Longbow.TcpSocket" />
<Using Include="Microsoft.AspNetCore.Components" />
<Using Include="Microsoft.Extensions.Configuration" />
<Using Include="Microsoft.Extensions.DependencyInjection" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<h3>Tcp 套接字服务 <code>ITcpSocketFactory</code></h3>
<h4>组件库内置了 Socket 套接字通讯服务</h4>

<PackageTips Name="BootstrapBlazor.TcpSocket" />
<PackageTips Name="Longbow.TcpSocket" />

<p class="code-label">1. 服务注入</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<Pre>// 数据适配器内部使用固定长度数据处理器
private readonly DataPackageAdapter _dataAdapter = new(new FixLengthDataPackageHandler(12));

_dataAdapter.ReceivedCallBack = async Data =>
_dataAdapter.ReceivedCallback = async Data =>
{
// 此处接收到的数据 Data 为完整响应数据
};</Pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected override void OnInitialized()
});

// 此处代码分开写是为了判断 _useDataAdapter 参数
_client.ReceivedCallBack += OnReceivedAsync;
_client.ReceivedCallback += OnReceivedAsync;
_dataAdapter.ReceivedCallBack = UpdateReceiveLog;

// 实战中可以通过下面一句话设置数据适配器与回调方法
Expand Down Expand Up @@ -142,7 +142,7 @@ private void Dispose(bool disposing)
{
if (disposing)
{
_client.ReceivedCallBack -= OnReceivedAsync;
_client.ReceivedCallback -= OnReceivedAsync;

// 释放连接令牌资源
_connectTokenSource.Cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
<li>点击 <b>连接</b> 按钮后通过 <code>ITcpSocketFactory</code> 服务实例(<a href="/socket-factory" target="_blank">传送门</a>)创建的 <code>ITcpSocketClient</code> 对象连接到网站模拟 <code>TcpServer</code></li>
<li>点击 <b>断开</b> 按钮调用 <code>CloseAsync</code> 方法断开 Socket 连接</li>
</ul>
<p>使用 <code>ReceivedCallBack</code> 委托获得接收到的数据,可通过 <code>+=</code> 方法支持多个客户端接收数据</p>
<Pre>_client.ReceivedCallBack += OnReceivedAsync;</Pre>
<p>使用 <code>ReceivedCallback</code> 委托获得接收到的数据,可通过 <code>+=</code> 方法支持多个客户端接收数据</p>
<Pre>_client.ReceivedCallback += OnReceivedAsync;</Pre>
<p>特别注意如果当前页面对 <code>ISocketClient</code> 实例不销毁时需要继承 <code>IDisposable</code> 或者 <code>IAsyncDisposable</code> 接口,在 <code>Dispose</code> 或者 <code>DisposeAsync</code> 中移除委托,以防止内存泄露</p>
<Pre>private void Dispose(bool disposing)
{
if (disposing)
{
if (_client is { IsConnected: true })
{
_client.ReceivedCallBack -= OnReceivedAsync;
_client.ReceivedCallback -= OnReceivedAsync;
}
}
}</Pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected override void OnInitialized()
{
options.LocalEndPoint = new IPEndPoint(IPAddress.Loopback, 0);
});
_client.ReceivedCallBack += OnReceivedAsync;
_client.ReceivedCallback += OnReceivedAsync;
}

private async Task OnConnectAsync()
Expand Down Expand Up @@ -81,7 +81,7 @@ private void Dispose(bool disposing)
{
if (_client is { IsConnected: true })
{
_client.ReceivedCallBack -= OnReceivedAsync;
_client.ReceivedCallback -= OnReceivedAsync;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected override void OnInitialized()
options.IsAutoReconnect = true;
options.ReconnectInterval = 5000;
});
_client.ReceivedCallBack += OnReceivedAsync;
_client.ReceivedCallback += OnReceivedAsync;
_client.OnConnecting = async () =>
{
_items.Add(new ConsoleMessageItem { Message = $"{DateTime.Now} 正在连接到 {_serverEndPoint},请稍候..." });
Expand Down Expand Up @@ -93,7 +93,7 @@ private void Dispose(bool disposing)
{
if (_client is { IsConnected: true })
{
_client.ReceivedCallBack -= OnReceivedAsync;
_client.ReceivedCallback -= OnReceivedAsync;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
<p><code>ITcpSocketFactory</code> 服务仅在 <code>Server</code> 模式下可用</p>
</Tips>

<PackageTips Name="BootstrapBlazor.TcpSocket" />
<PackageTips Name="Longbow.TcpSocket" />
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public static IServiceCollection AddBootstrapBlazorServices(this IServiceCollect
services.AddBootstrapBlazorJuHeIpLocatorService();

// 增加 ITcpSocketFactory 服务
services.AddBootstrapBlazorTcpSocketFactory();
services.AddTcpSocketFactory();

// 增加 PetaPoco ORM 数据服务操作类
// 需要时打开下面代码
Expand Down
Loading