static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); DeviceCommandManager.initialCommandList(); List <CommandMatch> cmdList = CommandMatchHelper.importCommand(); DeviceCommandManager.matchCommand(cmdList); serverForm form = new serverForm(); services.showStateForm = form; //frmProtocolTest form = new frmProtocolTest(); Application.Run(form); }
public static bool updateCommand(List <CommandMatch> list, CommandMatch cmd) { //首先要保证协议内同一个命令不能两次出现 bool b = list.Exists((_cmd) => { return(cmd.cmd == _cmd.cmd); }); if (!b) { CommandMatch temp = list.Find((_cmd) => { return(cmd.name == _cmd.name); }); if (temp != null) { temp.cmd = cmd.cmd; DeviceCommandManager.matchCommand(cmd); return(true); } } return(false); }