コード例 #1
0
        public frmMain()
        {
            //Form이 시작한 시간을 설정한다.
            startDate = DateTime.Now;

            InitializeComponent();
            this.WindowState   = FormWindowState.Minimized;
            this.ShowInTaskbar = false;

            pipe          = new NexPipe();
            pipe.ShowTip += Pipe_ShowTip;
            SystemStatus.Instance.StatusChanged += FrmMain_StatusChanged;;
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: iscream6/AdapterMiddleware
        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;
                    }
                }
            }
        }