Ejemplo n.º 1
0
        public void LoopCommand()
        {
            Console.WriteLine("查看命令帮助 help ");
            Console.Write("WCF>");
            bool flag = true;

            while (flag)
            {
                string[] strArray = Console.ReadLine().Split(' ');
                switch (strArray[0])
                {
                case "exit":
                    this.wcfmanage.StopAllService();
                    flag = false;
                    break;

                case "help":
                    CommandHelp.showhelp();
                    break;

                case "la":
                    this.ShowAllAss();
                    break;

                case "lapp":
                    this.ListAssService();
                    break;

                case "los":
                    this.ListOpenService();
                    break;

                case "startall":
                    this.wcfmanage.StartAllService();
                    break;

                case "stopall":
                    this.wcfmanage.StopAllService();
                    break;

                case "restart":
                    this.wcfmanage.StopAllService();
                    this.wcfmanage.RefreshApp();
                    this.wcfmanage.StartAllService();
                    break;

                case "rapp":
                    this.wcfmanage.RefreshApp();
                    break;

                case "start":
                    if (strArray.Length == 2)
                    {
                        this.wcfmanage.StartService(strArray[1]);
                        break;
                    }
                    CommandColor.SetRed();
                    Console.WriteLine("必须有参数 ,服务的名称!傻瓜^_^");
                    CommandColor.SetWhite();
                    break;

                case "stop":
                    if (strArray.Length == 2)
                    {
                        this.wcfmanage.StopService(strArray[1]);
                        break;
                    }
                    CommandColor.SetRed();
                    Console.WriteLine("必须有参数 ,服务的名称!傻瓜^_^");
                    CommandColor.SetWhite();
                    break;

                case "cacheinfo":
                    Console.WriteLine("当前缓存个数为" + Service.GetCacheHelp().GetCurrentCount().ToString());
                    break;

                default:
                    Console.WriteLine("命令打错了,笨蛋!^_^");
                    break;
                }
                Console.Write("\n");
                Console.Write("WCF>");
            }
        }