using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace QCRPG.Framework;

public class PacketUserControl : UserControlBase, IConfigurable
{
	private const int rawBytesTextBoxPanelHeight = 42;

	private const int maxToolTipTimeMs = 32766;

	private List<PacketBase> packetList;

	private List<Type> typesToHideList;

	private PacketBase selectedPacket;

	private Dictionary<TreeNode, PacketBase> treeNodeToPacketInfoMap = new Dictionary<TreeNode, PacketBase>();

	private Dictionary<ListViewItem, PacketBase> listViewItemToPacketInfoMap = new Dictionary<ListViewItem, PacketBase>();

	private GenericNotifier<PacketBase> sendPacketNotifier = new GenericNotifier<PacketBase>();

	private GenericNotifier<PacketBase> decodePacketNotifier = new GenericNotifier<PacketBase>();

	private ToolTip toolTip = new ToolTip();

	private string toolTipShown = "";

	private Color fixedFieldColor = Color.LightGray;

	private Color fieldOmittedFromTransportColor = Color.LightCyan;

	private LinkedList<TreeNode> treeNodeForSearch = new LinkedList<TreeNode>();

	private TreeNode currentTreeNode = new TreeNode();

	private bool userMovedSplitter;

	private int horizontalSplitterDistance;

	private IContainer components;

	private SplitContainer splitContainerHorizontal;

	private TextBox textBoxPacketRawBytes;

	private Button buttonSendPacket;

	private ListView listViewCurrentPacket;

	private SplitContainer splitContainerVertical;

	private Label labelCurrentPacket;

	private Button buttonDecode;

	private SplitContainer splitContainerHorizontalInPacketUserControl;

	private TreeView treeViewPacketList;

	private Button buttonPacketSearch;

	private Button buttonNextPacket;

	private Button buttonPreviousPacket;

	private Button buttonClearHistory;

	private ComboBox comboBoxPacketSearch;

	public bool ShowRawBytesView
	{
		get
		{
			return textBoxPacketRawBytes.Visible;
		}
		set
		{
			textBoxPacketRawBytes.Visible = value;
			ResizeHandler();
		}
	}

	public int HorizontalSplitterDistance
	{
		get
		{
			return horizontalSplitterDistance;
		}
		set
		{
			horizontalSplitterDistance = value;
			ResizeHandler();
		}
	}

	public PacketUserControl()
		: base("Packets")
	{
		InitializeComponent();
		toolTip.SetToolTip(listViewCurrentPacket, "");
		toolTip.AutoPopDelay = 32766;
	}

	public PacketUserControl(List<PacketBase> packetList)
		: base("Packets")
	{
		InitializeComponent();
		SetPacketList(packetList);
		toolTip.SetToolTip(listViewCurrentPacket, "");
		toolTip.AutoPopDelay = 32766;
	}

	public Configuration GetConfiguration()
	{
		Configuration configuration = new Configuration();
		int count = comboBoxPacketSearch.Items.Count;
		configuration.SetInt("PacketHistoryCount", count);
		for (int i = 1; i <= count; i++)
		{
			string name = $"PacketHistoryItem{i}";
			configuration.SetString(name, comboBoxPacketSearch.Items[i - 1].ToString());
		}
		return configuration;
	}

	public void SetConfiguration(Configuration configuration)
	{
		int @int = configuration.GetInt("PacketHistoryCount", 1);
		for (int i = 1; i <= @int; i++)
		{
			string name = $"PacketHistoryItem{i}";
			string @string = configuration.GetString(name, comboBoxPacketSearch.Text);
			if (!comboBoxPacketSearch.Items.Contains(@string))
			{
				comboBoxPacketSearch.Items.Add(@string);
			}
		}
	}

	public void EnableDecodeClick(bool buttonEnable)
	{
		buttonDecode.Enabled = buttonEnable;
	}

	public void RegisterDecodePacketClickedObserver(IObserver<PacketBase> observer)
	{
		decodePacketNotifier.RegisterObserver(observer);
	}

	public void UnregisterDecodePacketClickedObserver(IObserver<PacketBase> observer)
	{
		decodePacketNotifier.UnregisterObserver(observer);
	}

	private void NotifyDecodePacketClickedObservers(PacketBase packet)
	{
		if (packet != null)
		{
			decodePacketNotifier.NotifyObservers(packet);
			string name = packet.Info.Name;
			if (!string.IsNullOrWhiteSpace(name) && !comboBoxPacketSearch.Items.Contains(name))
			{
				comboBoxPacketSearch.Items.Add(name);
			}
		}
	}

	public void RegisterSendPacketClickedObserver(IObserver<PacketBase> observer)
	{
		sendPacketNotifier.RegisterObserver(observer);
	}

	public void UnregisterSendPacketClickedObserver(IObserver<PacketBase> observer)
	{
		sendPacketNotifier.UnregisterObserver(observer);
	}

	private void NotifySendPacketClickedObservers(PacketBase packet)
	{
		if (packet != null)
		{
			sendPacketNotifier.NotifyObservers(packet);
			string name = packet.Info.Name;
			if (!string.IsNullOrWhiteSpace(name) && !comboBoxPacketSearch.Items.Contains(name))
			{
				comboBoxPacketSearch.Items.Add(name);
			}
		}
	}

	private void PacketUserControl_Load(object sender, EventArgs e)
	{
		treeViewPacketList.AfterSelect += treeViewPacketList_AfterSelect;
		listViewCurrentPacket.DoubleClick += listViewCurrentPacket_DoubleClick;
		listViewCurrentPacket.Columns.Add("Parameter Name");
		listViewCurrentPacket.Columns.Add("Value (Hex)");
		listViewCurrentPacket.Columns.Add("Description");
		ResizeHandler();
	}

	public void SetPacketList(List<PacketBase> packetList)
	{
		this.packetList = packetList;
		UpdateTreeView();
	}

	public void SetPacketTypesToHide(List<Type> typeList)
	{
		typesToHideList = typeList;
		UpdateTreeView();
	}

	private void UpdateTreeView()
	{
		treeViewPacketList.Nodes.Clear();
		treeNodeToPacketInfoMap.Clear();
		if (packetList == null)
		{
			return;
		}
		foreach (PacketBase packet in packetList)
		{
			if (typesToHideList != null)
			{
				bool flag = false;
				foreach (Type typesToHide in typesToHideList)
				{
					if (typesToHide.FullName == packet.GetType().FullName)
					{
						flag = true;
					}
				}
				if (flag)
				{
					continue;
				}
			}
			if (!treeViewPacketList.Nodes.ContainsKey(packet.Info.DisplayGroup))
			{
				treeViewPacketList.Nodes.Add(packet.Info.DisplayGroup, packet.Info.DisplayGroup);
			}
			TreeNode treeNode = new TreeNode(packet.Info.Name);
			treeViewPacketList.Nodes[packet.Info.DisplayGroup].Nodes.Add(treeNode);
			treeNodeToPacketInfoMap.Add(treeNode, packet);
		}
	}

	private void treeViewPacketList_AfterSelect(object sender, TreeViewEventArgs e)
	{
		try
		{
			selectedPacket = treeNodeToPacketInfoMap[treeViewPacketList.SelectedNode];
			labelCurrentPacket.Text = "Current Packet: " + selectedPacket.Info.Name;
		}
		catch (Exception)
		{
			selectedPacket = null;
			labelCurrentPacket.Text = "Current Packet: (none)";
		}
		UpdateSelectedPacketView(editedField: false);
	}

	private void UpdateSelectedPacketView(bool editedField)
	{
		if (selectedPacket != null)
		{
			selectedPacket.Info.UpdateFieldInfoFromPacket();
		}
		int num = -1;
		if (listViewCurrentPacket.SelectedIndices != null && listViewCurrentPacket.SelectedIndices.Count > 0)
		{
			num = listViewCurrentPacket.SelectedIndices[0];
		}
		if (DisplayedFieldsAreIdentical() && editedField)
		{
			if (num != -1)
			{
				PacketFieldInfo packetFieldInfo = selectedPacket.Info.FieldInfoList[num];
				ListViewItem listViewItem = listViewCurrentPacket.Items[num];
				listViewItem.SubItems[2].Tag = packetFieldInfo.Description;
				listViewItem.Tag = packetFieldInfo;
				for (int i = 0; i < selectedPacket.Info.FieldInfoList.Count; i++)
				{
					listViewCurrentPacket.Items[i].SubItems[1].Text = selectedPacket.Info.FieldInfoList[i].Value;
				}
			}
		}
		else
		{
			listViewCurrentPacket.Items.Clear();
			textBoxPacketRawBytes.Clear();
			if (selectedPacket == null)
			{
				return;
			}
			foreach (PacketFieldInfo fieldInfo in selectedPacket.Info.FieldInfoList)
			{
				ListViewItem listViewItem2 = new ListViewItem(fieldInfo.ParameterName);
				listViewItem2.SubItems.Add(fieldInfo.Value);
				ListViewItem.ListViewSubItem listViewSubItem = listViewItem2.SubItems.Add(FormatFieldDescription(fieldInfo.Description));
				listViewSubItem.Tag = fieldInfo.Description;
				if (!fieldInfo.Settable)
				{
					listViewItem2.BackColor = fixedFieldColor;
				}
				else if (fieldInfo.OmittedFromTransport)
				{
					listViewItem2.BackColor = fieldOmittedFromTransportColor;
				}
				listViewItem2.Tag = fieldInfo;
				listViewCurrentPacket.Items.Add(listViewItem2);
			}
			for (int j = 0; j < listViewCurrentPacket.Items.Count; j++)
			{
				if (j == num)
				{
					listViewCurrentPacket.Items[num].Selected = true;
					listViewCurrentPacket.Items[num].EnsureVisible();
					break;
				}
			}
		}
		textBoxPacketRawBytes.Text = Conversions.ByteArrayToSpacedHexString(selectedPacket.ToByteArray());
	}

	private bool DisplayedFieldsAreIdentical()
	{
		if (selectedPacket == null)
		{
			return false;
		}
		if (selectedPacket.Info.FieldInfoList.Count != listViewCurrentPacket.Items.Count)
		{
			return false;
		}
		for (int i = 0; i < listViewCurrentPacket.Items.Count; i++)
		{
			ListViewItem listViewItem = listViewCurrentPacket.Items[i];
			PacketFieldInfo packetFieldInfo = selectedPacket.Info.FieldInfoList[i];
			if (listViewItem.Text != packetFieldInfo.ParameterName)
			{
				return false;
			}
			if (listViewItem.SubItems[2].Text != FormatFieldDescription(packetFieldInfo.Description))
			{
				return false;
			}
			if (!packetFieldInfo.Settable)
			{
				if (listViewItem.BackColor != fixedFieldColor)
				{
					return false;
				}
			}
			else if (packetFieldInfo.OmittedFromTransport && listViewItem.BackColor != fieldOmittedFromTransportColor)
			{
				return false;
			}
		}
		return true;
	}

	private string FormatFieldDescription(string description)
	{
		string[] array = description.Replace("\r", "").Split('\n');
		StringBuilder stringBuilder = new StringBuilder();
		bool flag = true;
		string[] array2 = array;
		foreach (string text in array2)
		{
			string text2 = text.Trim();
			if (!(text2 == ""))
			{
				if (flag)
				{
					flag = false;
				}
				else
				{
					stringBuilder.Append(" / ");
				}
				stringBuilder.Append(text2);
			}
		}
		return stringBuilder.ToString();
	}

	private void listViewCurrentPacket_DoubleClick(object sender, EventArgs e)
	{
		if (listViewCurrentPacket.SelectedIndices.Count != 1)
		{
			return;
		}
		PacketFieldInfo packetFieldInfo = (PacketFieldInfo)listViewCurrentPacket.SelectedItems[0].Tag;
		if (!packetFieldInfo.Settable)
		{
			MessageBoxes.ShowErrorBox("Field is not settable");
			return;
		}
		string value = packetFieldInfo.Value;
		PacketFieldValueForm packetFieldValueForm = new PacketFieldValueForm();
		packetFieldValueForm.Title = "Enter New Value";
		packetFieldValueForm.Description = "Enter new value for " + packetFieldInfo.ParameterName;
		if (packetFieldInfo.Description.Trim() != "")
		{
			packetFieldValueForm.Description = packetFieldValueForm.Description + "\r\n\r\nDescription:\r\n" + packetFieldInfo.Description.Trim();
		}
		packetFieldValueForm.Description = packetFieldValueForm.Description.Trim();
		if (packetFieldInfo.MinValueHex != "" || packetFieldInfo.MaxValueHex != "")
		{
			packetFieldValueForm.Description += "\r\n";
		}
		if (packetFieldInfo.MinValueHex != "")
		{
			packetFieldValueForm.Description = packetFieldValueForm.Description + "\r\nMinimum value: 0x" + packetFieldInfo.MinValueHex;
		}
		if (packetFieldInfo.MaxValueHex != "")
		{
			packetFieldValueForm.Description = packetFieldValueForm.Description + "\r\nMaximum value: 0x" + packetFieldInfo.MaxValueHex;
		}
		if (packetFieldInfo.OmittedFromTransport)
		{
			packetFieldValueForm.Description += "\r\n\r\nThis field is for your packet building convenience only.  The bytes from this field will not be sent to the device.";
		}
		else if (packetFieldInfo.Length > 8)
		{
			if (packetFieldInfo.LittleEndianTransport)
			{
				packetFieldValueForm.Description += "\r\n\r\nThis field is little endian.  The bytes for this field will be sent to the device in the reverse order that you enter them.";
			}
			else
			{
				packetFieldValueForm.Description += "\r\n\r\nThis field is big endian.  The bytes for this field will be sent to the device in the same order that you enter them.";
			}
		}
		packetFieldValueForm.HexValueString = value;
		packetFieldValueForm.HexValueLengthInBytes = ((packetFieldInfo.Length % 8 == 0) ? (packetFieldInfo.Length / 8) : (packetFieldInfo.Length / 8 + 1));
		packetFieldValueForm.DefaultDataEntryMode = packetFieldInfo.DataEntryMode;
		if (packetFieldInfo.DataEntryMode == DataEntryMode.Custom)
		{
			packetFieldValueForm.ConvertDisplayedTextToHexString = ConvertFieldDisplayedTextToHexStringShim;
			packetFieldValueForm.ConvertHexStringToDisplayedText = ConvertFieldHexStringToDisplayedTextShim;
		}
		try
		{
			if (packetFieldValueForm.ShowDialog() != DialogResult.OK)
			{
				return;
			}
		}
		catch (Exception ex)
		{
			MessageBoxes.ShowErrorBox(ex.Message);
			return;
		}
		string hexValueString = packetFieldValueForm.HexValueString;
		int index = listViewCurrentPacket.SelectedIndices[0];
		try
		{
			selectedPacket.Info.UpdatePacketFromFieldInfo(index, hexValueString);
		}
		catch (Exception ex2)
		{
			MessageBoxes.ShowErrorBox(ex2.Message);
			return;
		}
		try
		{
			UpdateSelectedPacketView(editedField: true);
		}
		catch (Exception)
		{
			MessageBoxes.ShowErrorBox("The entered value caused an exception to be thrown when updating the packet.  Reverting to the previous value.\r\n\r\nThis typically happens when the value causes additional fields to be added that make the packet an invalid size.");
			try
			{
				selectedPacket.Info.UpdatePacketFromFieldInfo(index, value);
			}
			catch (Exception ex3)
			{
				MessageBoxes.ShowErrorBox(ex3.Message);
				return;
			}
			UpdateSelectedPacketView(editedField: true);
		}
		foreach (string warning in selectedPacket.GetWarnings())
		{
			NotifyLogMessageObservers(new LogMessage(LogMessageType.Warning, warning));
		}
	}

	private void buttonSendPacket_Click(object sender, EventArgs e)
	{
		NotifySendPacketClickedObservers(selectedPacket);
	}

	private void buttonDecode_Click(object sender, EventArgs e)
	{
		NotifyDecodePacketClickedObservers(selectedPacket);
	}

	private void PacketUserControl_Resize(object sender, EventArgs e)
	{
		ResizeHandler();
	}

	private void ResizeHandler()
	{
		if (textBoxPacketRawBytes.Visible)
		{
			splitContainerVertical.Panel2MinSize = 25;
			splitContainerVertical.SplitterDistance = splitContainerVertical.Height - 42;
			splitContainerVertical.IsSplitterFixed = false;
		}
		else
		{
			splitContainerVertical.Panel2MinSize = 0;
			splitContainerVertical.SplitterDistance = splitContainerVertical.Height;
			splitContainerVertical.IsSplitterFixed = true;
		}
		if (horizontalSplitterDistance > 0)
		{
			splitContainerHorizontal.SplitterDistance = horizontalSplitterDistance;
		}
		else
		{
			horizontalSplitterDistance = splitContainerHorizontal.SplitterDistance;
		}
		_ = splitContainerHorizontal.SplitterDistance;
		if (listViewCurrentPacket.Columns.Count > 0)
		{
			int num = SystemInformation.VerticalScrollBarWidth + 4;
			int num2 = num / listViewCurrentPacket.Columns.Count;
			listViewCurrentPacket.Columns[0].Width = listViewCurrentPacket.Width * 35 / 100 - num2;
			num -= num2;
			listViewCurrentPacket.Columns[1].Width = listViewCurrentPacket.Width * 15 / 100 - num2;
			num -= num2;
			listViewCurrentPacket.Columns[2].Width = listViewCurrentPacket.Width * 50 / 100 - num;
		}
	}

	private void listViewCurrentPacket_MouseMove(object sender, MouseEventArgs e)
	{
		bool flag = true;
		ListViewItem itemAt = listViewCurrentPacket.GetItemAt(e.X, e.Y);
		ListViewHitTestInfo listViewHitTestInfo = listViewCurrentPacket.HitTest(e.X, e.Y);
		if (itemAt == null)
		{
			flag = false;
		}
		else if (listViewHitTestInfo.SubItem == null)
		{
			flag = false;
		}
		else if (listViewHitTestInfo.SubItem.Tag == null)
		{
			flag = false;
		}
		if (flag)
		{
			if (!(toolTipShown == (string)listViewHitTestInfo.SubItem.Tag))
			{
				toolTip.SetToolTip(listViewCurrentPacket, (string)listViewHitTestInfo.SubItem.Tag);
				toolTipShown = (string)listViewHitTestInfo.SubItem.Tag;
			}
		}
		else
		{
			toolTip.SetToolTip(listViewCurrentPacket, "");
			toolTipShown = "";
		}
	}

	private void PacketUserControl_VisibleChanged(object sender, EventArgs e)
	{
		if (base.Visible)
		{
			ResizeHandler();
		}
	}

	private void splitContainerHorizontal_SplitterMoving(object sender, SplitterCancelEventArgs e)
	{
		userMovedSplitter = true;
	}

	private void splitContainerHorizontal_SplitterMoved(object sender, SplitterEventArgs e)
	{
		if (userMovedSplitter)
		{
			horizontalSplitterDistance = splitContainerHorizontal.SplitterDistance;
			userMovedSplitter = false;
		}
	}

	private string ConvertFieldDisplayedTextToHexStringShim(string displayedText)
	{
		PacketFieldInfo packetFieldInfo = (PacketFieldInfo)listViewCurrentPacket.SelectedItems[0].Tag;
		return selectedPacket.Info.ConvertFieldDisplayedTextToHexString(packetFieldInfo.ParameterName, displayedText);
	}

	private string ConvertFieldHexStringToDisplayedTextShim(string hexString)
	{
		PacketFieldInfo packetFieldInfo = (PacketFieldInfo)listViewCurrentPacket.SelectedItems[0].Tag;
		return selectedPacket.Info.ConvertFieldHexStringToDisplayedText(packetFieldInfo.ParameterName, hexString);
	}

	private void buttonPacketSearch_Click(object sender, EventArgs e)
	{
		SearchPacket(comboBoxPacketSearch.Text);
	}

	private void SearchPacket(string packetName)
	{
		treeNodeForSearch.Clear();
		if (!(packetName != ""))
		{
			return;
		}
		foreach (TreeNode node in treeViewPacketList.Nodes)
		{
			if (node.Nodes.Count <= 0)
			{
				continue;
			}
			foreach (TreeNode node2 in node.Nodes)
			{
				if (node2.Text.ToLower().Contains(packetName.ToLower()))
				{
					treeNodeForSearch.AddLast(node2);
				}
			}
		}
		if (treeNodeForSearch.Count != 0)
		{
			currentTreeNode = treeNodeForSearch.First.Value;
			treeViewPacketList.SelectedNode = currentTreeNode;
			treeViewPacketList.Focus();
		}
	}

	private void buttonPreviousPacket_Click(object sender, EventArgs e)
	{
		if (currentTreeNode != null && treeNodeForSearch.Count > 0)
		{
			LinkedListNode<TreeNode> linkedListNode = treeNodeForSearch.Find(currentTreeNode);
			linkedListNode = linkedListNode.Previous;
			if (linkedListNode != null)
			{
				currentTreeNode = linkedListNode.Value;
				treeViewPacketList.SelectedNode = currentTreeNode;
				treeViewPacketList.Focus();
			}
			else
			{
				treeViewPacketList.SelectedNode = currentTreeNode;
				treeViewPacketList.Focus();
			}
		}
	}

	private void buttonNextPacket_Click(object sender, EventArgs e)
	{
		if (currentTreeNode != null && treeNodeForSearch.Count > 0)
		{
			LinkedListNode<TreeNode> linkedListNode = treeNodeForSearch.Find(currentTreeNode);
			linkedListNode = linkedListNode.Next;
			if (linkedListNode != null)
			{
				currentTreeNode = linkedListNode.Value;
				treeViewPacketList.SelectedNode = currentTreeNode;
				treeViewPacketList.Focus();
			}
			else
			{
				treeViewPacketList.SelectedNode = currentTreeNode;
				treeViewPacketList.Focus();
			}
		}
	}

	private void buttonClearHistory_Click(object sender, EventArgs e)
	{
		comboBoxPacketSearch.SelectedItem = null;
		comboBoxPacketSearch.Items.Clear();
	}

	private void comboBoxPacketSearch_SelectionChangeCommitted(object sender, EventArgs e)
	{
		SearchPacket(comboBoxPacketSearch.SelectedItem.ToString());
	}

	private void comboBoxPacketSearch_KeyDown(object sender, KeyEventArgs e)
	{
		if (e.KeyCode == Keys.Return)
		{
			buttonPacketSearch_Click(this, new EventArgs());
		}
	}

	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	private void InitializeComponent()
	{
		this.splitContainerHorizontal = new System.Windows.Forms.SplitContainer();
		this.splitContainerHorizontalInPacketUserControl = new System.Windows.Forms.SplitContainer();
		this.treeViewPacketList = new System.Windows.Forms.TreeView();
		this.comboBoxPacketSearch = new System.Windows.Forms.ComboBox();
		this.buttonNextPacket = new System.Windows.Forms.Button();
		this.buttonPreviousPacket = new System.Windows.Forms.Button();
		this.buttonClearHistory = new System.Windows.Forms.Button();
		this.buttonPacketSearch = new System.Windows.Forms.Button();
		this.buttonDecode = new System.Windows.Forms.Button();
		this.splitContainerVertical = new System.Windows.Forms.SplitContainer();
		this.labelCurrentPacket = new System.Windows.Forms.Label();
		this.listViewCurrentPacket = new System.Windows.Forms.ListView();
		this.textBoxPacketRawBytes = new System.Windows.Forms.TextBox();
		this.buttonSendPacket = new System.Windows.Forms.Button();
		((System.ComponentModel.ISupportInitialize)this.splitContainerHorizontal).BeginInit();
		this.splitContainerHorizontal.Panel1.SuspendLayout();
		this.splitContainerHorizontal.Panel2.SuspendLayout();
		this.splitContainerHorizontal.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.splitContainerHorizontalInPacketUserControl).BeginInit();
		this.splitContainerHorizontalInPacketUserControl.Panel1.SuspendLayout();
		this.splitContainerHorizontalInPacketUserControl.Panel2.SuspendLayout();
		this.splitContainerHorizontalInPacketUserControl.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.splitContainerVertical).BeginInit();
		this.splitContainerVertical.Panel1.SuspendLayout();
		this.splitContainerVertical.Panel2.SuspendLayout();
		this.splitContainerVertical.SuspendLayout();
		base.SuspendLayout();
		this.splitContainerHorizontal.Dock = System.Windows.Forms.DockStyle.Fill;
		this.splitContainerHorizontal.Location = new System.Drawing.Point(0, 0);
		this.splitContainerHorizontal.Name = "splitContainerHorizontal";
		this.splitContainerHorizontal.Panel1.Controls.Add(this.splitContainerHorizontalInPacketUserControl);
		this.splitContainerHorizontal.Panel2.Controls.Add(this.buttonDecode);
		this.splitContainerHorizontal.Panel2.Controls.Add(this.splitContainerVertical);
		this.splitContainerHorizontal.Panel2.Controls.Add(this.buttonSendPacket);
		this.splitContainerHorizontal.Size = new System.Drawing.Size(400, 300);
		this.splitContainerHorizontal.SplitterDistance = 133;
		this.splitContainerHorizontal.SplitterIncrement = 10;
		this.splitContainerHorizontal.TabIndex = 1;
		this.splitContainerHorizontal.SplitterMoving += new System.Windows.Forms.SplitterCancelEventHandler(splitContainerHorizontal_SplitterMoving);
		this.splitContainerHorizontal.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(splitContainerHorizontal_SplitterMoved);
		this.splitContainerHorizontalInPacketUserControl.Dock = System.Windows.Forms.DockStyle.Fill;
		this.splitContainerHorizontalInPacketUserControl.Location = new System.Drawing.Point(0, 0);
		this.splitContainerHorizontalInPacketUserControl.Name = "splitContainerHorizontalInPacketUserControl";
		this.splitContainerHorizontalInPacketUserControl.Orientation = System.Windows.Forms.Orientation.Horizontal;
		this.splitContainerHorizontalInPacketUserControl.Panel1.Controls.Add(this.treeViewPacketList);
		this.splitContainerHorizontalInPacketUserControl.Panel1MinSize = 200;
		this.splitContainerHorizontalInPacketUserControl.Panel2.Controls.Add(this.comboBoxPacketSearch);
		this.splitContainerHorizontalInPacketUserControl.Panel2.Controls.Add(this.buttonNextPacket);
		this.splitContainerHorizontalInPacketUserControl.Panel2.Controls.Add(this.buttonPreviousPacket);
		this.splitContainerHorizontalInPacketUserControl.Panel2.Controls.Add(this.buttonClearHistory);
		this.splitContainerHorizontalInPacketUserControl.Panel2.Controls.Add(this.buttonPacketSearch);
		this.splitContainerHorizontalInPacketUserControl.Size = new System.Drawing.Size(133, 300);
		this.splitContainerHorizontalInPacketUserControl.SplitterDistance = 200;
		this.splitContainerHorizontalInPacketUserControl.TabIndex = 0;
		this.treeViewPacketList.Dock = System.Windows.Forms.DockStyle.Fill;
		this.treeViewPacketList.Location = new System.Drawing.Point(0, 0);
		this.treeViewPacketList.Name = "treeViewPacketList";
		this.treeViewPacketList.Size = new System.Drawing.Size(133, 200);
		this.treeViewPacketList.TabIndex = 1;
		this.comboBoxPacketSearch.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
		this.comboBoxPacketSearch.FormattingEnabled = true;
		this.comboBoxPacketSearch.Location = new System.Drawing.Point(8, 7);
		this.comboBoxPacketSearch.Name = "comboBoxPacketSearch";
		this.comboBoxPacketSearch.Size = new System.Drawing.Size(0, 21);
		this.comboBoxPacketSearch.TabIndex = 8;
		this.comboBoxPacketSearch.SelectionChangeCommitted += new System.EventHandler(comboBoxPacketSearch_SelectionChangeCommitted);
		this.comboBoxPacketSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(comboBoxPacketSearch_KeyDown);
		this.buttonNextPacket.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
		this.buttonNextPacket.Font = new System.Drawing.Font("Webdings", 8.25f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 2);
		this.buttonNextPacket.Location = new System.Drawing.Point(103, 34);
		this.buttonNextPacket.Name = "buttonNextPacket";
		this.buttonNextPacket.Size = new System.Drawing.Size(28, 28);
		this.buttonNextPacket.TabIndex = 7;
		this.buttonNextPacket.Text = "6";
		this.buttonNextPacket.UseVisualStyleBackColor = true;
		this.buttonNextPacket.Click += new System.EventHandler(buttonNextPacket_Click);
		this.buttonPreviousPacket.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
		this.buttonPreviousPacket.Font = new System.Drawing.Font("Webdings", 8.25f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 2);
		this.buttonPreviousPacket.Location = new System.Drawing.Point(103, 4);
		this.buttonPreviousPacket.Name = "buttonPreviousPacket";
		this.buttonPreviousPacket.Size = new System.Drawing.Size(28, 28);
		this.buttonPreviousPacket.TabIndex = 6;
		this.buttonPreviousPacket.Text = "5";
		this.buttonPreviousPacket.UseVisualStyleBackColor = true;
		this.buttonPreviousPacket.Click += new System.EventHandler(buttonPreviousPacket_Click);
		this.buttonClearHistory.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
		this.buttonClearHistory.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25f);
		this.buttonClearHistory.Location = new System.Drawing.Point(15, 34);
		this.buttonClearHistory.Margin = new System.Windows.Forms.Padding(4);
		this.buttonClearHistory.Name = "buttonClearHistory";
		this.buttonClearHistory.Size = new System.Drawing.Size(80, 28);
		this.buttonClearHistory.TabIndex = 5;
		this.buttonClearHistory.Text = "Clear History";
		this.buttonClearHistory.UseVisualStyleBackColor = true;
		this.buttonClearHistory.Click += new System.EventHandler(buttonClearHistory_Click);
		this.buttonPacketSearch.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
		this.buttonPacketSearch.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25f);
		this.buttonPacketSearch.Location = new System.Drawing.Point(15, 4);
		this.buttonPacketSearch.Name = "buttonPacketSearch";
		this.buttonPacketSearch.Size = new System.Drawing.Size(80, 28);
		this.buttonPacketSearch.TabIndex = 5;
		this.buttonPacketSearch.Text = "Search";
		this.buttonPacketSearch.UseVisualStyleBackColor = true;
		this.buttonPacketSearch.Click += new System.EventHandler(buttonPacketSearch_Click);
		this.buttonDecode.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
		this.buttonDecode.Location = new System.Drawing.Point(191, 245);
		this.buttonDecode.Name = "buttonDecode";
		this.buttonDecode.Size = new System.Drawing.Size(64, 52);
		this.buttonDecode.TabIndex = 4;
		this.buttonDecode.Text = "&Decode";
		this.buttonDecode.UseVisualStyleBackColor = true;
		this.buttonDecode.Click += new System.EventHandler(buttonDecode_Click);
		this.splitContainerVertical.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
		this.splitContainerVertical.Location = new System.Drawing.Point(-2, 3);
		this.splitContainerVertical.Name = "splitContainerVertical";
		this.splitContainerVertical.Orientation = System.Windows.Forms.Orientation.Horizontal;
		this.splitContainerVertical.Panel1.Controls.Add(this.labelCurrentPacket);
		this.splitContainerVertical.Panel1.Controls.Add(this.listViewCurrentPacket);
		this.splitContainerVertical.Panel2.Controls.Add(this.textBoxPacketRawBytes);
		this.splitContainerVertical.Size = new System.Drawing.Size(260, 236);
		this.splitContainerVertical.SplitterDistance = 194;
		this.splitContainerVertical.SplitterIncrement = 14;
		this.splitContainerVertical.TabIndex = 3;
		this.labelCurrentPacket.AutoSize = true;
		this.labelCurrentPacket.Location = new System.Drawing.Point(5, 3);
		this.labelCurrentPacket.Name = "labelCurrentPacket";
		this.labelCurrentPacket.Size = new System.Drawing.Size(114, 13);
		this.labelCurrentPacket.TabIndex = 0;
		this.labelCurrentPacket.Text = "Current Packet: (none)";
		this.listViewCurrentPacket.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
		this.listViewCurrentPacket.FullRowSelect = true;
		this.listViewCurrentPacket.GridLines = true;
		this.listViewCurrentPacket.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
		this.listViewCurrentPacket.Location = new System.Drawing.Point(4, 19);
		this.listViewCurrentPacket.Name = "listViewCurrentPacket";
		this.listViewCurrentPacket.Size = new System.Drawing.Size(253, 173);
		this.listViewCurrentPacket.TabIndex = 1;
		this.listViewCurrentPacket.UseCompatibleStateImageBehavior = false;
		this.listViewCurrentPacket.View = System.Windows.Forms.View.Details;
		this.listViewCurrentPacket.MouseMove += new System.Windows.Forms.MouseEventHandler(listViewCurrentPacket_MouseMove);
		this.textBoxPacketRawBytes.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
		this.textBoxPacketRawBytes.Font = new System.Drawing.Font("Courier New", 8.25f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.textBoxPacketRawBytes.Location = new System.Drawing.Point(4, 0);
		this.textBoxPacketRawBytes.Multiline = true;
		this.textBoxPacketRawBytes.Name = "textBoxPacketRawBytes";
		this.textBoxPacketRawBytes.ReadOnly = true;
		this.textBoxPacketRawBytes.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
		this.textBoxPacketRawBytes.Size = new System.Drawing.Size(253, 38);
		this.textBoxPacketRawBytes.TabIndex = 0;
		this.buttonSendPacket.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
		this.buttonSendPacket.Location = new System.Drawing.Point(2, 245);
		this.buttonSendPacket.Name = "buttonSendPacket";
		this.buttonSendPacket.Size = new System.Drawing.Size(182, 52);
		this.buttonSendPacket.TabIndex = 0;
		this.buttonSendPacket.Text = "&Send Packet";
		this.buttonSendPacket.UseVisualStyleBackColor = true;
		this.buttonSendPacket.Click += new System.EventHandler(buttonSendPacket_Click);
		base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.Controls.Add(this.splitContainerHorizontal);
		this.MinimumSize = new System.Drawing.Size(200, 150);
		base.Name = "PacketUserControl";
		base.Size = new System.Drawing.Size(400, 300);
		base.Load += new System.EventHandler(PacketUserControl_Load);
		base.VisibleChanged += new System.EventHandler(PacketUserControl_VisibleChanged);
		base.Resize += new System.EventHandler(PacketUserControl_Resize);
		this.splitContainerHorizontal.Panel1.ResumeLayout(false);
		this.splitContainerHorizontal.Panel2.ResumeLayout(false);
		((System.ComponentModel.ISupportInitialize)this.splitContainerHorizontal).EndInit();
		this.splitContainerHorizontal.ResumeLayout(false);
		this.splitContainerHorizontalInPacketUserControl.Panel1.ResumeLayout(false);
		this.splitContainerHorizontalInPacketUserControl.Panel2.ResumeLayout(false);
		((System.ComponentModel.ISupportInitialize)this.splitContainerHorizontalInPacketUserControl).EndInit();
		this.splitContainerHorizontalInPacketUserControl.ResumeLayout(false);
		this.splitContainerVertical.Panel1.ResumeLayout(false);
		this.splitContainerVertical.Panel1.PerformLayout();
		this.splitContainerVertical.Panel2.ResumeLayout(false);
		this.splitContainerVertical.Panel2.PerformLayout();
		((System.ComponentModel.ISupportInitialize)this.splitContainerVertical).EndInit();
		this.splitContainerVertical.ResumeLayout(false);
		base.ResumeLayout(false);
	}
}
