更新了网络服务接口定义

This commit is contained in:
CortexCore
2023-06-07 02:02:14 +08:00
parent 08b05f8a74
commit b2444fd909
2727 changed files with 20455 additions and 4448 deletions

View File

@@ -0,0 +1,33 @@
using System.Collections;
using System.Collections.Generic;
using System.IO;
namespace BITKit
{
public class IEnumerableSupport:NetMessageReader<object[]>
{
public override object[] ReadBinary(BinaryReader reader)
{
var length = reader.ReadInt32();
var objects = new object[length];
for (int i = 0; i < length; i++)
{
var count = reader.Read();
objects[i] = BITBinary.ReadAsValue(reader.ReadBytes(count));
}
return objects;
}
public override void WriteBinary(BinaryWriter writer, object[] value)
{
writer.Write(value.Length);
foreach (var x in value)
{
var bytes = BITBinary.WriteAsBytes(x);
writer.Write(bytes.Length);
writer.Write(bytes);
}
}
}
}