using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Windows.Forms; namespace CardReaderService { static class Program { public static CardReaderService cardReader ; /// /// 应用程序的主入口点。 /// [STAThread] static void Main() { //第一次运行 则开始监听端口并启动主程序 if(1 == Process.GetProcessesByName("lymsCardReader").Length) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); cardReader = new CardReaderService(); Application.Run(cardReader); } else { Environment.Exit(0); } } } }