initial commit
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Server;
|
||||
|
||||
public class SendFileRequestPacket : IPacket
|
||||
{
|
||||
public string Filename { get; set; }
|
||||
|
||||
public byte[] FileData { get; set; }
|
||||
|
||||
public SendFileRequestPacket()
|
||||
{
|
||||
}
|
||||
|
||||
public SendFileRequestPacket(string filename, byte[] fileData)
|
||||
{
|
||||
Filename = filename;
|
||||
FileData = fileData;
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(Filename ?? "");
|
||||
w.Write((FileData != null) ? FileData.Length : 0);
|
||||
if (FileData != null)
|
||||
{
|
||||
w.Write(FileData);
|
||||
}
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
Filename = r.ReadString();
|
||||
int count = r.ReadInt32();
|
||||
FileData = r.ReadBytes(count);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user