XFEExtension
【DLL】XFE各类拓展是一个C#的DLL库,旨在优化C#代码中常用语句的使用,并提供更简洁的访问方式,同时提供Xunit测试框架,快速搭建服务器/客户端,免费ChatGPTAPI接口,免费通讯服务器,XFE下载器,新增格式等
关注
0
Fork
0
Star
0
返回提交历史
Modified
XFE各类拓展/BufferExtension.cs
+29
-0
Modified
XFE各类拓展/CyberComm.cs
+20
-0
XFEstudio/XFEExtension
更新协议 Buffer操作新增Split方法
2323b1e
代码差异
2 个文件
+49
-0
@@ -101,5 +101,34 @@ namespace XFE各类拓展
101
101
}
102
102
return newBuffer;
103
103
}
104
/// <summary>
105
/// 分割Buffer
106
/// </summary>
107
/// <param name="buffer"></param>
108
/// <param name="targetBuffer">分割器</param>
109
/// <returns></returns>
110
public static List<byte[]> Split(this byte[] buffer, byte[] targetBuffer)
111
{
112
var list = new List<byte[]>();
113
var indexes = IndexesOf(buffer, targetBuffer);
114
int index = 0;
115
for (int i = 0; i < indexes.Length; i++)
116
{
117
var newBuffer = new byte[indexes[i] - index];
118
for (int j = index; j < indexes[i]; j++)
119
{
120
newBuffer[j - index] = buffer[j];
121
}
122
list.Add(newBuffer);
123
index = indexes[i] + targetBuffer.Length;
124
}
125
var lastBuffer = new byte[buffer.Length - index];
126
for (int i = index; i < buffer.Length; i++)
127
{
128
lastBuffer[i - index] = buffer[i];
129
}
130
list.Add(lastBuffer);
131
return list;
132
}
104
133
}
105
134
}
@@ -1309,6 +1309,26 @@ namespace XFE各类拓展.CyberComm
1309
1309
/// </summary>
1310
1310
public XCCGroup Group { get; }
1311
1311
/// <summary>
1312
/// 群组ID
1313
/// </summary>
1314
public string GroupId
1315
{
1316
get
1317
{
1318
return Group.GroupId;
1319
}
1320
}
1321
/// <summary>
1322
/// 发送者
1323
/// </summary>
1324
public string Sender
1325
{
1326
get
1327
{
1328
return Group.Sender;
1329
}
1330
}
1331
/// <summary>
1312
1332
/// 二进制消息
1313
1333
/// </summary>
1314
1334
public byte[] BinaryMessage { get; }