using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Threading;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Schema;
using Microsoft.Win32;

namespace QFPT;

public class QFPT : Form
{
	public enum MsgLevel
	{
		NORMAL,
		WARNING,
		ERROR,
		EXCEPTION,
		CRITICAL
	}

	public struct ErrorInfo
	{
		public string error;

		public MsgLevel msgLevel;
	}

	private delegate void EnableExportBtnCB(bool bEnable);

	private delegate void PrintMsgCB(string msg);

	private delegate void PrintMsgLevelCB(MsgLevel msgLevel, string msg);

	private static Dictionary<string, Station> StationsList = new Dictionary<string, Station>();

	private static Dictionary<string, QDARTComponent> QDARTComponentsList = new Dictionary<string, QDARTComponent>();

	private static Dictionary<string, RegFileAttr> RegFilesList = new Dictionary<string, RegFileAttr>();

	private static Dictionary<string, string> NoOverwrittenFiles = new Dictionary<string, string>();

	private static List<string> ImageTypeList = new List<string> { "Select Image Type", "Folder Image", "Compressed Image Files" };

	private static List<string> LanguageList = new List<string> { "English" };

	private static string Language = "English";

	private static string QDART_Install_Path = "C:\\Program Files (x86)\\Qualcomm\\QDART";

	private static string QDART_Install_Path_Reg = "";

	private static string QDART_Install_Ver_Reg = "";

	private static string Create_Image_Path = "C:\\QDARTImages";

	private static string FolderImagePath = "";

	private static string[] CompressedImagePath = new string[1] { "" };

	private static char[] InvalidFolderChars = new char[9] { '\\', '/', ':', '*', '?', '"', '<', '>', '|' };

	private int stationList_last_index = -1;

	private IContainer components;

	private RichTextBox MsgBox;

	private TextBox QDARTInstallPath;

	private Button Browse;

	private GroupBox groupBox2;

	private TreeView StationView;

	private ContextMenuStrip StationView_contextMenuStrip;

	private ToolStripMenuItem deleteToolStripMenuItem;

	private ContextMenuStrip ComponentView_contextMenuStrip;

	private ToolStripMenuItem expandAllToolStripMenuItem;

	private ToolStripMenuItem collapseAllToolStripMenuItem;

	private ToolStripMenuItem expandAllToolStripMenuItem1;

	private ToolStripMenuItem collapseAllToolStripMenuItem1;

	private ContextMenuStrip MsgBox_contextMenuStrip;

	private ToolStripMenuItem clearToolStripMenuItem;

	private ToolStripMenuItem saveAsToolStripMenuItem;

	private CheckedListBox StationList;

	private Label StationLabel;

	private ContextMenuStrip StationList_contextMenuStrip;

	private ToolStripMenuItem createToolStripMenuItem;

	private ToolStripMenuItem editToolStripMenuItem;

	private ToolStripMenuItem deleteToolStripMenuItem1;

	private ToolStripMenuItem saveToolStripMenuItem;

	private Label ComponentLabel;

	private MenuStrip Main_menuStrip;

	private ToolStripMenuItem fileToolStripMenuItem;

	private ToolStripMenuItem exitToolStripMenuItem;

	private ToolStripMenuItem helpToolStripMenuItem;

	private ToolStripMenuItem aboutToolStripMenuItem;

	private Label label2;

	private Button Export;

	private Button AddComponents;

	private Button RemoveComponents;

	private Label QdartComponentLabel;

	private TreeView ComponentView;

	private Label label1;

	private Label label3;

	private ToolStripMenuItem saveStationConfigToolStripMenuItem;

	private ToolStripMenuItem addComponentToolStripMenuItem;

	private ToolStripMenuItem editComponentToolStripMenuItem1;

	private ToolStripMenuItem toolToolStripMenuItem;

	private ToolStripMenuItem componentEditorToolStripMenuItem;

	private Label label4;

	private Button BrowseImagePath;

	private TextBox CreateImagePath;

	private ToolStripMenuItem saveAndExitToolStripMenuItem;

	public QFPT()
	{
		InitializeComponent();
		GetQDARTVersion();
		LoadXML();
		InitUI();
	}

	private void QFPT_Load(object sender, EventArgs e)
	{
	}

	private void GetQDARTVersion()
	{
		RegistryKey registryKey = null;
		try
		{
			registryKey = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall");
			string[] subKeyNames = registryKey.GetSubKeyNames();
			foreach (string name in subKeyNames)
			{
				RegistryKey registryKey2 = registryKey.OpenSubKey(name);
				object value = registryKey2.GetValue("DisplayName");
				if (value != null && value.ToString() == "QDART")
				{
					object value2 = registryKey2.GetValue("InstallLocation");
					object value3 = registryKey2.GetValue("DisplayVersion");
					PrintMsg("detect QDART version " + value3.ToString() + ", install path: " + value2.ToString());
					QDART_Install_Path_Reg = value2.ToString();
					QDART_Install_Ver_Reg = value3.ToString();
					break;
				}
			}
			registryKey.Close();
		}
		catch (Exception ex)
		{
			registryKey.Close();
			PrintMsg(MsgLevel.EXCEPTION, ex.Message);
		}
	}

	private void InitUI()
	{
		base.MaximizeBox = false;
		base.FormBorderStyle = FormBorderStyle.FixedSingle;
		CenterToScreen();
		MsgBox.MaxLength = int.MaxValue;
		ComponentView.CheckBoxes = true;
		StationView.CheckBoxes = true;
		QDARTInstallPath.Text = QDART_Install_Path;
		CreateImagePath.Text = Create_Image_Path;
		StationList.Items.Clear();
		foreach (KeyValuePair<string, Station> stations in StationsList)
		{
			StationList.Items.Add(stations.Key);
		}
		UpdateQDARTComponentView();
	}

	private string RemoveInvalidFolderChars(string name)
	{
		string text = name;
		char[] invalidFolderChars = InvalidFolderChars;
		foreach (char oldChar in invalidFolderChars)
		{
			text = text.Replace(oldChar, ' ');
		}
		return text;
	}

	private void EnableExportBtn(bool bEnable)
	{
		if (Export.InvokeRequired)
		{
			EnableExportBtnCB method = EnableExportBtn;
			Export.BeginInvoke(method, bEnable);
		}
		else
		{
			Export.Enabled = bEnable;
		}
	}

	private void Export_Click(object sender, EventArgs e)
	{
		if (!(Create_Image_Path == ""))
		{
			string text = "";
			MsgBox.Clear();
			text = Create_Image_Path;
			Thread thread = new Thread(PackageThread);
			thread.Name = "PackageThread";
			thread.Start(text);
		}
	}

	private void PackageThread(object param)
	{
		string text = (string)param;
		string text2 = "";
		string text3 = "";
		List<ErrorInfo> list = new List<ErrorInfo>();
		EnableExportBtn(bEnable: false);
		try
		{
			ErrorInfo item = default(ErrorInfo);
			for (int i = 0; i < StationList.Items.Count; i++)
			{
				if (!StationList.GetItemChecked(i))
				{
					continue;
				}
				string text4 = StationList.Items[i].ToString();
				string text5 = RemoveBackSlash(text + "\\" + RemoveInvalidFolderChars(text4));
				Directory.CreateDirectory(text5);
				Directory.CreateDirectory(RemoveBackSlash(text5 + "\\QDART\\bin"));
				Directory.CreateDirectory(RemoveBackSlash(text5 + "\\Qualcomm"));
				foreach (KeyValuePair<string, Station> stations in StationsList)
				{
					if (!(stations.Key == text4))
					{
						continue;
					}
					foreach (Station.Config item2 in stations.Value.config_list)
					{
						foreach (KeyValuePair<string, QDARTComponent> qDARTComponents in QDARTComponentsList)
						{
							if (!(qDARTComponents.Value.componentName == item2.component))
							{
								continue;
							}
							foreach (QDARTComponent.Option item3 in qDARTComponents.Value.option_list)
							{
								if (!(item3.optionName == item2.option))
								{
									continue;
								}
								foreach (QDARTComponent.Option.FileAttr item4 in item3.fileAttr_list)
								{
									if (!item4.path.Contains(":"))
									{
										text2 = RemoveBackSlash(QDART_Install_Path + "\\" + item4.path + "\\" + item4.name);
										text3 = RemoveBackSlash(text5 + "\\QDART\\" + item4.path + "\\");
									}
									else if (item4.path.ToLower().Contains("c:\\qualcomm"))
									{
										text2 = RemoveBackSlash(item4.path + "\\" + item4.name);
										text3 = RemoveBackSlash(text5 + "\\" + item4.path.Replace("C:\\", "") + "\\");
									}
									PrintMsg("srcPath: " + text2);
									PrintMsg("destPath: " + text3);
									string arguments = "/c xcopy \"" + text2 + "\" \"" + text3 + "\" /s /k /r /y";
									try
									{
										string msg = ExecuteCMD("cmd.exe", arguments, 0);
										PrintMsg(msg);
									}
									catch (ApplicationException ex)
									{
										string message = ex.Message;
										item.error = text2 + "\r\n" + message;
										item.msgLevel = MsgLevel.WARNING;
										if (message.ToLower().Contains(".dll") || message.ToLower().Contains(".exe"))
										{
											item.msgLevel = MsgLevel.CRITICAL;
										}
										else if (message.ToLower().Contains("*"))
										{
											item.msgLevel = MsgLevel.WARNING;
										}
										else
										{
											item.msgLevel = MsgLevel.WARNING;
										}
										list.Add(item);
										PrintMsg(item.msgLevel, item.error);
									}
								}
							}
						}
					}
					GenInstallBat(text5, "install.bat");
					GenFileReport(text5, "FileReport.csv");
					PrintMsg("File report: " + RemoveBackSlash(text5 + "\\FileReport.csv"));
				}
			}
			GenInstallAllBat(text, "installAll.bat");
			GenFileReport(text, "FileReport.csv");
			PrintMsg("");
			PrintMsg("create image done...");
			PrintMsg("\r\n");
			if (list.Count > 0)
			{
				PrintMsg("Total " + list.Count + " Error(s)/Warning(s) as following:");
				foreach (ErrorInfo item5 in list)
				{
					PrintMsg(item5.msgLevel, item5.error);
				}
			}
			Process.Start(text);
		}
		catch (Exception ex2)
		{
			PrintMsg(MsgLevel.EXCEPTION, "Exciption: " + ex2.Message);
		}
		EnableExportBtn(bEnable: true);
	}

	private void GenFileReport(string path, string file)
	{
		FileStream fileStream = null;
		StreamWriter streamWriter = null;
		string path2 = RemoveBackSlash(path + "\\" + file);
		try
		{
			fileStream = new FileStream(path2, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
			streamWriter = new StreamWriter(fileStream);
			streamWriter.WriteLine("Export path:," + path);
			streamWriter.WriteLine("Name, Path, Version, Size, CreateTime");
			DirectoryInfo directoryInfo = new DirectoryInfo(path);
			FileInfo[] files = directoryInfo.GetFiles("*.*", SearchOption.AllDirectories);
			FileInfo[] array = files;
			foreach (FileInfo fileInfo in array)
			{
				if (!fileInfo.FullName.Contains(file))
				{
					FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(fileInfo.FullName);
					string name = fileInfo.Name;
					string text = fileInfo.FullName.Replace(path, "");
					string text2 = ((versionInfo.FileVersion != null && versionInfo.FileVersion.Contains(",")) ? versionInfo.FileVersion.Replace(",", ".") : versionInfo.FileVersion);
					string text3 = ((double)fileInfo.Length / 1024.0).ToString("f2") + "KB";
					string text4 = fileInfo.CreationTime.ToString();
					string value = name + "," + text + "," + text2 + "," + text3 + "," + text4;
					streamWriter.WriteLine(value);
				}
			}
		}
		catch (Exception ex)
		{
			throw ex;
		}
		finally
		{
			streamWriter?.Close();
			fileStream?.Close();
		}
	}

	private void GenInstallBat(string path, string batName)
	{
		FileStream fileStream = null;
		StreamWriter streamWriter = null;
		string path2 = RemoveBackSlash(path + "\\" + batName);
		try
		{
			fileStream = new FileStream(path2, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
			streamWriter = new StreamWriter(fileStream);
			streamWriter.WriteLine("echo Warning: this .bat need to run as admin for win7 or above OS version");
			streamWriter.WriteLine("");
			streamWriter.WriteLine("echo this image was generated from QDART " + QDART_Install_Ver_Reg);
			streamWriter.WriteLine("");
			streamWriter.WriteLine(":: copy files under .\\Qualcomm to hardcode path C:\\Qualcomm");
			streamWriter.WriteLine("cd /d %~dp0");
			streamWriter.WriteLine("xcopy \".\\Qualcomm\\*.*\" \"C:\\Qualcomm\\\" /e /k /r /y");
			streamWriter.WriteLine("");
			streamWriter.WriteLine(":: copy files under .\\QDART to default install path");
			streamWriter.WriteLine(RemoveBackSlash("set QDARTInstallPath=" + QDART_Install_Path + "\\"));
			streamWriter.WriteLine("cd /d %~dp0");
			streamWriter.WriteLine(RemoveBackSlash("xcopy \".\\QDART\\*.*\" \"%QDARTInstallPath%\" /e /k /r /y"));
			streamWriter.WriteLine("");
			streamWriter.WriteLine(":: copy QPST files");
			streamWriter.WriteLine("cd /d %~dp0");
			streamWriter.WriteLine(RemoveBackSlash("xcopy \".\\QPST\\*.*\" \"%QDARTInstallPath%..\\QPST\\\" /e /k /r /y"));
			streamWriter.WriteLine("");
			streamWriter.WriteLine(":: copy Qualcomm USB driver files");
			streamWriter.WriteLine("cd /d %~dp0");
			streamWriter.WriteLine(RemoveBackSlash("xcopy \"..\\QUALCOMM Incorporated\\Qualcomm USB Drivers For Windows\\*.*\" \"%QDARTInstallPath%..\\..\\QUALCOMM Incorporated\\Qualcomm USB Drivers For Windows\\\" /e /k /r /y"));
			streamWriter.WriteLine("");
			streamWriter.WriteLine(":: start register files");
			DirectoryInfo directoryInfo = new DirectoryInfo(path);
			FileInfo[] files = directoryInfo.GetFiles("*.*", SearchOption.AllDirectories);
			FileInfo[] array = files;
			foreach (FileInfo fileInfo in array)
			{
				foreach (KeyValuePair<string, RegFileAttr> regFiles in RegFilesList)
				{
					if (fileInfo.Name.ToLower() == regFiles.Key.ToLower())
					{
						streamWriter.WriteLine("cd /d %~dp0");
						string comment = regFiles.Value.comment;
						if (comment != "")
						{
							comment = ":: " + comment;
							streamWriter.WriteLine(comment);
						}
						string cmd = regFiles.Value.cmd;
						if (cmd.ToLower().Contains("regasm") && !cmd.ToLower().Contains("\\regasm"))
						{
							streamWriter.WriteLine("cd /d \"" + fileInfo.DirectoryName.Replace(path, ".") + "\"");
							streamWriter.WriteLine("if exist \"C:\\Program Files (x86)\\Qualcomm\\QDART\\bin\\\" (");
							streamWriter.WriteLine(cmd.ToLower().Replace("regasm", "C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\regasm"));
							streamWriter.WriteLine(") else (");
							streamWriter.WriteLine(cmd.ToLower().Replace("regasm", "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\regasm"));
							streamWriter.WriteLine(")");
						}
						else
						{
							streamWriter.WriteLine("cd /d " + fileInfo.DirectoryName.Replace(path, "."));
							streamWriter.WriteLine(cmd);
						}
						streamWriter.WriteLine("");
					}
				}
			}
			streamWriter.WriteLine("pause");
		}
		catch (Exception ex)
		{
			throw ex;
		}
		finally
		{
			streamWriter?.Close();
			fileStream?.Close();
		}
	}

	private void GenInstallAllBat(string path, string batName)
	{
		FileStream fileStream = null;
		StreamWriter streamWriter = null;
		string path2 = RemoveBackSlash(path + "\\" + batName);
		try
		{
			fileStream = new FileStream(path2, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
			streamWriter = new StreamWriter(fileStream);
			streamWriter.WriteLine("echo Warning: this .bat need to run as admin for win7 or above OS version");
			streamWriter.WriteLine("");
			streamWriter.WriteLine("echo this image was generated from QDART " + QDART_Install_Ver_Reg);
			streamWriter.WriteLine("");
			streamWriter.WriteLine(RemoveBackSlash("set QDARTInstallPath=" + QDART_Install_Path + "\\"));
			streamWriter.WriteLine("cd /d %~dp0");
			DirectoryInfo directoryInfo = new DirectoryInfo(path);
			DirectoryInfo[] directories = directoryInfo.GetDirectories();
			DirectoryInfo[] array = directories;
			foreach (DirectoryInfo directoryInfo2 in array)
			{
				if (Directory.Exists(RemoveBackSlash(directoryInfo2.FullName + "\\Qualcomm")))
				{
					streamWriter.WriteLine(":: copy files under .\\<StationName>\\Qualcomm to hardcode path C:\\Qualcomm");
					streamWriter.WriteLine(RemoveBackSlash("xcopy \".\\" + directoryInfo2.Name + "\\Qualcomm\\*.*\" \"C:\\Qualcomm\\\" /e /k /r /y"));
					streamWriter.WriteLine("");
				}
				if (Directory.Exists(RemoveBackSlash(directoryInfo2.FullName + "\\QDART")))
				{
					streamWriter.WriteLine(":: copy files under .\\QDART to default install path");
					streamWriter.WriteLine(RemoveBackSlash("xcopy \".\\" + directoryInfo2.Name + "\\QDART\\*.*\" \"%QDARTInstallPath%\" /e /k /r /y"));
					streamWriter.WriteLine("");
				}
				if (Directory.Exists(RemoveBackSlash(directoryInfo2.FullName + "\\QPST")))
				{
					streamWriter.WriteLine(":: copy QPST files");
					streamWriter.WriteLine(RemoveBackSlash("xcopy \".\\" + directoryInfo2.Name + "\\QPST\\*.*\" \"%QDARTInstallPath%..\\QPST\\\" /e /k /r /y"));
					streamWriter.WriteLine("");
				}
			}
			streamWriter.WriteLine(":: copy Qualcomm USB driver files");
			streamWriter.WriteLine(RemoveBackSlash("xcopy \".\\QUALCOMM Incorporated\\Qualcomm USB Drivers For Windows\\*.*\" \"%QDARTInstallPath%..\\..\\QUALCOMM Incorporated\\Qualcomm USB Drivers For Windows\\\" /e /k /r /y"));
			streamWriter.WriteLine("");
			streamWriter.WriteLine(":: start register files");
			FileInfo[] files = directoryInfo.GetFiles("*.*", SearchOption.AllDirectories);
			FileInfo[] array2 = files;
			foreach (FileInfo fileInfo in array2)
			{
				foreach (KeyValuePair<string, RegFileAttr> regFiles in RegFilesList)
				{
					if (fileInfo.Name == regFiles.Key)
					{
						streamWriter.WriteLine("cd /d %~dp0");
						string comment = regFiles.Value.comment;
						if (comment != "")
						{
							comment = ":: " + comment;
							streamWriter.WriteLine(comment);
						}
						string cmd = regFiles.Value.cmd;
						if (cmd.ToLower().Contains("regasm") && !cmd.ToLower().Contains("\\regasm"))
						{
							streamWriter.WriteLine("cd /d \"" + fileInfo.DirectoryName.Replace(path, ".") + "\"");
							streamWriter.WriteLine("if exist \"C:\\Program Files (x86)\\Qualcomm\\QDART\\bin\\\" (");
							streamWriter.WriteLine(cmd.ToLower().Replace("regasm", "C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\regasm"));
							streamWriter.WriteLine(") else (");
							streamWriter.WriteLine(cmd.ToLower().Replace("regasm", "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\regasm"));
							streamWriter.WriteLine(")");
						}
						else
						{
							streamWriter.WriteLine("cd /d " + fileInfo.DirectoryName.Replace(path, "."));
							streamWriter.WriteLine(cmd);
						}
						streamWriter.WriteLine("");
					}
				}
			}
			streamWriter.WriteLine("pause");
		}
		catch (Exception ex)
		{
			throw ex;
		}
		finally
		{
			streamWriter?.Close();
			fileStream?.Close();
		}
	}

	private void ImageType_SelectedIndexChanged(object sender, EventArgs e)
	{
		FolderImagePath = "";
		CompressedImagePath = new string[1] { "" };
	}

	private void SelectImage_Click(object sender, EventArgs e)
	{
		FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
		folderBrowserDialog.ShowNewFolderButton = false;
		folderBrowserDialog.Description = "Select image path";
		if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
		{
			FolderImagePath = folderBrowserDialog.SelectedPath.ToString();
			PrintMsg("Folder image path: " + FolderImagePath);
		}
	}

	private void Install_Click(object sender, EventArgs e)
	{
		if (!(FolderImagePath == ""))
		{
			string text = "";
			FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
			folderBrowserDialog.ShowNewFolderButton = true;
			folderBrowserDialog.Description = "Select install path";
			if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
			{
				MsgBox.Clear();
				text = folderBrowserDialog.SelectedPath.ToString();
				Thread thread = new Thread(InstallThread);
				thread.Name = "InStallThread";
				thread.Start(text);
			}
		}
	}

	private void InstallThread(object param)
	{
		string text = (string)param;
		string text2 = "";
		string text3 = "";
		EnableExportBtn(bEnable: false);
		try
		{
			Directory.CreateDirectory(RemoveBackSlash(text2 + "\\QDART\\bin"));
			Directory.CreateDirectory("C:\\Qualcomm");
			DirectoryInfo directoryInfo = new DirectoryInfo(text);
			FileInfo[] files = directoryInfo.GetFiles("*.*", SearchOption.AllDirectories);
			FileInfo[] array = files;
			foreach (FileInfo fileInfo in array)
			{
				foreach (KeyValuePair<string, string> noOverwrittenFile in NoOverwrittenFiles)
				{
					if (fileInfo.Name.ToLower() == noOverwrittenFile.Key.ToLower() && fileInfo.DirectoryName.ToLower().Contains(noOverwrittenFile.Value.ToLower()))
					{
						fileInfo.MoveTo(fileInfo.FullName + ".QFPT.backup");
						PrintMsg("Backup file: " + fileInfo.FullName);
					}
				}
			}
			directoryInfo = new DirectoryInfo("C:\\Qualcomm");
			files = directoryInfo.GetFiles("*.*", SearchOption.AllDirectories);
			FileInfo[] array2 = files;
			foreach (FileInfo fileInfo2 in array2)
			{
				foreach (KeyValuePair<string, string> noOverwrittenFile2 in NoOverwrittenFiles)
				{
					if (fileInfo2.Name.ToLower() == noOverwrittenFile2.Key.ToLower() && fileInfo2.DirectoryName.ToLower().Contains(noOverwrittenFile2.Value.ToLower()))
					{
						fileInfo2.MoveTo(fileInfo2.FullName + ".QFPT.backup");
						PrintMsg("Backup file: " + fileInfo2.FullName);
					}
				}
			}
			text3 = RemoveBackSlash(FolderImagePath + "\\QDART\\*.*");
			text2 = RemoveBackSlash(text + "\\QDART\\");
			string arguments = "/c xcopy \"" + text3 + "\" \"" + text2 + "\" /e /k /r /y";
			string msg = ExecuteCMD("cmd.exe", arguments, 0);
			PrintMsg(msg);
			text3 = RemoveBackSlash(FolderImagePath + "\\Qualcomm\\*.*");
			text2 = RemoveBackSlash(text + "\\Qualcomm\\");
			arguments = "/c xcopy \"" + text3 + "\" \"" + text2 + "\" /e /k /r /y";
			msg = ExecuteCMD("cmd.exe", arguments, 0);
			PrintMsg(msg);
			PrintMsg("install files done...");
			directoryInfo = new DirectoryInfo(text);
			files = directoryInfo.GetFiles("*.QFPT.backup", SearchOption.AllDirectories);
			FileInfo[] array3 = files;
			foreach (FileInfo fileInfo3 in array3)
			{
				File.Delete(fileInfo3.FullName.Replace(".QFPT.backup", ""));
				fileInfo3.MoveTo(fileInfo3.FullName.Replace(".QFPT.backup", ""));
				PrintMsg("Restore file: " + fileInfo3.FullName.Replace(".QFPT.backup", ""));
			}
			directoryInfo = new DirectoryInfo("C:\\Qualcomm");
			files = directoryInfo.GetFiles("*.QFPT.backup", SearchOption.AllDirectories);
			FileInfo[] array4 = files;
			foreach (FileInfo fileInfo4 in array4)
			{
				File.Delete(fileInfo4.FullName.Replace(".QFPT.backup", ""));
				fileInfo4.MoveTo(fileInfo4.FullName.Replace(".QFPT.backup", ""));
				PrintMsg("Restore file: " + fileInfo4.FullName.Replace(".QFPT.backup", ""));
			}
			directoryInfo = new DirectoryInfo(text);
			files = directoryInfo.GetFiles("*.*", SearchOption.AllDirectories);
			FileStream fileStream = new FileStream(RemoveBackSlash(text + "\\register.bat"), FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
			StreamWriter streamWriter = new StreamWriter(fileStream);
			FileInfo[] array5 = files;
			foreach (FileInfo fileInfo5 in array5)
			{
				foreach (KeyValuePair<string, RegFileAttr> regFiles in RegFilesList)
				{
					if (fileInfo5.Name == regFiles.Key)
					{
						string text4 = regFiles.Value.cmd;
						if (text4.ToLower().Contains("regasm") && !text4.ToLower().Contains("\\regasm"))
						{
							text4 = ((!Environment.Is64BitOperatingSystem) ? text4.ToLower().Replace("regasm", "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\regasm") : text4.ToLower().Replace("regasm", "C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\regasm"));
						}
						streamWriter.WriteLine("cd /d " + fileInfo5.DirectoryName);
						streamWriter.WriteLine(text4);
						streamWriter.WriteLine("");
					}
				}
			}
			directoryInfo = new DirectoryInfo("C:\\Qualcomm");
			files = directoryInfo.GetFiles("*.*", SearchOption.AllDirectories);
			FileInfo[] array6 = files;
			foreach (FileInfo fileInfo6 in array6)
			{
				foreach (KeyValuePair<string, RegFileAttr> regFiles2 in RegFilesList)
				{
					if (fileInfo6.Name == regFiles2.Key)
					{
						string text5 = regFiles2.Value.cmd;
						if (text5.ToLower().Contains("regasm") && !text5.ToLower().Contains("\\regasm"))
						{
							text5 = ((!Environment.Is64BitOperatingSystem) ? text5.ToLower().Replace("regasm", "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\regasm") : text5.ToLower().Replace("regasm", "C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\regasm"));
						}
						streamWriter.WriteLine("cd /d " + fileInfo6.DirectoryName);
						streamWriter.WriteLine(text5);
						streamWriter.WriteLine("");
					}
				}
			}
			streamWriter.WriteLine("pause");
			streamWriter.Close();
			fileStream.Close();
			Process.Start(RemoveBackSlash(text + "\\register.bat"));
			PrintMsg("register files done...");
		}
		catch (Exception ex)
		{
			PrintMsg(MsgLevel.EXCEPTION, "Exception: " + ex.Message);
		}
		EnableExportBtn(bEnable: true);
	}

	private void StationList_SelectedIndexChanged(object sender, EventArgs e)
	{
		if (StationList.SelectedItem == null || StationList.SelectedIndex == stationList_last_index)
		{
			return;
		}
		stationList_last_index = StationList.SelectedIndex;
		string text = StationList.SelectedItem.ToString();
		ComponentLabel.Text = text + "\r\nComponents && options";
		StationView.Nodes.Clear();
		foreach (KeyValuePair<string, Station> stations in StationsList)
		{
			if (!(stations.Key == text))
			{
				continue;
			}
			foreach (Station.Config item in stations.Value.config_list)
			{
				TreeNode treeNode = StationView.Nodes[item.component];
				if (treeNode == null)
				{
					treeNode = StationView.Nodes.Add(item.component, item.component);
					treeNode.Checked = true;
				}
				TreeNode treeNode2 = treeNode.Nodes[item.option];
				if (treeNode2 == null)
				{
					treeNode2 = treeNode.Nodes.Add(item.option, item.option);
					treeNode2.Checked = true;
				}
			}
			StationView.ExpandAll();
		}
	}

	private void Create_Click(object sender, EventArgs e)
	{
		InputDiag inputDiag = new InputDiag();
		inputDiag.ShowDialog();
		string inputString = inputDiag.inputString;
		if (!(inputString == ""))
		{
			if (StationsList.ContainsKey(inputString))
			{
				PrintMsg("Station: " + inputString + " already exist");
				return;
			}
			StationView.Nodes.Clear();
			StationList.Items.Add(inputString);
			StationList.SelectedIndex = StationList.Items.Count - 1;
		}
	}

	private void Rename_Click(object sender, EventArgs e)
	{
		if (StationList.SelectedItem == null)
		{
			return;
		}
		string text = StationList.SelectedItem.ToString();
		if (StationsList.ContainsKey(text))
		{
			StationsList.Remove(text);
		}
		Station value = default(Station);
		value.config_list = new List<Station.Config>();
		Station.Config item = default(Station.Config);
		foreach (TreeNode node in StationView.Nodes)
		{
			if (node.Level != 0)
			{
				continue;
			}
			item.component = node.Text;
			foreach (TreeNode node2 in node.Nodes)
			{
				item.option = node2.Text;
				value.config_list.Add(item);
			}
		}
		value.UIDisplay = text;
		StationsList.Add(text, value);
		InputDiag inputDiag = new InputDiag();
		inputDiag.UpdateInputString(text);
		inputDiag.ShowDialog();
		string inputString = inputDiag.inputString;
		if (inputString == "")
		{
			return;
		}
		int selectedIndex = StationList.SelectedIndex;
		foreach (KeyValuePair<string, Station> stations in StationsList)
		{
			if (stations.Key == text)
			{
				value = stations.Value;
				StationsList.Remove(text);
				value.UIDisplay = inputString;
				StationsList.Add(inputString, value);
				break;
			}
		}
		StationList.Items.RemoveAt(selectedIndex);
		StationList.Items.Insert(selectedIndex, inputString);
		StationList.SelectedIndex = selectedIndex;
		StationList_SelectedIndexChanged(sender, e);
	}

	private void Save_Click(object sender, EventArgs e)
	{
		if (StationList.SelectedItem == null)
		{
			SaveStationListToFile();
			return;
		}
		string itemText = StationList.GetItemText(StationList.SelectedItem);
		if (StationsList.ContainsKey(itemText))
		{
			StationsList.Remove(itemText);
		}
		Station value = default(Station);
		value.config_list = new List<Station.Config>();
		Station.Config item = default(Station.Config);
		foreach (TreeNode node in StationView.Nodes)
		{
			if (node.Level != 0)
			{
				continue;
			}
			item.component = node.Text;
			foreach (TreeNode node2 in node.Nodes)
			{
				item.option = node2.Text;
				value.config_list.Add(item);
			}
		}
		value.UIDisplay = itemText;
		StationsList.Add(itemText, value);
		SaveStationListToFile();
	}

	private void SaveStationListToFile()
	{
		try
		{
			XmlDocument xmlDocument = new XmlDocument();
			xmlDocument.Load("QFPT_Config.xml");
			_ = xmlDocument.DocumentElement;
			XmlNode xmlNode = xmlDocument.SelectSingleNode("//Stations");
			xmlNode.RemoveAll();
			foreach (KeyValuePair<string, Station> stations in StationsList)
			{
				Station value = stations.Value;
				xmlNode = xmlDocument.SelectSingleNode("//Stations");
				XmlElement xmlElement = xmlDocument.CreateElement("Station");
				XmlAttribute xmlAttribute = xmlDocument.CreateAttribute("UIDisplay");
				xmlAttribute.Value = value.UIDisplay;
				xmlElement.Attributes.Append(xmlAttribute);
				foreach (Station.Config item in value.config_list)
				{
					XmlElement xmlElement2 = xmlDocument.CreateElement("Config");
					xmlAttribute = xmlDocument.CreateAttribute("Component");
					xmlAttribute.Value = item.component;
					xmlElement2.Attributes.Append(xmlAttribute);
					xmlAttribute = xmlDocument.CreateAttribute("Option");
					xmlAttribute.Value = item.option;
					xmlElement2.Attributes.Append(xmlAttribute);
					xmlElement.AppendChild(xmlElement2);
				}
				xmlNode.AppendChild(xmlElement);
			}
			xmlDocument.Save("QFPT_Config.xml");
		}
		catch (Exception ex)
		{
			PrintMsg(MsgLevel.EXCEPTION, "Exception: " + ex.Message);
			throw ex;
		}
	}

	private void Delete_Click(object sender, EventArgs e)
	{
		if (StationList.SelectedItem != null)
		{
			StationsList.Remove(StationList.SelectedItem.ToString());
			StationList.Items.Remove(StationList.SelectedItem);
			StationView.Nodes.Clear();
		}
	}

	private void StationList_MouseClick(object sender, MouseEventArgs e)
	{
		if (e.Button == MouseButtons.Right)
		{
			StationList_contextMenuStrip.Show(StationList, e.X, e.Y);
		}
	}

	private void StationList_ItemCheck(object sender, ItemCheckEventArgs e)
	{
		if (StationList.CheckedItems.Count >= 2)
		{
			Export.Visible = true;
		}
		else
		{
			Export.Visible = e.NewValue == CheckState.Checked;
		}
	}

	private void createToolStripMenuItem_Click(object sender, EventArgs e)
	{
		Create_Click(sender, e);
	}

	private void renameToolStripMenuItem_Click(object sender, EventArgs e)
	{
		Rename_Click(sender, e);
	}

	private void deleteToolStripMenuItem1_Click(object sender, EventArgs e)
	{
		Delete_Click(sender, e);
	}

	private void saveToolStripMenuItem_Click(object sender, EventArgs e)
	{
		Save_Click(sender, e);
	}

	private void AddComponents_Click(object sender, EventArgs e)
	{
		TreeNode treeNode = null;
		TreeNode treeNode2 = null;
		TreeNodeCollection nodes = ComponentView.Nodes;
		foreach (TreeNode item in nodes)
		{
			TreeNodeCollection nodes2 = item.Nodes;
			foreach (TreeNode item2 in nodes2)
			{
				if (item2.Checked)
				{
					string key = item.Text;
					treeNode = StationView.Nodes[key];
					if (treeNode == null)
					{
						treeNode2 = StationView.Nodes.Add(key, key);
						treeNode2.Checked = true;
					}
					string key2 = item2.Text;
					treeNode = StationView.Nodes[key];
					treeNode2 = treeNode.Nodes[key2];
					if (treeNode2 == null)
					{
						treeNode2 = treeNode.Nodes.Add(key2, key2);
						treeNode2.Checked = true;
					}
					item2.Checked = false;
				}
			}
			item.Checked = false;
		}
		StationView.ExpandAll();
	}

	private void RemoveComponents_Click(object sender, EventArgs e)
	{
		TreeNode selectedNode = StationView.SelectedNode;
		if (selectedNode != null)
		{
			StationView.Nodes.Remove(selectedNode);
		}
	}

	private void StationView_DoubleClick(object sender, EventArgs e)
	{
		if (StationView.SelectedNode != null && StationView.SelectedNode.Level != 0)
		{
			PrintOptionFiles(StationView.SelectedNode.Text);
		}
	}

	private void StationView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
	{
		if (e.Button == MouseButtons.Right && e.Node != null)
		{
			StationView.SelectedNode = e.Node;
			StationView_contextMenuStrip.Show(StationView, e.X, e.Y);
		}
	}

	private void StationView_AfterCheck(object sender, TreeViewEventArgs e)
	{
		if (e.Action != TreeViewAction.ByMouse)
		{
			return;
		}
		TreeNodeCollection nodes = e.Node.Nodes;
		if (nodes != null && nodes.Count > 0)
		{
			foreach (TreeNode item in nodes)
			{
				item.Checked = (e.Node.Checked ? true : false);
			}
		}
		TreeNode treeNode2 = e.Node.Parent;
		if (treeNode2 == null)
		{
			return;
		}
		bool flag = false;
		nodes = treeNode2.Nodes;
		foreach (TreeNode item2 in nodes)
		{
			if (item2.Checked)
			{
				flag = true;
				break;
			}
		}
		treeNode2.Checked = (flag ? true : false);
	}

	private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
	{
		TreeNode selectedNode = StationView.SelectedNode;
		if (selectedNode != null)
		{
			StationView.Nodes.Remove(selectedNode);
		}
	}

	private void expandAllToolStripMenuItem1_Click(object sender, EventArgs e)
	{
		StationView.ExpandAll();
	}

	private void collapseAllToolStripMenuItem1_Click(object sender, EventArgs e)
	{
		StationView.CollapseAll();
	}

	private void ComponentView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
	{
		if (e.Button == MouseButtons.Right && e.Node != null)
		{
			ComponentView.SelectedNode = e.Node;
			ComponentView_contextMenuStrip.Show(ComponentView, e.X, e.Y);
		}
	}

	private void addComponentToolStripMenuItem_Click(object sender, EventArgs e)
	{
		OpenFileDialog openFileDialog = new OpenFileDialog();
		openFileDialog.Filter = "Component XML Files(*.xml)|*.xml";
		openFileDialog.Multiselect = true;
		if (openFileDialog.ShowDialog() != DialogResult.OK)
		{
			return;
		}
		string[] fileNames = openFileDialog.FileNames;
		for (int i = 0; i < fileNames.Length; i++)
		{
			try
			{
				LoadComponentXML(fileNames[i]);
			}
			catch (Exception ex)
			{
				PrintMsg(MsgLevel.EXCEPTION, "Exception: " + ex.Message);
			}
		}
		UpdateQDARTComponentView();
	}

	private void UpdateQDARTComponentView()
	{
		ComponentView.Nodes.Clear();
		foreach (KeyValuePair<string, QDARTComponent> qDARTComponents in QDARTComponentsList)
		{
			QDARTComponent value = qDARTComponents.Value;
			TreeNode treeNode = ComponentView.Nodes[value.componentName];
			if (treeNode != null)
			{
				continue;
			}
			treeNode = ComponentView.Nodes.Add(value.componentName, value.componentName);
			foreach (QDARTComponent.Option item in value.option_list)
			{
				treeNode.Nodes.Add(item.optionName, item.optionName);
			}
		}
	}

	public void UpdateQDARTComponentList(List<QDARTComponent> QdartComponentList)
	{
		foreach (QDARTComponent QdartComponent in QdartComponentList)
		{
			if (QDARTComponentsList.ContainsKey(QdartComponent.file))
			{
				QDARTComponentsList.Remove(QdartComponent.file);
			}
			QDARTComponentsList.Add(QdartComponent.file, QdartComponent);
		}
	}

	private void editComponentToolStripMenuItem_Click(object sender, EventArgs e)
	{
		TreeNode selectedNode = ComponentView.SelectedNode;
		if (selectedNode == null)
		{
			return;
		}
		TreeNode treeNode = selectedNode.Parent;
		selectedNode = ((treeNode == null) ? selectedNode : treeNode);
		ComponentEditor componentEditor = new ComponentEditor();
		foreach (KeyValuePair<string, QDARTComponent> qDARTComponents in QDARTComponentsList)
		{
			if (qDARTComponents.Value.componentName == selectedNode.Text)
			{
				componentEditor.SetQDARTInstallPath(QDART_Install_Path);
				componentEditor.SetCurrentComponentFile(qDARTComponents.Value.file);
				break;
			}
		}
		componentEditor.ShowDialog();
		UpdateQDARTComponentView();
	}

	private void createComponentToolStripMenuItem_Click(object sender, EventArgs e)
	{
		ComponentEditor componentEditor = new ComponentEditor();
		componentEditor.SetQDARTInstallPath(QDART_Install_Path);
		componentEditor.ShowDialog();
		UpdateQDARTComponentView();
	}

	private void expandAllToolStripMenuItem_Click(object sender, EventArgs e)
	{
		ComponentView.ExpandAll();
	}

	private void collapseAllToolStripMenuItem_Click(object sender, EventArgs e)
	{
		ComponentView.CollapseAll();
	}

	private void ComponentView_DoubleClick(object sender, EventArgs e)
	{
		if (ComponentView.SelectedNode != null && ComponentView.SelectedNode.Level != 0)
		{
			PrintOptionFiles(ComponentView.SelectedNode.Text);
		}
	}

	private void PrintOptionFiles(string option)
	{
		foreach (KeyValuePair<string, QDARTComponent> qDARTComponents in QDARTComponentsList)
		{
			foreach (QDARTComponent.Option item in qDARTComponents.Value.option_list)
			{
				if (!(item.optionName == option))
				{
					continue;
				}
				MsgBox.Clear();
				PrintMsg(qDARTComponents.Value.file);
				PrintMsg("  --  " + qDARTComponents.Value.componentName);
				PrintMsg("      --  " + item.optionName);
				string text = "";
				foreach (QDARTComponent.Option.FileAttr item2 in item.fileAttr_list)
				{
					text = ((!item2.path.Contains(":")) ? Path.Combine(QDART_Install_Path + "\\" + item2.path + "\\" + item2.name) : (item2.path + "\\" + item2.name));
					PrintMsg(RemoveBackSlash("        -- File=" + text));
				}
			}
		}
	}

	private void ComponentView_AfterCheck(object sender, TreeViewEventArgs e)
	{
		if (e.Action != TreeViewAction.ByMouse)
		{
			return;
		}
		TreeNodeCollection nodes = e.Node.Nodes;
		if (nodes != null && nodes.Count > 0)
		{
			foreach (TreeNode item in nodes)
			{
				item.Checked = (e.Node.Checked ? true : false);
			}
		}
		TreeNode treeNode2 = e.Node.Parent;
		if (treeNode2 == null)
		{
			return;
		}
		bool flag = false;
		nodes = treeNode2.Nodes;
		foreach (TreeNode item2 in nodes)
		{
			if (item2.Checked)
			{
				flag = true;
				break;
			}
		}
		treeNode2.Checked = (flag ? true : false);
	}

	public void PrintMsg(string msg)
	{
		if (MsgBox.InvokeRequired)
		{
			PrintMsgCB method = PrintMsg;
			MsgBox.BeginInvoke(method, msg);
		}
		else
		{
			MsgBox.AppendText(msg + "\r\n");
			MsgBox.ScrollToCaret();
		}
	}

	public void PrintMsg(MsgLevel msgLevel, string msg)
	{
		if (MsgBox.InvokeRequired)
		{
			PrintMsgLevelCB method = PrintMsg;
			MsgBox.BeginInvoke(method, msgLevel, msg);
			return;
		}
		if (MsgBox.TextLength == 0)
		{
			MsgBox.Select(0, -1);
		}
		switch (msgLevel)
		{
		case MsgLevel.WARNING:
			MsgBox.SelectionBackColor = Color.Yellow;
			break;
		case MsgLevel.ERROR:
			MsgBox.SelectionBackColor = Color.Orange;
			break;
		case MsgLevel.CRITICAL:
			MsgBox.SelectionBackColor = Color.Tomato;
			break;
		case MsgLevel.EXCEPTION:
			MsgBox.SelectionBackColor = Color.Thistle;
			break;
		default:
			MsgBox.SelectionBackColor = Color.White;
			break;
		}
		MsgBox.AppendText(msg + "\r\n");
		MsgBox.ScrollToCaret();
	}

	private void MsgBox_MouseClick(object sender, MouseEventArgs e)
	{
		if (e.Button == MouseButtons.Right)
		{
			MsgBox_contextMenuStrip.Show(MsgBox, e.X, e.Y);
		}
	}

	private void clearToolStripMenuItem_Click(object sender, EventArgs e)
	{
		MsgBox.Clear();
	}

	private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
	{
		SaveFileDialog saveFileDialog = new SaveFileDialog();
		saveFileDialog.Filter = "Text File(*.txt)|*.txt";
		if (saveFileDialog.ShowDialog() != DialogResult.OK)
		{
			return;
		}
		string fileName = saveFileDialog.FileName;
		PrintMsg("log file: " + fileName);
		FileStream fileStream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
		if (fileStream == null)
		{
			return;
		}
		StreamWriter streamWriter = new StreamWriter(fileStream);
		if (streamWriter != null)
		{
			string[] lines = MsgBox.Lines;
			string[] array = lines;
			foreach (string value in array)
			{
				streamWriter.WriteLine(value);
			}
			streamWriter.Close();
			fileStream.Close();
		}
	}

	private void Browse_Click(object sender, EventArgs e)
	{
		FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
		folderBrowserDialog.ShowNewFolderButton = false;
		folderBrowserDialog.Description = "Select QDART install path";
		if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
		{
			QDARTInstallPath.Text = folderBrowserDialog.SelectedPath.ToString();
			QDART_Install_Path = QDARTInstallPath.Text;
			UpdateXmlNode("QDART_Install_Path", QDART_Install_Path);
		}
	}

	private void BrowseImagePath_Click(object sender, EventArgs e)
	{
		FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
		folderBrowserDialog.ShowNewFolderButton = true;
		folderBrowserDialog.Description = "Select create image path";
		if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
		{
			CreateImagePath.Text = folderBrowserDialog.SelectedPath.ToString();
			Create_Image_Path = CreateImagePath.Text;
			UpdateXmlNode("Create_Image_Path", Create_Image_Path);
		}
	}

	private void LoadXML()
	{
		StationsList.Clear();
		QDARTComponentsList.Clear();
		RegFilesList.Clear();
		NoOverwrittenFiles.Clear();
		if (!File.Exists("QFPT_Config.xml"))
		{
			MessageBox.Show("Can't open QFPT_Config.xml");
			Environment.Exit(0);
		}
		try
		{
			XmlDocument xmlDocument = new XmlDocument();
			xmlDocument.Load("QFPT_Config.xml");
			XmlElement documentElement = xmlDocument.DocumentElement;
			XmlNodeList elementsByTagName = documentElement.GetElementsByTagName("Language");
			if (elementsByTagName.Count > 0)
			{
				Language = elementsByTagName[0].InnerText;
			}
			XmlNodeList elementsByTagName2 = documentElement.GetElementsByTagName("QDART_Install_Path");
			if (elementsByTagName2.Count > 0)
			{
				if (elementsByTagName2[0].InnerText != "")
				{
					QDART_Install_Path = elementsByTagName2[0].InnerText;
					if (QDART_Install_Path != QDART_Install_Path_Reg)
					{
						PrintMsg(MsgLevel.WARNING, "QDART install path in QFPT_Config.xml doesn't match to the install path read from regedit");
					}
				}
				else
				{
					QDART_Install_Path = ((QDART_Install_Path_Reg != "") ? QDART_Install_Path_Reg : QDART_Install_Path);
				}
			}
			XmlNodeList elementsByTagName3 = documentElement.GetElementsByTagName("Create_Image_Path");
			if (elementsByTagName3.Count > 0)
			{
				Create_Image_Path = elementsByTagName3[0].InnerText;
			}
			XmlNodeList elementsByTagName4 = documentElement.GetElementsByTagName("Station");
			Station value = default(Station);
			Station.Config item = default(Station.Config);
			foreach (XmlNode item2 in elementsByTagName4)
			{
				value.config_list = new List<Station.Config>();
				value.UIDisplay = ((XmlElement)item2).GetAttribute("UIDisplay");
				XmlNodeList elementsByTagName5 = ((XmlElement)item2).GetElementsByTagName("Config");
				foreach (XmlNode item3 in elementsByTagName5)
				{
					item.component = ((XmlElement)item3).GetAttribute("Component");
					item.option = ((XmlElement)item3).GetAttribute("Option");
					value.config_list.Add(item);
				}
				StationsList.Add(value.UIDisplay, value);
			}
			DirectoryInfo directoryInfo = new DirectoryInfo("..\\Packager");
			FileInfo[] files = directoryInfo.GetFiles("*.xml", SearchOption.AllDirectories);
			FileInfo[] array = files;
			foreach (FileInfo fileInfo in array)
			{
				LoadComponentXML(fileInfo.FullName);
			}
		}
		catch (Exception ex)
		{
			PrintMsg(MsgLevel.EXCEPTION, "Exception: " + ex.Message);
		}
	}

	private void XmlValidationEventHandler(object sender, ValidationEventArgs e)
	{
		string text = "";
		switch (e.Severity)
		{
		case XmlSeverityType.Error:
			text += e.Message;
			break;
		}
		if (text != "")
		{
			throw new Exception(text);
		}
	}

	private void LoadComponentXML(string xmlFile)
	{
		try
		{
			XmlDocument xmlDocument = new XmlDocument();
			xmlDocument.Load(xmlFile);
			string error = "";
			XmlSchemaSet xmlSchemaSet = new XmlSchemaSet();
			xmlSchemaSet.Add("", "..\\Databases\\Schema\\Packager.xsd");
			xmlDocument.Schemas = xmlSchemaSet;
			ValidationEventHandler validationEventHandler = delegate(object sender, ValidationEventArgs e)
			{
				switch (e.Severity)
				{
				case XmlSeverityType.Error:
					error += e.Message;
					break;
				case XmlSeverityType.Warning:
					break;
				}
			};
			xmlDocument.Validate(validationEventHandler);
			if (error != "")
			{
				throw new Exception("Load component file: " + xmlFile + "\r\n" + error);
			}
			XmlElement documentElement = xmlDocument.DocumentElement;
			XmlNodeList elementsByTagName = documentElement.GetElementsByTagName("QDARTComponent");
			QDARTComponent value = default(QDARTComponent);
			QDARTComponent.Option item = default(QDARTComponent.Option);
			QDARTComponent.Option.FileAttr item2 = default(QDARTComponent.Option.FileAttr);
			foreach (XmlNode item3 in elementsByTagName)
			{
				value.option_list = new List<QDARTComponent.Option>();
				value.file = xmlFile;
				string attribute = ((XmlElement)item3).GetAttribute("Name");
				value.componentName = attribute;
				XmlNodeList elementsByTagName2 = ((XmlElement)item3).GetElementsByTagName("Option");
				foreach (XmlNode item4 in elementsByTagName2)
				{
					item.fileAttr_list = new List<QDARTComponent.Option.FileAttr>();
					string attribute2 = ((XmlElement)item4).GetAttribute("Name");
					item.optionName = attribute2;
					XmlNodeList elementsByTagName3 = ((XmlElement)item4).GetElementsByTagName("FileAttribute");
					foreach (XmlNode item5 in elementsByTagName3)
					{
						item2.path = ((XmlElement)item5).GetAttribute("Path");
						item2.name = ((XmlElement)item5).GetAttribute("Name");
						if (!(item2.path == "") && !(item2.name == ""))
						{
							item.fileAttr_list.Add(item2);
						}
					}
					value.option_list.Add(item);
				}
				QDARTComponentsList.Add(value.file, value);
			}
			XmlNodeList elementsByTagName4 = documentElement.GetElementsByTagName("Registration");
			RegFileAttr value2 = default(RegFileAttr);
			foreach (XmlNode item6 in elementsByTagName4)
			{
				XmlNodeList elementsByTagName5 = ((XmlElement)item6).GetElementsByTagName("RegFile");
				foreach (XmlNode item7 in elementsByTagName5)
				{
					string attribute3 = ((XmlElement)item7).GetAttribute("Name");
					string attribute4 = ((XmlElement)item7).GetAttribute("Cmd");
					string attribute5 = ((XmlElement)item7).GetAttribute("Comment");
					if (!(attribute3 == "") && !(attribute4 == "") && !RegFilesList.ContainsKey(attribute3))
					{
						value2.cmd = attribute4;
						value2.comment = attribute5;
						RegFilesList.Add(attribute3, value2);
					}
				}
			}
			XmlNodeList elementsByTagName6 = documentElement.GetElementsByTagName("NoOverwritten");
			foreach (XmlNode item8 in elementsByTagName6)
			{
				XmlNodeList elementsByTagName7 = ((XmlElement)item8).GetElementsByTagName("NoOverwrittenFile");
				foreach (XmlNode item9 in elementsByTagName7)
				{
					string attribute6 = ((XmlElement)item9).GetAttribute("Path");
					string attribute7 = ((XmlElement)item9).GetAttribute("Name");
					if (!(attribute6 == "") && !(attribute7 == "") && !NoOverwrittenFiles.ContainsKey(attribute7))
					{
						NoOverwrittenFiles.Add(attribute7, attribute6);
					}
				}
			}
		}
		catch (Exception ex)
		{
			PrintMsg(MsgLevel.EXCEPTION, "Exception: " + ex.Message);
		}
	}

	private void UpdateXmlNode(string name, string param)
	{
		XmlDocument xmlDocument = new XmlDocument();
		xmlDocument.Load("QFPT_Config.xml");
		XmlElement documentElement = xmlDocument.DocumentElement;
		XmlNodeList elementsByTagName = documentElement.GetElementsByTagName(name);
		if (elementsByTagName.Count > 0)
		{
			foreach (XmlNode item in elementsByTagName)
			{
				item.InnerText = param;
			}
		}
		xmlDocument.Save("QFPT_Config.xml");
	}

	private string RemoveBackSlash(string param)
	{
		while (param.Contains("\\\\"))
		{
			param = param.Replace("\\\\", "\\");
		}
		return param;
	}

	public string ExecuteCMD(string filename, string arguments, int milliseconds)
	{
		string result = "";
		string text = "";
		Process process = new Process();
		process.StartInfo.FileName = filename;
		process.StartInfo.Arguments = arguments;
		process.StartInfo.UseShellExecute = false;
		process.StartInfo.RedirectStandardInput = true;
		process.StartInfo.RedirectStandardOutput = true;
		process.StartInfo.RedirectStandardError = true;
		process.StartInfo.CreateNoWindow = true;
		try
		{
			if (process.Start())
			{
				result = process.StandardOutput.ReadToEnd();
				text = process.StandardError.ReadToEnd();
				if (milliseconds == 0)
				{
					process.WaitForExit();
				}
				else
				{
					process.WaitForExit(milliseconds);
				}
				if (text != "")
				{
					throw new ApplicationException(text);
				}
			}
		}
		catch (ApplicationException ex)
		{
			throw ex;
		}
		catch (Exception ex2)
		{
			PrintMsg(MsgLevel.EXCEPTION, "Exception: " + ex2.Message);
		}
		finally
		{
			process?.Close();
		}
		return result;
	}

	private void saveStationConfigToolStripMenuItem_Click(object sender, EventArgs e)
	{
		Save_Click(sender, e);
	}

	private void saveAndExitToolStripMenuItem_Click(object sender, EventArgs e)
	{
		Save_Click(sender, e);
		Environment.Exit(0);
	}

	private void exitToolStripMenuItem_Click(object sender, EventArgs e)
	{
		Environment.Exit(0);
	}

	private void componentEditorToolStripMenuItem_Click(object sender, EventArgs e)
	{
		ComponentEditor componentEditor = new ComponentEditor();
		componentEditor.SetQDARTInstallPath(QDART_Install_Path);
		componentEditor.ShowDialog();
		UpdateQDARTComponentView();
	}

	private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
	{
		About about = new About();
		about.ShowDialog();
	}

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

	private void InitializeComponent()
	{
		this.components = new System.ComponentModel.Container();
		System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(global::QFPT.QFPT));
		this.MsgBox = new System.Windows.Forms.RichTextBox();
		this.MsgBox_contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
		this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.QDARTInstallPath = new System.Windows.Forms.TextBox();
		this.Browse = new System.Windows.Forms.Button();
		this.groupBox2 = new System.Windows.Forms.GroupBox();
		this.label4 = new System.Windows.Forms.Label();
		this.BrowseImagePath = new System.Windows.Forms.Button();
		this.CreateImagePath = new System.Windows.Forms.TextBox();
		this.label2 = new System.Windows.Forms.Label();
		this.ComponentLabel = new System.Windows.Forms.Label();
		this.StationLabel = new System.Windows.Forms.Label();
		this.StationList = new System.Windows.Forms.CheckedListBox();
		this.StationList_contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
		this.createToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.deleteToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
		this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.StationView = new System.Windows.Forms.TreeView();
		this.StationView_contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
		this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.expandAllToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
		this.collapseAllToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
		this.ComponentView_contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
		this.addComponentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.editComponentToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
		this.expandAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.collapseAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.Main_menuStrip = new System.Windows.Forms.MenuStrip();
		this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.saveStationConfigToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.saveAndExitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.toolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.componentEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.Export = new System.Windows.Forms.Button();
		this.AddComponents = new System.Windows.Forms.Button();
		this.RemoveComponents = new System.Windows.Forms.Button();
		this.QdartComponentLabel = new System.Windows.Forms.Label();
		this.ComponentView = new System.Windows.Forms.TreeView();
		this.label1 = new System.Windows.Forms.Label();
		this.label3 = new System.Windows.Forms.Label();
		this.MsgBox_contextMenuStrip.SuspendLayout();
		this.groupBox2.SuspendLayout();
		this.StationList_contextMenuStrip.SuspendLayout();
		this.StationView_contextMenuStrip.SuspendLayout();
		this.ComponentView_contextMenuStrip.SuspendLayout();
		this.Main_menuStrip.SuspendLayout();
		base.SuspendLayout();
		this.MsgBox.ContextMenuStrip = this.MsgBox_contextMenuStrip;
		this.MsgBox.Font = new System.Drawing.Font("Arial", 10f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.MsgBox.Location = new System.Drawing.Point(14, 503);
		this.MsgBox.Margin = new System.Windows.Forms.Padding(4);
		this.MsgBox.Name = "MsgBox";
		this.MsgBox.Size = new System.Drawing.Size(967, 201);
		this.MsgBox.TabIndex = 3;
		this.MsgBox.Text = "";
		this.MsgBox.MouseClick += new System.Windows.Forms.MouseEventHandler(MsgBox_MouseClick);
		this.MsgBox_contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[2] { this.clearToolStripMenuItem, this.saveAsToolStripMenuItem });
		this.MsgBox_contextMenuStrip.Name = "MsgBox_contextMenuStrip";
		this.MsgBox_contextMenuStrip.Size = new System.Drawing.Size(128, 52);
		this.clearToolStripMenuItem.Name = "clearToolStripMenuItem";
		this.clearToolStripMenuItem.Size = new System.Drawing.Size(127, 24);
		this.clearToolStripMenuItem.Text = "Clear";
		this.clearToolStripMenuItem.Click += new System.EventHandler(clearToolStripMenuItem_Click);
		this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
		this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(127, 24);
		this.saveAsToolStripMenuItem.Text = "Save as";
		this.saveAsToolStripMenuItem.Click += new System.EventHandler(saveAsToolStripMenuItem_Click);
		this.QDARTInstallPath.Font = new System.Drawing.Font("Arial", 10f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.QDARTInstallPath.Location = new System.Drawing.Point(147, 18);
		this.QDARTInstallPath.Margin = new System.Windows.Forms.Padding(4);
		this.QDARTInstallPath.Name = "QDARTInstallPath";
		this.QDARTInstallPath.Size = new System.Drawing.Size(395, 27);
		this.QDARTInstallPath.TabIndex = 4;
		this.Browse.Font = new System.Drawing.Font("Arial", 10f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.Browse.Location = new System.Drawing.Point(543, 15);
		this.Browse.Margin = new System.Windows.Forms.Padding(4);
		this.Browse.Name = "Browse";
		this.Browse.Size = new System.Drawing.Size(65, 28);
		this.Browse.TabIndex = 6;
		this.Browse.Text = "Browse";
		this.Browse.UseVisualStyleBackColor = true;
		this.Browse.Click += new System.EventHandler(Browse_Click);
		this.groupBox2.Controls.Add(this.label4);
		this.groupBox2.Controls.Add(this.BrowseImagePath);
		this.groupBox2.Controls.Add(this.CreateImagePath);
		this.groupBox2.Controls.Add(this.label2);
		this.groupBox2.Controls.Add(this.ComponentLabel);
		this.groupBox2.Controls.Add(this.StationLabel);
		this.groupBox2.Controls.Add(this.StationList);
		this.groupBox2.Controls.Add(this.StationView);
		this.groupBox2.Controls.Add(this.Browse);
		this.groupBox2.Controls.Add(this.QDARTInstallPath);
		this.groupBox2.Font = new System.Drawing.Font("Arial", 10f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
		this.groupBox2.Location = new System.Drawing.Point(14, 15);
		this.groupBox2.Margin = new System.Windows.Forms.Padding(4);
		this.groupBox2.Name = "groupBox2";
		this.groupBox2.Padding = new System.Windows.Forms.Padding(4);
		this.groupBox2.Size = new System.Drawing.Size(617, 430);
		this.groupBox2.TabIndex = 8;
		this.groupBox2.TabStop = false;
		this.label4.AutoSize = true;
		this.label4.Location = new System.Drawing.Point(7, 54);
		this.label4.Name = "label4";
		this.label4.Size = new System.Drawing.Size(159, 19);
		this.label4.TabIndex = 28;
		this.label4.Text = "Create Image Path:";
		this.BrowseImagePath.Font = new System.Drawing.Font("Arial", 10f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.BrowseImagePath.Location = new System.Drawing.Point(543, 48);
		this.BrowseImagePath.Margin = new System.Windows.Forms.Padding(4);
		this.BrowseImagePath.Name = "BrowseImagePath";
		this.BrowseImagePath.Size = new System.Drawing.Size(65, 28);
		this.BrowseImagePath.TabIndex = 27;
		this.BrowseImagePath.Text = "Browse";
		this.BrowseImagePath.UseVisualStyleBackColor = true;
		this.BrowseImagePath.Click += new System.EventHandler(BrowseImagePath_Click);
		this.CreateImagePath.Font = new System.Drawing.Font("Arial", 10f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.CreateImagePath.Location = new System.Drawing.Point(147, 51);
		this.CreateImagePath.Margin = new System.Windows.Forms.Padding(4);
		this.CreateImagePath.Name = "CreateImagePath";
		this.CreateImagePath.Size = new System.Drawing.Size(395, 27);
		this.CreateImagePath.TabIndex = 26;
		this.label2.AutoSize = true;
		this.label2.Location = new System.Drawing.Point(7, 21);
		this.label2.Name = "label2";
		this.label2.Size = new System.Drawing.Size(165, 19);
		this.label2.TabIndex = 25;
		this.label2.Text = "QDART Install Path:";
		this.ComponentLabel.AutoSize = true;
		this.ComponentLabel.Location = new System.Drawing.Point(373, 79);
		this.ComponentLabel.Name = "ComponentLabel";
		this.ComponentLabel.Size = new System.Drawing.Size(193, 19);
		this.ComponentLabel.TabIndex = 24;
		this.ComponentLabel.Text = "Components && Options";
		this.StationLabel.AutoSize = true;
		this.StationLabel.Location = new System.Drawing.Point(101, 85);
		this.StationLabel.Name = "StationLabel";
		this.StationLabel.Size = new System.Drawing.Size(112, 19);
		this.StationLabel.TabIndex = 22;
		this.StationLabel.Text = "Test Stations";
		this.StationList.ContextMenuStrip = this.StationList_contextMenuStrip;
		this.StationList.Font = new System.Drawing.Font("Arial", 10f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.StationList.FormattingEnabled = true;
		this.StationList.Location = new System.Drawing.Point(10, 114);
		this.StationList.Name = "StationList";
		this.StationList.Size = new System.Drawing.Size(296, 290);
		this.StationList.TabIndex = 21;
		this.StationList.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(StationList_ItemCheck);
		this.StationList.MouseClick += new System.Windows.Forms.MouseEventHandler(StationList_MouseClick);
		this.StationList.SelectedIndexChanged += new System.EventHandler(StationList_SelectedIndexChanged);
		this.StationList_contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[4] { this.createToolStripMenuItem, this.editToolStripMenuItem, this.deleteToolStripMenuItem1, this.saveToolStripMenuItem });
		this.StationList_contextMenuStrip.Name = "StationList_contextMenuStrip";
		this.StationList_contextMenuStrip.Size = new System.Drawing.Size(133, 100);
		this.createToolStripMenuItem.Name = "createToolStripMenuItem";
		this.createToolStripMenuItem.Size = new System.Drawing.Size(132, 24);
		this.createToolStripMenuItem.Text = "Create";
		this.createToolStripMenuItem.Click += new System.EventHandler(createToolStripMenuItem_Click);
		this.editToolStripMenuItem.Name = "editToolStripMenuItem";
		this.editToolStripMenuItem.Size = new System.Drawing.Size(132, 24);
		this.editToolStripMenuItem.Text = "Rename";
		this.editToolStripMenuItem.Click += new System.EventHandler(renameToolStripMenuItem_Click);
		this.deleteToolStripMenuItem1.Name = "deleteToolStripMenuItem1";
		this.deleteToolStripMenuItem1.Size = new System.Drawing.Size(132, 24);
		this.deleteToolStripMenuItem1.Text = "Delete";
		this.deleteToolStripMenuItem1.Click += new System.EventHandler(deleteToolStripMenuItem1_Click);
		this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
		this.saveToolStripMenuItem.Size = new System.Drawing.Size(132, 24);
		this.saveToolStripMenuItem.Text = "Save";
		this.saveToolStripMenuItem.Click += new System.EventHandler(saveToolStripMenuItem_Click);
		this.StationView.ContextMenuStrip = this.StationView_contextMenuStrip;
		this.StationView.Font = new System.Drawing.Font("Arial", 10f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.StationView.Location = new System.Drawing.Point(312, 114);
		this.StationView.Name = "StationView";
		this.StationView.Size = new System.Drawing.Size(296, 310);
		this.StationView.TabIndex = 10;
		this.StationView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(StationView_AfterCheck);
		this.StationView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(StationView_NodeMouseClick);
		this.StationView.DoubleClick += new System.EventHandler(StationView_DoubleClick);
		this.StationView_contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[3] { this.deleteToolStripMenuItem, this.expandAllToolStripMenuItem1, this.collapseAllToolStripMenuItem1 });
		this.StationView_contextMenuStrip.Name = "StationView_contextMenuStrip";
		this.StationView_contextMenuStrip.Size = new System.Drawing.Size(158, 76);
		this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
		this.deleteToolStripMenuItem.Size = new System.Drawing.Size(157, 24);
		this.deleteToolStripMenuItem.Text = "Delete";
		this.deleteToolStripMenuItem.Click += new System.EventHandler(deleteToolStripMenuItem_Click);
		this.expandAllToolStripMenuItem1.Name = "expandAllToolStripMenuItem1";
		this.expandAllToolStripMenuItem1.Size = new System.Drawing.Size(157, 24);
		this.expandAllToolStripMenuItem1.Text = "Expand All";
		this.expandAllToolStripMenuItem1.Click += new System.EventHandler(expandAllToolStripMenuItem1_Click);
		this.collapseAllToolStripMenuItem1.Name = "collapseAllToolStripMenuItem1";
		this.collapseAllToolStripMenuItem1.Size = new System.Drawing.Size(157, 24);
		this.collapseAllToolStripMenuItem1.Text = "Collapse All";
		this.collapseAllToolStripMenuItem1.Click += new System.EventHandler(collapseAllToolStripMenuItem1_Click);
		this.ComponentView_contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[4] { this.addComponentToolStripMenuItem, this.editComponentToolStripMenuItem1, this.expandAllToolStripMenuItem, this.collapseAllToolStripMenuItem });
		this.ComponentView_contextMenuStrip.Name = "ComponentView_contextMenuStrip";
		this.ComponentView_contextMenuStrip.Size = new System.Drawing.Size(239, 100);
		this.addComponentToolStripMenuItem.Name = "addComponentToolStripMenuItem";
		this.addComponentToolStripMenuItem.Size = new System.Drawing.Size(238, 24);
		this.addComponentToolStripMenuItem.Text = "Import Component XML";
		this.addComponentToolStripMenuItem.Click += new System.EventHandler(addComponentToolStripMenuItem_Click);
		this.editComponentToolStripMenuItem1.Name = "editComponentToolStripMenuItem1";
		this.editComponentToolStripMenuItem1.Size = new System.Drawing.Size(238, 24);
		this.editComponentToolStripMenuItem1.Text = "Edit Component";
		this.editComponentToolStripMenuItem1.Click += new System.EventHandler(editComponentToolStripMenuItem_Click);
		this.expandAllToolStripMenuItem.Name = "expandAllToolStripMenuItem";
		this.expandAllToolStripMenuItem.Size = new System.Drawing.Size(238, 24);
		this.expandAllToolStripMenuItem.Text = "Expand All";
		this.expandAllToolStripMenuItem.Click += new System.EventHandler(expandAllToolStripMenuItem_Click);
		this.collapseAllToolStripMenuItem.Name = "collapseAllToolStripMenuItem";
		this.collapseAllToolStripMenuItem.Size = new System.Drawing.Size(238, 24);
		this.collapseAllToolStripMenuItem.Text = "Collapse All";
		this.collapseAllToolStripMenuItem.Click += new System.EventHandler(collapseAllToolStripMenuItem_Click);
		this.Main_menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[3] { this.fileToolStripMenuItem, this.toolToolStripMenuItem, this.helpToolStripMenuItem });
		this.Main_menuStrip.Location = new System.Drawing.Point(0, 0);
		this.Main_menuStrip.Name = "Main_menuStrip";
		this.Main_menuStrip.Size = new System.Drawing.Size(994, 28);
		this.Main_menuStrip.TabIndex = 22;
		this.Main_menuStrip.Text = "menuStrip1";
		this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[3] { this.saveStationConfigToolStripMenuItem, this.saveAndExitToolStripMenuItem, this.exitToolStripMenuItem });
		this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
		this.fileToolStripMenuItem.Size = new System.Drawing.Size(44, 24);
		this.fileToolStripMenuItem.Text = "File";
		this.saveStationConfigToolStripMenuItem.Name = "saveStationConfigToolStripMenuItem";
		this.saveStationConfigToolStripMenuItem.Size = new System.Drawing.Size(208, 24);
		this.saveStationConfigToolStripMenuItem.Text = "Save Station Config";
		this.saveStationConfigToolStripMenuItem.Click += new System.EventHandler(saveStationConfigToolStripMenuItem_Click);
		this.saveAndExitToolStripMenuItem.Name = "saveAndExitToolStripMenuItem";
		this.saveAndExitToolStripMenuItem.Size = new System.Drawing.Size(208, 24);
		this.saveAndExitToolStripMenuItem.Text = "Save and Exit";
		this.saveAndExitToolStripMenuItem.Click += new System.EventHandler(saveAndExitToolStripMenuItem_Click);
		this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
		this.exitToolStripMenuItem.Size = new System.Drawing.Size(208, 24);
		this.exitToolStripMenuItem.Text = "Exit";
		this.exitToolStripMenuItem.Click += new System.EventHandler(exitToolStripMenuItem_Click);
		this.toolToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[1] { this.componentEditorToolStripMenuItem });
		this.toolToolStripMenuItem.Name = "toolToolStripMenuItem";
		this.toolToolStripMenuItem.Size = new System.Drawing.Size(50, 24);
		this.toolToolStripMenuItem.Text = "Tool";
		this.componentEditorToolStripMenuItem.Name = "componentEditorToolStripMenuItem";
		this.componentEditorToolStripMenuItem.Size = new System.Drawing.Size(200, 24);
		this.componentEditorToolStripMenuItem.Text = "Component Editor";
		this.componentEditorToolStripMenuItem.Click += new System.EventHandler(componentEditorToolStripMenuItem_Click);
		this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[1] { this.aboutToolStripMenuItem });
		this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
		this.helpToolStripMenuItem.Size = new System.Drawing.Size(53, 24);
		this.helpToolStripMenuItem.Text = "Help";
		this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
		this.aboutToolStripMenuItem.Size = new System.Drawing.Size(157, 24);
		this.aboutToolStripMenuItem.Text = "About QFPT";
		this.aboutToolStripMenuItem.Click += new System.EventHandler(aboutToolStripMenuItem_Click);
		this.Export.Font = new System.Drawing.Font("Arial", 10f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.Export.Location = new System.Drawing.Point(24, 448);
		this.Export.Margin = new System.Windows.Forms.Padding(4);
		this.Export.Name = "Export";
		this.Export.Size = new System.Drawing.Size(319, 32);
		this.Export.TabIndex = 23;
		this.Export.Text = "Create Image";
		this.Export.UseVisualStyleBackColor = true;
		this.Export.Visible = false;
		this.Export.Click += new System.EventHandler(Export_Click);
		this.AddComponents.Font = new System.Drawing.Font("Arial", 10f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.AddComponents.Location = new System.Drawing.Point(640, 183);
		this.AddComponents.Margin = new System.Windows.Forms.Padding(4);
		this.AddComponents.Name = "AddComponents";
		this.AddComponents.Size = new System.Drawing.Size(41, 43);
		this.AddComponents.TabIndex = 24;
		this.AddComponents.Text = "<<";
		this.AddComponents.UseVisualStyleBackColor = true;
		this.AddComponents.Click += new System.EventHandler(AddComponents_Click);
		this.RemoveComponents.Font = new System.Drawing.Font("Arial", 10f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.RemoveComponents.Location = new System.Drawing.Point(640, 301);
		this.RemoveComponents.Margin = new System.Windows.Forms.Padding(4);
		this.RemoveComponents.Name = "RemoveComponents";
		this.RemoveComponents.Size = new System.Drawing.Size(41, 42);
		this.RemoveComponents.TabIndex = 25;
		this.RemoveComponents.Text = ">>";
		this.RemoveComponents.UseVisualStyleBackColor = true;
		this.RemoveComponents.Click += new System.EventHandler(RemoveComponents_Click);
		this.QdartComponentLabel.AutoSize = true;
		this.QdartComponentLabel.Font = new System.Drawing.Font("Arial", 10f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
		this.QdartComponentLabel.Location = new System.Drawing.Point(792, 30);
		this.QdartComponentLabel.Name = "QdartComponentLabel";
		this.QdartComponentLabel.Size = new System.Drawing.Size(115, 19);
		this.QdartComponentLabel.TabIndex = 27;
		this.QdartComponentLabel.Text = "QDART Basic";
		this.ComponentView.ContextMenuStrip = this.ComponentView_contextMenuStrip;
		this.ComponentView.Font = new System.Drawing.Font("Arial", 10f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.ComponentView.Location = new System.Drawing.Point(688, 65);
		this.ComponentView.Name = "ComponentView";
		this.ComponentView.Size = new System.Drawing.Size(293, 374);
		this.ComponentView.TabIndex = 26;
		this.ComponentView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(ComponentView_AfterCheck);
		this.ComponentView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(ComponentView_NodeMouseClick);
		this.ComponentView.DoubleClick += new System.EventHandler(ComponentView_DoubleClick);
		this.label1.AutoSize = true;
		this.label1.Font = new System.Drawing.Font("Arial", 10f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
		this.label1.Location = new System.Drawing.Point(11, 484);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(142, 19);
		this.label1.TabIndex = 28;
		this.label1.Text = "Debug Messages";
		this.label3.AutoSize = true;
		this.label3.Font = new System.Drawing.Font("Arial", 10f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
		this.label3.Location = new System.Drawing.Point(761, 46);
		this.label3.Name = "label3";
		this.label3.Size = new System.Drawing.Size(193, 19);
		this.label3.TabIndex = 29;
		this.label3.Text = "Components && Options";
		base.AutoScaleDimensions = new System.Drawing.SizeF(9f, 19f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.ClientSize = new System.Drawing.Size(994, 711);
		base.Controls.Add(this.label3);
		base.Controls.Add(this.label1);
		base.Controls.Add(this.QdartComponentLabel);
		base.Controls.Add(this.ComponentView);
		base.Controls.Add(this.RemoveComponents);
		base.Controls.Add(this.AddComponents);
		base.Controls.Add(this.Export);
		base.Controls.Add(this.Main_menuStrip);
		base.Controls.Add(this.groupBox2);
		base.Controls.Add(this.MsgBox);
		this.Font = new System.Drawing.Font("Arial", 10f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		base.Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");
		base.MainMenuStrip = this.Main_menuStrip;
		base.Margin = new System.Windows.Forms.Padding(4);
		base.Name = "QFPT";
		this.Text = "QDART File Packager Tool";
		base.Load += new System.EventHandler(QFPT_Load);
		this.MsgBox_contextMenuStrip.ResumeLayout(false);
		this.groupBox2.ResumeLayout(false);
		this.groupBox2.PerformLayout();
		this.StationList_contextMenuStrip.ResumeLayout(false);
		this.StationView_contextMenuStrip.ResumeLayout(false);
		this.ComponentView_contextMenuStrip.ResumeLayout(false);
		this.Main_menuStrip.ResumeLayout(false);
		this.Main_menuStrip.PerformLayout();
		base.ResumeLayout(false);
		base.PerformLayout();
	}
}
