/// <summary> /// 초기화 버튼 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnInit_Click(object sender, EventArgs e) { bool status = pipe.GeneratePipe(); if (status) { btnInit.Enabled = false; btnStartHomeNet.Enabled = true; btnStartNexpa.Enabled = true; lblSttInit.BackColor = Color.Lime; lblSttInit.ForeColor = Color.FromArgb(64, 64, 64); lblSttInit.Text = "성공"; lblSttNexpa.Text = "대기"; lblSttHomeNet.Text = "대기"; btnInit.BackColor = Color.FromArgb(224, 224, 224, 224); } else { btnInit.Enabled = true; btnStartHomeNet.Enabled = false; btnStartNexpa.Enabled = false; lblSttNexpa.Text = "대기"; lblSttHomeNet.Text = "대기"; } }
public static void MainService() { //AdapterFactory adapterFactory = new AdapterFactory(); //var test = adapterFactory.MakeServerAdapter(AdapterFactory.Adapters.HttpServer, "8080"); //test.Run(); //TcpHNClient client = new TcpHNClient(; //cli를 통해...command 와 인자를 line 으로 받는다.... //server, client 가동..... //exit <==== 닫기 //run <=== 실행 //disc <=== 닫기 //conn <== 열기 NexPipe pipe = new NexPipe(); bool bForever = true; while (bForever) { Console.ForegroundColor = ConsoleColor.Cyan; Console.Write("cmd : "); Console.ResetColor(); string readLine = Console.ReadLine(); if (string.IsNullOrEmpty(readLine)) { Console.WriteLine("도움말은 -help 명령어로 확인 가능합니다."); } else { string[] cmd = readLine.Split(" "); switch (cmd[0].Trim().ToLower()) { case "init": pipe.GeneratePipe(); break; case "start": // nexpa or homenet if (cmd.Length > 1) { var type = (AdapterType)Enum.Parse(typeof(AdapterType), cmd[1]); Console.WriteLine(pipe.StartAdapter(type)); } else { Console.WriteLine("Usable command : nexpa or homenet"); } break; case "stop": if (cmd.Length > 1) { var type = (AdapterType)Enum.Parse(typeof(AdapterType), cmd[1]); Console.WriteLine(pipe.StopAdapter(type)); } else { Console.WriteLine("Usable command : nexpa or homenet"); } break; case "help": //도움말 DisplayHelpMessage(); break; case "exit": //종료 bForever = false; break; } } } }