using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class DisconnectLogicalLinkInfo : PacketInfoBase
{
	public override string Name => "Disconnect Logical Link";

	public override string DisplayGroup => "Link Control";

	public DisconnectLogicalLinkInfo(DisconnectLogicalLink packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		DisconnectLogicalLink disconnectLogicalLink = (DisconnectLogicalLink)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Logical_Link_Handle", DisconnectLogicalLink.UserFieldsWrapper.LogicalLinkHandleInfo.LogicalLinkHandleToDescription(), 16, FormatValue(disconnectLogicalLink.UserFields.LogicalLinkHandle, 16), DisconnectLogicalLink.UserFieldsWrapper.LogicalLinkHandleInfo.LogicalLinkHandleToString(DisconnectLogicalLink.UserFieldsWrapper.LogicalLinkHandleInfo.ValueToLogicalLinkHandle(disconnectLogicalLink.UserFields.LogicalLinkHandle)), "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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