initial commit
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using System.IO;
|
||||
using Crysome.Common.Network.Packets;
|
||||
|
||||
namespace Crysome.Common.Network.FileTransfer;
|
||||
|
||||
public sealed class FtStartPacket : IPacket
|
||||
{
|
||||
public uint TransferId;
|
||||
|
||||
public string FileName;
|
||||
|
||||
public int TotalChunks;
|
||||
|
||||
public int ChunkSize;
|
||||
|
||||
public long TotalBytes;
|
||||
|
||||
public byte[] Sha256;
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(TransferId);
|
||||
w.Write(FileName ?? "");
|
||||
w.Write(TotalChunks);
|
||||
w.Write(ChunkSize);
|
||||
w.Write(TotalBytes);
|
||||
w.Write(Sha256 ?? new byte[32]);
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
TransferId = r.ReadUInt32();
|
||||
FileName = r.ReadString();
|
||||
TotalChunks = r.ReadInt32();
|
||||
ChunkSize = r.ReadInt32();
|
||||
TotalBytes = r.ReadInt64();
|
||||
Sha256 = r.ReadBytes(32);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user