33 lines
634 B
C#
33 lines
634 B
C#
using System.IO;
|
|
|
|
namespace Crysome.Common.Network.Packets.Server;
|
|
|
|
public class WriteFileRequestPacket : IPacket
|
|
{
|
|
public string DestPath { get; set; }
|
|
|
|
public long TransferId { get; set; }
|
|
|
|
public byte[] Data { get; set; }
|
|
|
|
public void Write(BinaryWriter w)
|
|
{
|
|
w.Write(DestPath ?? "");
|
|
w.Write(TransferId);
|
|
int num = ((Data != null) ? Data.Length : 0);
|
|
w.Write(num);
|
|
if (num > 0)
|
|
{
|
|
w.Write(Data);
|
|
}
|
|
}
|
|
|
|
public void Read(BinaryReader r)
|
|
{
|
|
DestPath = r.ReadString();
|
|
TransferId = r.ReadInt64();
|
|
int num = r.ReadInt32();
|
|
Data = ((num > 0) ? r.ReadBytes(num) : null);
|
|
}
|
|
}
|