using System.IO;

namespace Crysome.Common.Network.Packets.Client;

public class TakeScreenshotResponsePacket : IPacket
{
	public byte[] ImageData { get; set; }

	public TakeScreenshotResponsePacket()
	{
	}

	public TakeScreenshotResponsePacket(byte[] imageData)
	{
		ImageData = imageData;
	}

	public void Write(BinaryWriter w)
	{
		w.Write((ImageData != null) ? ImageData.Length : 0);
		if (ImageData != null)
		{
			w.Write(ImageData);
		}
	}

	public void Read(BinaryReader r)
	{
		int count = r.ReadInt32();
		ImageData = r.ReadBytes(count);
	}
}
