mirror of
https://github.com/MikuLeaks/MikuSB.git
synced 2026-06-04 17:04:13 +00:00
enter intro cutscene
This commit is contained in:
51
TcpSharp/BasePacket.cs
Normal file
51
TcpSharp/BasePacket.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using Google.Protobuf;
|
||||
using MikuSB.Enums.Packet;
|
||||
|
||||
namespace MikuSB.TcpSharp;
|
||||
|
||||
public class BasePacket
|
||||
{
|
||||
public ushort CmdId { get; set; }
|
||||
public byte[] Body { get; set; }
|
||||
public ushort SeqNo { get; set; }
|
||||
public ushort PushSeq { get; set; }
|
||||
public long Timestamp { get; set; }
|
||||
public IMessage? Message { get; set; }
|
||||
public PacketFraming Framing { get; set; }
|
||||
|
||||
public BasePacket(ushort cmdId)
|
||||
{
|
||||
CmdId = cmdId;
|
||||
Body = Array.Empty<byte>();
|
||||
SeqNo = 0;
|
||||
PushSeq = 0;
|
||||
Timestamp = 0;
|
||||
Framing = PacketFraming.FourByteLittleEndianLength;
|
||||
}
|
||||
|
||||
public BasePacket(ushort cmdId, byte[] body, PacketFraming framing = PacketFraming.FourByteLittleEndianLength)
|
||||
{
|
||||
CmdId = cmdId;
|
||||
Body = body ?? Array.Empty<byte>();
|
||||
Framing = framing;
|
||||
SeqNo = 0;
|
||||
PushSeq = 0;
|
||||
Timestamp = 0;
|
||||
}
|
||||
|
||||
public void SetData(byte[] data)
|
||||
{
|
||||
Body = data;
|
||||
}
|
||||
|
||||
public void SetData(IMessage message)
|
||||
{
|
||||
Body = message.ToByteArray();
|
||||
Message = message;
|
||||
}
|
||||
|
||||
public void SetData(string base64)
|
||||
{
|
||||
SetData(Convert.FromBase64String(base64));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user