Skip to content

Class ApiPacket ​

Namespace: Tool.Sockets.NetFrame
Assembly: Tool.Net.dll

接口请求数据包

csharp
public class ApiPacket

Inheritance ​

object ← ApiPacket

Inherited Members ​

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Extension Methods ​

ObjectExtension.Add<T>(object, object, object), ObjectExtension.CopyEntity(object, object, params string[]), ObjectExtension.EntityToJson(object), ObjectExtension.EntityToJson(object, bool), ObjectExtension.EntityToJson(object, bool, string), DictionaryExtension.GetDictionary(object), TypeExtension.GetFieldKey(object, string, out bool), TypeExtension.GetFieldKey<T>(object, string, out bool), TypeExtension.GetFieldKey(object, Type, string, out bool), ObjectExtension.GetIntPtr(object), ObjectExtension.GetIntPtrInt(object), TypeExtension.GetPropertieFind(object, string, bool), TypeExtension.GetProperties(object), TypeExtension.GetPropertyKey(object, string, out bool), TypeExtension.GetPropertyKey<T>(object, string, out bool), TypeExtension.GetPropertyKey(object, Type, string, out bool), TypeExtension.GetValue(object, PropertyDescriptor), TypeExtension.GetValue(object, string, bool), TypeExtension.GetValue(object, string), ObjectExtension.Read<T>(object, object, int, int), ObjectExtension.Read<T>(object, int, object, int, int), DictionaryExtension.SetDictionary(object, IDictionary<string, object>), TypeExtension.SetFieldKey(object, string, object), TypeExtension.SetFieldKey<T>(object, string, object), TypeExtension.SetFieldKey(object, Type, string, object), TypeExtension.SetPropertyKey(object, string, object), TypeExtension.SetPropertyKey<T>(object, string, object), TypeExtension.SetPropertyKey(object, Type, string, object), TypeExtension.SetValue(object, PropertyDescriptor, object), TypeExtension.SetValue(object, string, object, bool), TypeExtension.SetValue(object, string, object), ObjectExtension.ToBase64String(object), ObjectExtension.ToBytes(object), ObjectExtension.ToBytes(object, out Type), DictionaryExtension.ToDictionary(object), DictionaryExtension.ToDictionary<T>(object), DictionaryExtension.ToIDictionary(object), DictionaryExtension.ToIDictionary<T>(object), ObjectExtension.ToJson(object), ObjectExtension.ToJson(object, JsonSerializerOptions), ObjectExtension.ToJsonWeb(object), ObjectExtension.ToJsonWeb(object, Action<JsonSerializerOptions>), ObjectExtension.ToTryVar<T>(object, T), ObjectExtension.ToVar<T>(object), ObjectExtension.ToVar(object, Type, bool), ObjectExtension.ToVar(object, string), ObjectExtension.ToXml(object)

Remarks ​

代码由逆血提供支持

Constructors ​

ApiPacket(byte, byte) ​

数据包初始化

csharp
public ApiPacket(byte ClassID, byte ActionID)

Parameters ​

ClassID byte

类ID

ActionID byte

方法ID

ApiPacket(byte, byte, int) ​

数据包初始化

csharp
public ApiPacket(byte ClassID, byte ActionID, int Millisecond)

Parameters ​

ClassID byte

类ID

ActionID byte

方法ID

Millisecond int

请求等待的毫秒

ApiPacket(byte, byte, int, bool) ​

数据包初始化

csharp
public ApiPacket(byte ClassID, byte ActionID, int Millisecond, bool IsReply)

Parameters ​

ClassID byte

类ID

ActionID byte

方法ID

Millisecond int

请求等待的毫秒

IsReply bool

是否需要有回复消息

Properties ​

ActionID ​

请求的方法ID

csharp
public byte ActionID { get; }

Property Value ​

byte

Bytes ​

当前消息携带的数据流

csharp
public ArraySegment<byte> Bytes { get; set; }

Property Value ​

ArraySegment<byte>

ClassID ​

请求的类ID

csharp
public byte ClassID { get; }

Property Value ​

byte

IsReply ​

是否需要有回复消息

csharp
public bool IsReply { get; }

Property Value ​

bool

Millisecond ​

默认等待超时时间为60秒

csharp
public int Millisecond { get; }

Property Value ​

int

Methods ​

Remove(string) ​

从发送数据中移除所指定的键的值

csharp
public bool Remove(string key)

Parameters ​

key string

键

Returns ​

bool

是否成功移除

Set(string, object) ​

加入数据(如果有则修改)

csharp
public void Set(string key, object value)

Parameters ​

key string

键

value object

值(支持传输转义)

Set(object) ​

加入数据,如果有则修改(以虚构对象参数传入,请确保已认真读注释。)(支持传输转义)

csharp
public void Set(object dictionary)

Parameters ​

dictionary object

虚构对象

TryGet(string, out string) ​

获取键的值

csharp
public bool TryGet(string key, out string value)

Parameters ​

key string

键

value string

要返回的值

Returns ​

bool

是否存在

基于Apache-2.0协议开源