using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LtPastExtremTimingRoundInfo : PacketInfoBase
{
	public override string Name => "Lt Past Extrem Timing Round";

	public override string DisplayGroup => "Vendor Specific";

	public LtPastExtremTimingRoundInfo(LtPastExtremTimingRound packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LtPastExtremTimingRound ltPastExtremTimingRound = (LtPastExtremTimingRound)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Sub OpCode", "PAST Extreme Timing test case", 8, FormatValue(ltPastExtremTimingRound.UserFields.SubOpcode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Round", LtPastExtremTimingRound.UserFieldsWrapper.RoundInfo.RoundToDescription(), 8, FormatValue(ltPastExtremTimingRound.UserFields.Round, 8), LtPastExtremTimingRound.UserFieldsWrapper.RoundInfo.RoundToString(LtPastExtremTimingRound.UserFieldsWrapper.RoundInfo.ValueToRound(ltPastExtremTimingRound.UserFields.Round)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		LtPastExtremTimingRound ltPastExtremTimingRound = (LtPastExtremTimingRound)packet;
		int num = -1;
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field SubOpcode");
		}
		if (index == ++num)
		{
			ltPastExtremTimingRound.UserFields.Round = Convert.ToUInt32(value, 16);
		}
	}
}
