Начало трансляции сервероного кода к новому протоколу

This commit is contained in:
RoyceDa
2026-04-18 17:50:23 +02:00
parent 068492b56d
commit 33582e2730
123 changed files with 3380 additions and 2745 deletions

View File

@@ -0,0 +1,40 @@
package im.rosetta.network.codec;
import io.orprotocol.ProtocolException;
import io.orprotocol.buffer.Buffer;
import io.orprotocol.codec.Codec;
import io.orprotocol.tlv.read.TlvReader;
import io.orprotocol.tlv.write.TlvWriter;
import im.rosetta.network.packet.PacketGroupBan;
// Auto-generated by RCC (Rosetta Code Compiler). Do not edit manually.
public class PacketGroupBanCodec implements Codec<PacketGroupBan> {
private static final int F_GROUP_ID = 1;
private static final int F_PUBLIC_KEY = 2;
@Override
public PacketGroupBan decode(Buffer data, int version) throws ProtocolException {
byte[] payload = data.readBytes(data.remaining());
TlvReader reader = new TlvReader(payload);
PacketGroupBan packet = new PacketGroupBan();
if (version >= 1) {
packet.groupId = reader.getString(F_GROUP_ID);
}
if (version >= 1) {
packet.publicKey = reader.getString(F_PUBLIC_KEY);
}
return packet;
}
@Override
public byte[] encode(PacketGroupBan packet, int version) throws ProtocolException {
TlvWriter writer = new TlvWriter();
if (version >= 1) {
if (packet.groupId != null) writer.writeString(F_GROUP_ID, packet.groupId);
}
if (version >= 1) {
if (packet.publicKey != null) writer.writeString(F_PUBLIC_KEY, packet.publicKey);
}
return writer.toByteArray();
}
}