using System.IO;

namespace Crysome.Common.Network.Packets.Server;

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

	public long RequestId { get; set; }

	public GetDirectoryRequestPacket()
	{
	}

	public GetDirectoryRequestPacket(string path, long requestId = 0L)
	{
		Path = path;
		RequestId = requestId;
	}

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

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