using System;
using System.Text;
using System.Threading;
using System.Windows.Forms;

namespace QDART_MFG_CfgEditor;

internal static class Program
{
	[STAThread]
	private static void Main(string[] args)
	{
		bool createdNew;
		using (new Mutex(initiallyOwned: true, Application.ProductName, out createdNew))
		{
			if (!createdNew)
			{
				Environment.Exit(1);
			}
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(defaultValue: false);
			Form mainForm;
			try
			{
				if (args.Length > 0 && args[0].Equals("/?"))
				{
					StringBuilder stringBuilder = new StringBuilder();
					stringBuilder.AppendLine();
					stringBuilder.AppendLine("QDART_MFG_CfgEditor.exe -n");
					stringBuilder.AppendLine();
					stringBuilder.AppendLine("-n\tSpecify the DUT numbers 'n' used for QMSCT");
					stringBuilder.AppendLine();
					stringBuilder.AppendLine("If  -n  is not sepcified,  tool will run as no args set.");
					stringBuilder.AppendLine();
					MessageBox.Show(stringBuilder.ToString(), "QDART_MFG_CfgEditor Usage");
					return;
				}
				mainForm = new QDART_MFG_CfgEditor(args);
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message, "QDART_MFG_CfgEditor");
				return;
			}
			Application.Run(mainForm);
		}
	}
}
