using System;
using QCRPG.Framework;

namespace QCRPG.TSL.FMHCI.Packets;

public class SetSignalThresholdInfo : PacketInfoBase
{
	public override string Name => "Set Signal Threshold";

	public override string DisplayGroup => "Receiver Control";

	public SetSignalThresholdInfo(SetSignalThreshold packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		SetSignalThreshold setSignalThreshold = (SetSignalThreshold)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Signal Threshold", SignalThresholdInfo.SignalThresholdToDescription(), 8, FormatValue(setSignalThreshold.UserFields.SignalThreshold, 8), SignalThresholdInfo.SignalThresholdToString(SignalThresholdInfo.ValueToSignalThreshold(setSignalThreshold.UserFields.SignalThreshold)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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