using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class ReadEncryptionKeySizeInfo : PacketInfoBase
{
	public override string Name => "Read Encryption Key Size";

	public override string DisplayGroup => "Status Parameters";

	public ReadEncryptionKeySizeInfo(ReadEncryptionKeySize packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		ReadEncryptionKeySize readEncryptionKeySize = (ReadEncryptionKeySize)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Connection_Handle", "Connection_Handle for the encryption key size to be read from. Range: 0x0000-0x0EFF (0x0F00 - 0x0FFF Reserved for future use)", 16, FormatValue(readEncryptionKeySize.UserFields.ConnectionHandle, 16), "", "0000", "0EFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		ReadEncryptionKeySize readEncryptionKeySize = (ReadEncryptionKeySize)packet;
		int num = -1;
		if (index == ++num)
		{
			readEncryptionKeySize.UserFields.ConnectionHandle = Convert.ToUInt32(value, 16);
		}
	}
}
