using System;
using QCRPG.Framework;

namespace QCRPG.TSL.FMHCI.Packets;

public class SsbiPeekRegisterInfo : PacketInfoBase
{
	public override string Name => "Ssbi Peek Register";

	public override string DisplayGroup => "Diagnostic";

	public SsbiPeekRegisterInfo(SsbiPeekRegister packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		SsbiPeekRegister ssbiPeekRegister = (SsbiPeekRegister)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Address", "Register address, 10 bit", 16, FormatValue(ssbiPeekRegister.UserFields.Address, 16), "", "", "3FF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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