static void Main(string[] args)
 {
     var bootstrap = BootstrapFactory.CreateBootstrap();
     if (bootstrap.Initialize())
     {
         var result = bootstrap.Start();
         if (result != StartResult.Success)
         {
             Console.WriteLine(DateTime.Now + " 服务启动失败请检查相关日志");
             Console.ReadKey();
         }
         else
         {
             var server = bootstrap.AppServers.First() as DeployServer;
             var shell = new ConsoleShell();
             shell.SetPrefix(server.Name + "> ");
             Assembly.GetExecutingAssembly().GetTypes().Where(i => i.IsClass && !i.IsAbstract
                 && typeof(XShellCommandBase).IsAssignableFrom(i)).ToList().ForEach(i =>
                 {
                     var instance = Activator.CreateInstance(i, server);
                     if (instance != null)
                     {
                         shell.SetupCommand(instance as IShellCommand);
                     }
                 });
             Console.WriteLine("{0} Start Success", server.Name);
             shell.Start();
         }
     }
 }
        static void SetupCommand(ConsoleShell shell, DeployClient client, bool isAdmin)
        {
            Assembly.GetExecutingAssembly().GetTypes().Where(i => i.IsClass && !i.IsAbstract
                && typeof(XShellCommandBase).IsAssignableFrom(i)).ToList().ForEach(i =>
                {
                    bool load = false;
                    var attr = i.GetCustomAttribute<ShellAuthorityAttribute>();
                    if (attr != null)
                    {
                        if (isAdmin)
                        {
                            load = attr.IsAdministrator;
                        }
                    }
                    else
                    {
                        load = true;
                    }

                    if (load)
                    {
                        var instance = Activator.CreateInstance(i, client);
                        if (instance != null)
                        {
                            shell.SetupCommand(instance as IShellCommand);
                        }
                    }
                });
        }