示例#1
0
文件: Program.cs 项目: danm36/Bismuth
        static void RunBismuth(string[] args)
        {
            //Load plugins
            if (!BismuthConfig.Setup())
            {
                return;
            }

            BismuthThreadPool.Setup();
            SetupManagersFromLoadedAssemblies();

            ModeFlagBindings.AddBindings("HELP", "Displays this help text", new string[] { "h", "help" });
            RCONServer.AddRCONCommand("version", "Lists the Bismuth version information", (a) => { return(Program.GetFullProgramVersionString()); });
            RCONServer.AddRCONCommand("status", "Lists various statistics about the current Bismuth process", (a) => { return(GetStatus(true)); });
            RCONServer.AddRCONCommand("list-managers", "Lists all currently running managers", (a) => { return(ListManagers(true)); });

            for (int i = 0; i < args.Length; i++)
            {
                if (args[i][0] == '-')
                {
                    if (args[i][1] == '-')
                    {
                        ModeFlagBindings.SetFlag(args[i].Substring(2));
                    }
                    else
                    {
                        for (int j = 1; j < args[i].Length; j++)
                        {
                            ModeFlagBindings.SetFlag(args[i][j]);
                        }
                    }
                }
            }

            if (ModeFlagBindings.IsFlagSet("HELP"))
            {
                ModeFlagBindings.PrintHelp();
                return;
            }

            LogManager.Log("Main Thread", "Beginning primary execution loop");
            while (!ShutDown)
            {
                //TODO: Handle plugin receive handler
                NetworkManager.ListenForNewConnections();
                Thread.Sleep(1);
            }
            LogManager.Log("Main Thread", "Primary execution loop quit");
        }