using System;
using QCRPG.Framework;

namespace QCRPG.TSL.FMHCI.Packets;

public class SetInternalToneGeneratorInfo : PacketInfoBase
{
	public override string Name => "Set Internal Tone Generator";

	public override string DisplayGroup => "Diagnostic";

	public SetInternalToneGeneratorInfo(SetInternalToneGenerator packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		SetInternalToneGenerator setInternalToneGenerator = (SetInternalToneGenerator)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Tone", SetInternalToneGenerator.UserFieldsWrapper.ToneInfo.ToneToDescription(), 8, FormatValue(setInternalToneGenerator.UserFields.Tone, 8), SetInternalToneGenerator.UserFieldsWrapper.ToneInfo.ToneToString(SetInternalToneGenerator.UserFieldsWrapper.ToneInfo.ValueToTone(setInternalToneGenerator.UserFields.Tone)), "", "7", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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