using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class ReadLocalExtendedFeaturesInfo : PacketInfoBase
{
	public override string Name => "Read Local Extended Features";

	public override string DisplayGroup => "Information Parameters";

	public ReadLocalExtendedFeaturesInfo(ReadLocalExtendedFeatures packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		ReadLocalExtendedFeatures readLocalExtendedFeatures = (ReadLocalExtendedFeatures)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Page Number", ReadLocalExtendedFeatures.UserFieldsWrapper.PageNumberInfo.PageNumberToDescription(), 8, FormatValue(readLocalExtendedFeatures.UserFields.PageNumber, 8), ReadLocalExtendedFeatures.UserFieldsWrapper.PageNumberInfo.PageNumberToString(ReadLocalExtendedFeatures.UserFieldsWrapper.PageNumberInfo.ValueToPageNumber(readLocalExtendedFeatures.UserFields.PageNumber)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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