using System.IO;

namespace Crysome.Common.Network.Packets.Server;

public class RdpSetQualityPacket : IPacket
{
	public int Quality { get; set; } = 80;

	public int IntervalMs { get; set; }

	public RdpSetQualityPacket()
	{
	}

	public RdpSetQualityPacket(int quality, int intervalMs = 0)
	{
		Quality = quality;
		IntervalMs = intervalMs;
	}

	public void Write(BinaryWriter w)
	{
		w.Write(Quality);
		w.Write(IntervalMs);
	}

	public void Read(BinaryReader r)
	{
		Quality = r.ReadInt32();
		if (r.BaseStream.Position < r.BaseStream.Length)
		{
			IntervalMs = r.ReadInt32();
		}
	}
}
