using System.IO;

namespace Crysome.Common.Network.Packets.Server;

public class ReadFileRequestPacket : IPacket
{
	public string Path { get; set; }

	public long TransferId { get; set; }

	public ReadFileRequestPacket()
	{
	}

	public ReadFileRequestPacket(string path, long transferId = 0L)
	{
		Path = path ?? "";
		TransferId = transferId;
	}

	public void Write(BinaryWriter w)
	{
		w.Write(Path ?? "");
		w.Write(TransferId);
	}

	public void Read(BinaryReader r)
	{
		Path = r.ReadString();
		TransferId = ((r.BaseStream.Position < r.BaseStream.Length) ? r.ReadInt64() : 0);
	}
}
