CodeWF.NetWeaver
2.0.7
dotnet add package CodeWF.NetWeaver --version 2.0.7
NuGet\Install-Package CodeWF.NetWeaver -Version 2.0.7
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CodeWF.NetWeaver" Version="2.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CodeWF.NetWeaver" Version="2.0.7" />
<PackageReference Include="CodeWF.NetWeaver" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CodeWF.NetWeaver --version 2.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CodeWF.NetWeaver, 2.0.7"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CodeWF.NetWeaver@2.0.7
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CodeWF.NetWeaver&version=2.0.7
#tool nuget:?package=CodeWF.NetWeaver&version=2.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CodeWF.NetWeaver
CodeWF.NetWeaver 是一个简洁而强大的C#库,支持AOT,用于处理TCP和UDP数据包的组包和解包操作。
CodeWF.NetWeaver is a concise and powerful C# library that supports AOT for handling TCP and UDP packet grouping and unpacking operations.
安装(Installer)
NuGet\Install-Package CodeWF.NetWeaver -Version 1.3.0
定义通信对象(Define net object)
定义数据包如下(来自单元测试CodeWF.NetWeaver.Tests),ResponseProcessList类继承自INetObject, NetHead配置数据包标识和版本
[NetHead(10, 1)]
public class ResponseProcessList : INetObject
{
public int TaskId { get; set; }
public int TotalSize { get; set; }
public int PageSize { get; set; }
public int PageCount { get; set; }
public int PageIndex { get; set; }
public List<ProcessItem>? Processes { get; set; }
}
public record ProcessItem
{
public int Pid { get; set; }
public string? Name { get; set; }
public byte Type { get; set; }
public byte ProcessStatus { get; set; }
public byte AlarmStatus { get; set; }
public string? Publisher { get; set; }
public string? CommandLine { get; set; }
public short Cpu { get; set; }
public short Memory { get; set; }
public short Disk { get; set; }
public short Network { get; set; }
public short Gpu { get; set; }
public byte GpuEngine { get; set; }
public byte PowerUsage { get; set; }
public byte PowerUsageTrend { get; set; }
public uint LastUpdateTime { get; set; }
public uint UpdateTime { get; set; }
}
使用(Use)
单元测试数据组包与解包:
[Fact]
public void Test_SerializeResponseProcessList_Success()
{
var netObject = new ResponseProcessList
{
TaskId = 3,
TotalSize = 200,
PageSize = 3,
PageCount = 67,
PageIndex = 1,
Processes = new List<ProcessItem>()
};
var processItem = new ProcessItem
{
Pid = 1,
Name = "CodeWF.NetWeaver",
Type = (byte)ProcessType.Application,
ProcessStatus = (byte)ProcessStatus.Running,
Publisher = "沙漠尽头的狼",
CommandLine = "dotnet CodeWF.com",
Cpu = 112,
Memory = 325,
Disk = 23,
Network = 593,
Gpu = 253,
GpuEngine = (byte)GpuEngine.None,
PowerUsage = (byte)PowerUsage.Low,
PowerUsageTrend = (byte)PowerUsage.Low,
LastUpdateTime = 23,
UpdateTime = 53
};
netObject.Processes.Add(processItem);
var buffer = netObject.Serialize(32);
var desObject = buffer.Deserialize<ResponseProcessList>();
Assert.Equal(netObject.TotalSize, desObject.TotalSize);
Assert.NotNull(desObject.Processes);
Assert.Equal(processItem.Cpu, desObject.Processes[0].Cpu);
Assert.Equal(processItem.LastUpdateTime, desObject.Processes[0].LastUpdateTime);
}
参考
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on CodeWF.NetWeaver:
| Package | Downloads |
|---|---|
|
CodeWF.EventBus.Socket
Distributed event bus implemented using Socket, independent of third-party MQ. |
|
|
CodeWF.NetWrapper
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.7 | 0 | 12/14/2025 |
| 2.0.6 | 38 | 12/13/2025 |
| 2.0.3 | 380 | 12/10/2025 |
| 2.0.2 | 386 | 12/10/2025 |
| 2.0.1 | 393 | 12/10/2025 |
| 2.0.0.1 | 181 | 11/4/2025 |
| 2.0.0 | 203 | 9/5/2025 |
| 1.3.1 | 247 | 5/8/2025 |
| 1.3.0 | 832 | 9/21/2024 |
| 1.2.1 | 151 | 9/19/2024 |
| 1.2.0 | 169 | 9/19/2024 |
| 1.1.1.1 | 172 | 9/13/2024 |
| 1.1.1 | 151 | 7/27/2024 |
| 1.1.0 | 179 | 7/9/2024 |
| 1.0.0 | 156 | 6/12/2024 |