Ejemplo n.º 1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            ui = new UserInterface(GraphicsDevice);

            Player = new InputActor(1, new MouseDevice(), new KeyboardDevice(PlayerIndex.One, Window.Handle));
            //Kernel.Bind<InputActor>().ToConstant(player);
            Components.Add(Player);
            ui.Actors.Add(Player);

            var statLog = new StatisticTextLog(ui.Root, Content.Load <SpriteFont>("Consolas"), true);

            statLog.SetPoint(Points.TopLeft, 10, 10);

            frameTime = Statistic.Get("Misc.Time", "{0:00.00}ms");
            fps       = new FrequencyTracker("Misc.FPS");

            var console = new CommandConsole(this, Content.Load <SpriteFont>("Consolas"), ui.Root);

            Kernel.Bind <CommandConsole>().ToConstant(console);

            screens = new ScreenManager();
            screens.Push(Kernel.Get <MainMenu>());

            base.Initialize();
        }
Ejemplo n.º 2
0
        private void RegisterConsoleCommands(CommandConsole console)
        {
            m_console = console;
            m_console.Commands.AddCommand("userserver", false, "create user",
                                          "create user [<first> [<last> [<x> <y> [email]]]]",
                                          "Create a new user account", RunCommand);

            m_console.Commands.AddCommand("userserver", false, "reset user password",
                                          "reset user password [<first> [<last> [<new password>]]]",
                                          "Reset a user's password", RunCommand);

            m_console.Commands.AddCommand("userserver", false, "login level",
                                          "login level <level>",
                                          "Set the minimum user level to log in", HandleLoginCommand);

            m_console.Commands.AddCommand("userserver", false, "login reset",
                                          "login reset",
                                          "Reset the login level to allow all users",
                                          HandleLoginCommand);

            m_console.Commands.AddCommand("userserver", false, "login text",
                                          "login text <text>",
                                          "Set the text users will see on login", HandleLoginCommand);

            m_console.Commands.AddCommand("userserver", false, "test-inventory",
                                          "test-inventory",
                                          "Perform a test inventory transaction", RunCommand);

            m_console.Commands.AddCommand("userserver", false, "logoff-user",
                                          "logoff-user <first> <last> <message>",
                                          "Log off a named user", RunCommand);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Executes a script passed to the application,
 /// parsing the commands listed in a valid text file
 /// that has the extension '.mds'
 /// </summary>
 /// <param name="param"></param>
 public override void Execute(string param)
 {
     try
     {
         if (param != "" && param != null && param.Length < 5 && param.EndsWith(".mds"))
         {
             if (File.Exists(Paths.CurrentDirectory + Paths.Separator + param))
             {
                 string[] lines = File.ReadAllLines(param);
                 foreach (string line in lines)
                 {
                     CommandConsole.Parse(line);
                     //Console.WriteLine("");
                 }
             }
             else
             {
             }
             {
                 CommandConsole.InvalidCommand(param, 2);
             }
         }
         else
         {
             Console.WriteLine("Not a valid Medliscript file.");
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
    static void CreateCommandConsole(MenuCommand menuCommand)
    {
        //Check if the console has already been created
        CommandConsole existingConsole = Object.FindObjectOfType <CommandConsole>();

        if (existingConsole != null)
        {
            Debug.LogWarning("Command console has already been created.");
            Selection.activeObject = existingConsole;
            return;
        }

        //Use the asset database to fetch the console prefab
        GameObject consolePrefab = AssetDatabase.LoadAssetAtPath <GameObject>(
            "Packages/com.jasonskillman.commandconsole/Runtime/Prefabs/CommandConsole.prefab");

        //Instantiate the prefab in the hierarchy
        PrefabUtility.InstantiatePrefab(consolePrefab);

        Selection.activeObject = consolePrefab;


        //Instantiate an EventSystem if one does not exist
        GameObject eventSystem = GameObject.Find("EventSystem");

        if (eventSystem != null)
        {
            return;
        }

        eventSystem = new GameObject("EventSystem");
        eventSystem.AddComponent <EventSystem>();
        eventSystem.AddComponent <StandaloneInputModule>();
    }
Ejemplo n.º 5
0
        private Task Client_Ready()
        {
            Logger.Log("Ready!", LogType.Info);

            commandConsole = new CommandConsole();

            return(Task.CompletedTask);
        }
Ejemplo n.º 6
0
 private static void Main()
 {
     using (ActorContext.Global)
     {
         Console.WriteLine("Welcome to the Encore ReverserTool. Type '?' for help.");
         CommandConsole.Run();
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Performs initialisation of the scene, such as loading configuration from disk.
        /// </summary>
        protected override void StartupSpecific()
        {
            m_log.Info("====================================================================");
            m_log.Info("========================= STARTING OPENSIM =========================");
            m_log.Info("====================================================================");
            m_log.InfoFormat("[OPENSIM MAIN]: Running in {0} mode",
                             (ConfigurationSettings.Standalone ? "sandbox" : "grid"));
            //m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString());
            // http://msdn.microsoft.com/en-us/library/bb384202.aspx
            //GCSettings.LatencyMode = GCLatencyMode.Batch;
            //m_log.InfoFormat("[OPENSIM MAIN]: GC Latency Mode: {0}", GCSettings.LatencyMode.ToString());

            if (m_gui) // Driven by external GUI
            {
                m_console = new CommandConsole("Region");
            }
            else
            {
                m_console = new LocalConsole("Region");
            }
            MainConsole.Instance = m_console;

            RegisterConsoleCommands();

            base.StartupSpecific();

            //Run Startup Commands
            if (String.IsNullOrEmpty(m_startupCommandsFile))
            {
                m_log.Info("[STARTUP]: No startup command script specified. Moving on...");
            }
            else
            {
                RunCommandScript(m_startupCommandsFile);
            }

            // Start timer script (run a script every xx seconds)
            if (m_timedScript != "disabled")
            {
                m_scriptTimer          = new Timer();
                m_scriptTimer.Enabled  = true;
                m_scriptTimer.Interval = 1200 * 1000;
                m_scriptTimer.Elapsed += RunAutoTimerScript;
            }

            PrintFileToConsole("startuplogo.txt");

            // For now, start at the 'root' level by default
            if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it
            {
                ChangeSelectedRegion("region",
                                     new string[] { "change", "region", m_sceneManager.Scenes[0].RegionInfo.RegionName });
            }
            else
            {
                ChangeSelectedRegion("region", new string[] { "change", "region", "root" });
            }
        }
Ejemplo n.º 8
0
 private static void Main(string[] args)
 {
     using (ActorContext.Global)
     {
         AuthenticationApplication.Instance.Start(args);
         CommandConsole.Run();
         AuthenticationApplication.Instance.Stop();
     }
 }
Ejemplo n.º 9
0
        public void Initialise(GridServerBase gridServer)
        {
            m_core    = gridServer;
            m_config  = gridServer.Config;
            m_version = gridServer.Version;
            m_console = MainConsole.Instance;

            AddConsoleCommands();

            SetupGridServices();
        }
Ejemplo n.º 10
0
 public void  SetCommand(CommandConsole console, string[] args)
 {
     if (args.Length == 1)
     {
         Value = args[0];
     }
     else
     {
         console.Print("=" + Value);
     }
 }
Ejemplo n.º 11
0
        public void Initialise(GridServerBase gridServer)
        {
            m_core = gridServer;
            m_config = gridServer.Config;
            m_version = gridServer.Version;
            m_console = MainConsole.Instance;

            AddConsoleCommands();

            SetupGridServices();
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Constructor Creates MainConsole.Instance to take commands and provide the place to write data
        /// </summary>
        public BotManager()
        {
            LoginDelay = DefaultLoginDelay;

            Rng            = new Random(Environment.TickCount);
            AssetsReceived = new Dictionary <UUID, bool>();
            RegionsKnown   = new Dictionary <ulong, GridRegion>();

            m_console            = CreateConsole();
            MainConsole.Instance = m_console;

            // Make log4net see the console
            //
            ILoggerRepository repository = LogManager.GetRepository();

            IAppender[]     appenders       = repository.GetAppenders();
            OpenSimAppender consoleAppender = null;

            foreach (IAppender appender in appenders)
            {
                if (appender.Name == "Console")
                {
                    consoleAppender         = (OpenSimAppender)appender;
                    consoleAppender.Console = m_console;
                    break;
                }
            }

            m_console.Commands.AddCommand("bot", false, "shutdown",
                                          "shutdown",
                                          "Shutdown bots and exit", HandleShutdown);

            m_console.Commands.AddCommand("bot", false, "quit",
                                          "quit",
                                          "Shutdown bots and exit",
                                          HandleShutdown);

            m_console.Commands.AddCommand("bot", false, "show regions",
                                          "show regions",
                                          "Show regions known to bots",
                                          HandleShowRegions);

            m_console.Commands.AddCommand("bot", false, "show bots",
                                          "show bots",
                                          "Shows the status of all bots",
                                          HandleShowStatus);

//            m_console.Commands.AddCommand("bot", false, "add bots",
//                    "add bots <number>",
//                    "Add more bots", HandleAddBots);

            m_lBot = new List <Bot>();
        }
Ejemplo n.º 13
0
        /// <summary>
        ///     Performs initialisation of the scene, such as loading configuration from disk.
        /// </summary>
        protected override void StartupSpecific()
        {
            m_log.Info("====================================================================");
            m_log.Info("====================== STARTING OpenSimulator ======================");
            m_log.Info("====================================================================");
            m_log.InfoFormat("[OpenSim Main]: Running in {0} mode", (ConfigurationSettings.Standalone ? "sandbox" : "grid"));

            if (m_gui) // Driven by external GUI
            {
                m_console = new CommandConsole("Region");
            }
            else
            {
                m_console = new LocalConsole("Region");
            }

            MainConsole.Instance = m_console;

            RegisterConsoleCommands();

            base.StartupSpecific();

            //Run Startup Commands
            if (String.IsNullOrEmpty(m_startupCommandsFile))
            {
                m_log.Info("[Startup]: No startup command script specified. Moving on...");
            }
            else
            {
                RunCommandScript(m_startupCommandsFile);
            }

            // Start timer script (run a script every xx seconds)
            if (m_timedScript != "disabled")
            {
                m_scriptTimer          = new Timer();
                m_scriptTimer.Enabled  = true;
                m_scriptTimer.Interval = 1200 * 1000;
                m_scriptTimer.Elapsed += RunAutoTimerScript;
            }

            PrintFileToConsole("startuplogo.txt");

            // For now, start at the 'root' level by default
            if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it
            {
                ChangeSelectedRegion("region", new string[] { "change", "region", m_sceneManager.Scenes[0].RegionInfo.RegionName });
            }
            else
            {
                ChangeSelectedRegion("region", new string[] { "change", "region", "root" });
            }
        }
Ejemplo n.º 14
0
 private void DestroySingletons()
 {
     TNT.DestroySingleton();
     GameTimer.DestroySingleton();
     Keypad.DestroySingleton();
     KeypadPuzzle.DestroySingleton();
     GameTimer.DestroySingleton();
     Hints.DestroySingleton();
     TextManager.DestroySingleton();
     CommandConsole.DestroySingleton();
     ThoughtsManager.DestroySingleton();
 }
Ejemplo n.º 15
0
        public Form1()
        {
            InitializeComponent();

            cli     = new CommandConsole();
            monitor = new FileMonitor(file);
            server  = new CLIServer(cli, monitor);
            iServer = new IterativerServer(monitor);

            server.listen();

            Console.WriteLine(monitor.dump());
        }
Ejemplo n.º 16
0
        static void Main()
        {
            CommandConsole control   = new CommandConsole();
            Enemy          enemy     = new Enemy();
            ICommand       moveEnemy = new MoveCommand(enemy, 100, 100);
            ICommand       killEnemy = new KillCommand(enemy);

            // switch on
            control.SetCommand(moveEnemy);
            control.PressButton();

            // switch off
            control.SetCommand(killEnemy);
            control.PressButton();
        }
Ejemplo n.º 17
0
        public MainMenu(TestGame game, CommandConsole console, GraphicsDevice device, ContentManager content, IServiceProvider services)
        {
            this.game   = game;
            this.player = game.Player;

            ui = new UserInterface(device);
            ui.Actors.Add(player);

            var tests = from type in Assembly.GetExecutingAssembly().GetTypes()
                        where typeof(TestScreen).IsAssignableFrom(type)
                        where !type.IsAbstract
                        select type;

            this.menu = new Menu(ui.Root);
            menu.SetPoint(Points.BottomLeft, 50, -50);


            int index = 0;

            foreach (var test in tests)
            {
                index++;

                var testKernel = new StandardKernel();
                testKernel.Bind <GraphicsDevice>().ToConstant(device);
                testKernel.Bind <ContentManager>().ToConstant(new ContentManager(services));
                testKernel.Bind <Game>().ToConstant(game);
                testKernel.Bind <TestGame>().ToConstant(game);
                testKernel.Bind <CommandConsole>().ToConstant(console);
                testKernel.Bind <IServiceProvider>().ToConstant(game.Services);
                //testKernel.Bind<InputActor>().ToConstant(player);

                var instance = testKernel.Get(test) as TestScreen;

                var menuOption = new TextButton(menu, content.Load <SpriteFont>("Consolas"), instance.Name);
                menuOption.Highlight = Color.Red;
                menuOption.Gestures.Bind((gesture, time, input) => Manager.Push(instance), new MouseReleased(MouseButtons.Left), new KeyReleased(Keys.Enter));
            }

            var quit = new TextButton(menu, content.Load <SpriteFont>("Consolas"), "Exit");

            quit.Highlight = Color.Red;
            quit.Gestures.Bind((gesture, time, input) => game.Exit(), new MouseReleased(MouseButtons.Left), new KeyReleased(Keys.Enter));

            menu.Arrange(Justification.Left);
        }
Ejemplo n.º 18
0
        static void Main(string[] args)
        {
            //AOP容器对象
            AOPContainer container = new AOPContainer();
            //socket对象
            RRPCSetupEntrance superMain = new RRPCSetupEntrance((unity) => {
            }, (unity) => {
            }, (unitytoo) => {
                unitytoo.AddForwardingRequestNamespace("ITestServer", (x) => x.FirstOrDefault());
            });

            while ("q" != Console.ReadLine())
            {
                CommandConsole command = new CommandConsole(container);
                command.MonitorCommand();
            }
        }
        private void RegisterConsoleCommands(CommandConsole console)
        {
            m_console = console;
            m_console.Commands.AddCommand("userserver", false, "create user",
                                          "create user [<first> [<last> [<pass> [<x> <y> [<email>]]]]]",
                                          "Create a new user account", RunCommand);

            m_console.Commands.AddCommand("userserver", false, "reset user password",
                                          "reset user password [<first> [<last> [<new password>]]]",
                                          "Reset a user's password", RunCommand);

            m_console.Commands.AddCommand("userserver", false, "login level",
                                          "login level <level>",
                                          "Set the minimum user level to log in", HandleLoginCommand);

            m_console.Commands.AddCommand("userserver", false, "login reset",
                                          "login reset",
                                          "Reset the login level to allow all users",
                                          HandleLoginCommand);

            m_console.Commands.AddCommand("userserver", false, "login text",
                                          "login text <text>",
                                          "Set the text users will see on login", HandleLoginCommand);

            m_console.Commands.AddCommand("userserver", false, "test-inventory",
                                          "test-inventory",
                                          "Perform a test inventory transaction", RunCommand);

            m_console.Commands.AddCommand("userserver", false, "logoff-user",
                                          "logoff-user <first> <last> <message>",
                                          "Log off a named user", RunCommand);

            m_console.Commands.AddCommand("default", false, "default regions",
                                          "default regions [<filename>]",
                                          "Show or set the default region locations via a file of locations", HandleDefault);
            m_console.Commands.AddCommand("default", false, "default logins",
                                          "default logins [<filename>]",
                                          "Show or set the initial region locations for new users via a file of locations", HandleDefault);

            m_console.Commands.AddCommand("base", false, "trust reload",
                                          "trust reload",
                                          "Reloads the trust configuration for the trust manager", HandleTrustReload);
        }
Ejemplo n.º 20
0
        public MainMenu(TestGame game, CommandConsole console, GraphicsDevice device, ContentManager content, IServiceProvider services)
        {
            this.game = game;
            this.player = game.Player;

            ui = new UserInterface(device);
            ui.Actors.Add(player);

            var tests = from type in Assembly.GetExecutingAssembly().GetTypes()
                        where typeof(TestScreen).IsAssignableFrom(type)
                        where !type.IsAbstract
                        select type;

            this.menu = new Menu(ui.Root);
            menu.SetPoint(Points.BottomLeft, 50, -50);

            int index = 0;
            foreach (var test in tests)
            {
                index++;

                var testKernel = new StandardKernel();
                testKernel.Bind<GraphicsDevice>().ToConstant(device);
                testKernel.Bind<ContentManager>().ToConstant(new ContentManager(services));
                testKernel.Bind<Game>().ToConstant(game);
                testKernel.Bind<TestGame>().ToConstant(game);
                testKernel.Bind<CommandConsole>().ToConstant(console);
                testKernel.Bind<IServiceProvider>().ToConstant(game.Services);
                //testKernel.Bind<InputActor>().ToConstant(player);

                var instance = testKernel.Get(test) as TestScreen;

                var menuOption = new TextButton(menu, content.Load<SpriteFont>("Consolas"), instance.Name);
                menuOption.Highlight = Color.Red;
                menuOption.Gestures.Bind((gesture, time, input) => Manager.Push(instance), new MouseReleased(MouseButtons.Left), new KeyReleased(Keys.Enter));
            }

            var quit = new TextButton(menu, content.Load<SpriteFont>("Consolas"), "Exit");
            quit.Highlight = Color.Red;
            quit.Gestures.Bind((gesture, time, input) => game.Exit(), new MouseReleased(MouseButtons.Left), new KeyReleased(Keys.Enter));

            menu.Arrange(Justification.Left);
        }
Ejemplo n.º 21
0
 /// <summary>
 /// Executes the application.
 /// </summary>
 /// <param name="file">The file.</param>
 private static void ExecuteApp(string file)
 {
     string[] readlines = File.ReadAllLines(file);
     AppTitle  = readlines[0].Substring(6);
     AppDesc   = readlines[1].Substring(5);
     AppAuthor = readlines[2].Substring(7);
     ClearDraw();
     foreach (string line in readlines)
     {
         if (line.StartsWith("Title="))
         {
             AppTitle = line.Remove(0, 6);
         }
         else if (line.StartsWith("Desc="))
         {
             AppDesc = line.Remove(0, 5);
         }
         else if (line.StartsWith("Author="))
         {
             AppAuthor = line.Remove(0, 7);
         }
         else if (line == "clear")
         {
             ClearDraw();
         }
         else if (line == "EOF")
         {
         }
         else
         {
             if (Console.CursorTop == 23)
             {
                 ClearDraw();
             }
             CommandConsole.Parse(line);
         }
     }
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Executes the specified parameter.
 /// </summary>
 /// <param name="param">The parameter.</param>
 public override void Execute(string param)
 {
     try
     {
         if (param.EndsWith(".mds"))
         {
             string[] lines = File.ReadAllLines(param);
             foreach (string line in lines)
             {
                 CommandConsole.Parse(line);
             }
             Console.WriteLine("");
         }
         else
         {
             Console.WriteLine("Not a valid Medli Shellscript file.");
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Constructor Creates MainConsole.Instance to take commands and provide the place to write data
        /// </summary>
        public BotManager()
        {
            m_console            = CreateConsole();
            MainConsole.Instance = m_console;

            // Make log4net see the console
            //
            ILoggerRepository repository = LogManager.GetRepository();

            IAppender[]     appenders       = repository.GetAppenders();
            OpenSimAppender consoleAppender = null;

            foreach (IAppender appender in appenders)
            {
                if (appender.Name == "Console")
                {
                    consoleAppender         = (OpenSimAppender)appender;
                    consoleAppender.Console = m_console;
                    break;
                }
            }

            m_console.Commands.AddCommand("bot", false, "shutdown",
                                          "shutdown",
                                          "Gracefully shut down bots", HandleShutdown);

            m_console.Commands.AddCommand("bot", false, "quit",
                                          "quit",
                                          "Force quit (DANGEROUS, try shutdown first)",
                                          HandleShutdown);

            m_console.Commands.AddCommand("bot", false, "add bots",
                                          "add bots <number>",
                                          "Add more bots", HandleAddBots);

            m_lBot = new List <PhysicsBot>();
        }
Ejemplo n.º 24
0
 public static void ViewFile(string file)
 {
     DrawScreen();
     try
     {
         if (File.Exists(Paths.CurrentDirectory + @"\" + file))
         {
             string[] lines = File.ReadAllLines(Paths.CurrentDirectory + @"\" + file);
             foreach (string line in lines)
             {
                 Console.WriteLine(line);
             }
         }
         else if (!File.Exists(Paths.CurrentDirectory + @"\" + file))
         {
             CommandConsole.InvalidCommand(file, 2);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     Extensions.PressAnyKey();
 }
Ejemplo n.º 25
0
        public static void members(Type t, string search = null)
        {
            HashSet <string> autocompleteWords = new HashSet <string>();

            CommandConsole.TypeEnumerate(ref autocompleteWords, new Type[] { t });

            if (search == null)
            {
                foreach (string s in autocompleteWords)
                {
                    Debug.Log(s);
                }
            }
            else
            {
                foreach (string s in autocompleteWords)
                {
                    if (s.ToLower().StartsWith(search.ToLower()))
                    {
                        Debug.Log(s);
                    }
                }
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Constructor Creates MainConsole.Instance to take commands and provide the place to write data
        /// </summary>
        public BotManager()
        {
            m_console = CreateConsole();
            MainConsole.Instance = m_console;

            // Make log4net see the console
            //
            ILoggerRepository repository = LogManager.GetRepository();
            IAppender[] appenders = repository.GetAppenders();
            OpenSimAppender consoleAppender = null;

            foreach (IAppender appender in appenders)
            {
                if (appender.Name == "Console")
                {
                    consoleAppender = (OpenSimAppender)appender;
                    consoleAppender.Console = m_console;
                    break;
                }
            }

            m_console.Commands.AddCommand("bot", false, "shutdown",
                    "shutdown",
                    "Gracefully shut down bots", HandleShutdown);

            m_console.Commands.AddCommand("bot", false, "quit",
                    "quit",
                    "Force quit (DANGEROUS, try shutdown first)",
                    HandleShutdown);

            m_console.Commands.AddCommand("bot", false, "add bots",
                    "add bots <number>",
                    "Add more bots", HandleAddBots);

            m_lBot = new List<PhysicsBot>();
        }
Ejemplo n.º 27
0
    ////////////////////////////////////////////////////////////////////////////////////////////////
    #region Init
    private void Awake()
    {
#if UNITY_EDITOR
        isInEditor = true;
#else
        isInEditor = false;
#endif

        if (commandConsole != null)
        {
            Destroy(this.gameObject);
        }
        else
        {
            commandConsole = this;
            DontDestroyOnLoad(this.gameObject);
        }

        log = GetComponent <ConsoleLog>();
#if UNITY_EDITOR
        levelEditor = GetComponent <ConsoleLevelEditor>();
#endif
        playerRef = FindObjectOfType <PlayerBase>();
    }
Ejemplo n.º 28
0
        /// <summary>
        /// Constructor Creates MainConsole.Instance to take commands and provide the place to write data
        /// </summary>
        public BotManager()
        {
            // We set this to avoid issues with bots running out of HTTP connections if many are run from a single machine
            // to multiple regions.
            Settings.MAX_HTTP_CONNECTIONS = int.MaxValue;

//            System.Threading.ThreadPool.SetMaxThreads(600, 240);
//
//            int workerThreads, iocpThreads;
//            System.Threading.ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads);
//            Console.WriteLine("ThreadPool.GetMaxThreads {0} {1}", workerThreads, iocpThreads);

            InitBotSendAgentUpdates      = true;
            InitBotRequestObjectTextures = true;

            LoginDelay = DefaultLoginDelay;

            Rng            = new Random(Environment.TickCount);
            AssetsReceived = new Dictionary <UUID, bool>();
            RegionsKnown   = new Dictionary <ulong, GridRegion>();

            m_console            = CreateConsole();
            MainConsole.Instance = m_console;

            // Make log4net see the console
            //
            ILoggerRepository repository = LogManager.GetRepository();

            IAppender[]     appenders       = repository.GetAppenders();
            OpenSimAppender consoleAppender = null;

            foreach (IAppender appender in appenders)
            {
                if (appender.Name == "Console")
                {
                    consoleAppender         = (OpenSimAppender)appender;
                    consoleAppender.Console = m_console;
                    break;
                }
            }

            m_console.Commands.AddCommand(
                "Bots", false, "shutdown", "shutdown", "Shutdown bots and exit", HandleShutdown);

            m_console.Commands.AddCommand(
                "Bots", false, "quit", "quit", "Shutdown bots and exit", HandleShutdown);

            m_console.Commands.AddCommand(
                "Bots", false, "connect", "connect [<n>]", "Connect bots",
                "If an <n> is given, then the first <n> disconnected bots by postfix number are connected.\n"
                + "If no <n> is given, then all currently disconnected bots are connected.",
                HandleConnect);

            m_console.Commands.AddCommand(
                "Bots", false, "disconnect", "disconnect [<n>]", "Disconnect bots",
                "Disconnecting bots will interupt any bot connection process, including connection on startup.\n"
                + "If an <n> is given, then the last <n> connected bots by postfix number are disconnected.\n"
                + "If no <n> is given, then all currently connected bots are disconnected.",
                HandleDisconnect);

            m_console.Commands.AddCommand(
                "Bots", false, "add behaviour", "add behaviour <abbreviated-name> [<bot-number>]",
                "Add a behaviour to a bot",
                "If no bot number is specified then behaviour is added to all bots.\n"
                + "Can be performed on connected or disconnected bots.",
                HandleAddBehaviour);

            m_console.Commands.AddCommand(
                "Bots", false, "remove behaviour", "remove behaviour <abbreviated-name> [<bot-number>]",
                "Remove a behaviour from a bot",
                "If no bot number is specified then behaviour is added to all bots.\n"
                + "Can be performed on connected or disconnected bots.",
                HandleRemoveBehaviour);

            m_console.Commands.AddCommand(
                "Bots", false, "sit", "sit", "Sit all bots on the ground.",
                HandleSit);

            m_console.Commands.AddCommand(
                "Bots", false, "stand", "stand", "Stand all bots.",
                HandleStand);

            m_console.Commands.AddCommand(
                "Bots", false, "set bots", "set bots <key> <value>", "Set a setting for all bots.", HandleSetBots);

            m_console.Commands.AddCommand(
                "Bots", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions);

            m_console.Commands.AddCommand(
                "Bots", false, "show bots", "show bots", "Shows the status of all bots.", HandleShowBotsStatus);

            m_console.Commands.AddCommand(
                "Bots", false, "show bot", "show bot <bot-number>",
                "Shows the detailed status and settings of a particular bot.", HandleShowBotStatus);

            m_console.Commands.AddCommand(
                "Debug",
                false,
                "debug lludp packet",
                "debug lludp packet <level> <avatar-first-name> <avatar-last-name>",
                "Turn on received packet logging.",
                "If level >  0 then all received packets that are not duplicates are logged.\n"
                + "If level <= 0 then no received packets are logged.",
                HandleDebugLludpPacketCommand);

            m_console.Commands.AddCommand(
                "Bots", false, "show status", "show status", "Shows pCampbot status.", HandleShowStatus);

            m_bots = new List <Bot>();

            Watchdog.Enabled = true;
            StatsManager.RegisterConsoleCommands(m_console);

            m_serverStatsCollector = new ServerStatsCollector();
            m_serverStatsCollector.Initialise(null);
            m_serverStatsCollector.Enabled = true;
            m_serverStatsCollector.Start();

            BotConnectingState = BotManagerBotConnectingState.Ready;
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Performs initialisation of the scene, such as loading configuration from disk.
        /// </summary>
        protected override void StartupSpecific()
        {
            m_log.Info("====================================================================");
            m_log.Info("========================= STARTING OPENSIM =========================");
            m_log.Info("====================================================================");
            m_log.InfoFormat("[OPENSIM MAIN]: Running ");
            //m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString());
            // http://msdn.microsoft.com/en-us/library/bb384202.aspx
            //GCSettings.LatencyMode = GCLatencyMode.Batch;
            //m_log.InfoFormat("[OPENSIM MAIN]: GC Latency Mode: {0}", GCSettings.LatencyMode.ToString());

            if (m_gui) // Driven by external GUI
                m_console = new CommandConsole("Region");
            else
            {
                switch (m_consoleType)
                {
                case "basic":
                    m_console = new CommandConsole("Region");
                    break;
                case "rest":
                    m_console = new RemoteConsole("Region");
                    ((RemoteConsole)m_console).ReadConfig(m_config.Source);
                    break;
                default:
                    m_console = new LocalConsole("Region");
                    break;
                }
            }

            MainConsole.Instance = m_console;

            RegisterConsoleCommands();

            base.StartupSpecific();

            MainServer.Instance.AddStreamHandler(new OpenSim.SimStatusHandler());
            MainServer.Instance.AddStreamHandler(new OpenSim.XSimStatusHandler(this));
            if (userStatsURI != String.Empty)
                MainServer.Instance.AddStreamHandler(new OpenSim.UXSimStatusHandler(this));

            if (m_console is RemoteConsole)
            {
                if (m_consolePort == 0)
                {
                    ((RemoteConsole)m_console).SetServer(m_httpServer);
                }
                else
                {
                    ((RemoteConsole)m_console).SetServer(MainServer.GetHttpServer(m_consolePort));
                }
            }

            //Run Startup Commands
            if (String.IsNullOrEmpty(m_startupCommandsFile))
            {
                m_log.Info("[STARTUP]: No startup command script specified. Moving on...");
            }
            else
            {
                RunCommandScript(m_startupCommandsFile);
            }

            // Start timer script (run a script every xx seconds)
            if (m_timedScript != "disabled")
            {
                m_scriptTimer = new Timer();
                m_scriptTimer.Enabled = true;
                m_scriptTimer.Interval = 1200*1000;
                m_scriptTimer.Elapsed += RunAutoTimerScript;
            }

            // Hook up to the watchdog timer
            Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler;

            PrintFileToConsole("startuplogo.txt");

            // For now, start at the 'root' level by default
            if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it
                ChangeSelectedRegion("region",
                                     new string[] {"change", "region", m_sceneManager.Scenes[0].RegionInfo.RegionName});
            else
                ChangeSelectedRegion("region", new string[] {"change", "region", "root"});
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Performs initialisation of the scene, such as loading configuration from disk.
        /// </summary>
        protected override void StartupSpecific()
        {
            m_log.Info("====================================================================");
            m_log.Info("========================= STARTING OPENSIM =========================");
            m_log.Info("====================================================================");

            //m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString());
            // http://msdn.microsoft.com/en-us/library/bb384202.aspx
            //GCSettings.LatencyMode = GCLatencyMode.Batch;
            //m_log.InfoFormat("[OPENSIM MAIN]: GC Latency Mode: {0}", GCSettings.LatencyMode.ToString());

            if (m_gui) // Driven by external GUI
            {
                m_console = new CommandConsole("Region");
            }
            else
            {
                switch (m_consoleType)
                {
                case "basic":
                    m_console = new CommandConsole("Region");
                    break;

                case "rest":
                    m_console = new RemoteConsole("Region");
                    ((RemoteConsole)m_console).ReadConfig(Config);
                    break;

                default:
                    m_console = new LocalConsole("Region");
                    break;
                }
            }

            MainConsole.Instance = m_console;

            RegisterCommonAppenders(Config.Configs["Startup"]);
            RegisterConsoleCommands();

            base.StartupSpecific();

            MainServer.Instance.AddStreamHandler(new OpenSim.SimStatusHandler());
            MainServer.Instance.AddStreamHandler(new OpenSim.XSimStatusHandler(this));
            if (userStatsURI != String.Empty)
            {
                MainServer.Instance.AddStreamHandler(new OpenSim.UXSimStatusHandler(this));
            }

            if (m_console is RemoteConsole)
            {
                if (m_consolePort == 0)
                {
                    ((RemoteConsole)m_console).SetServer(m_httpServer);
                }
                else
                {
                    ((RemoteConsole)m_console).SetServer(MainServer.GetHttpServer(m_consolePort));
                }
            }

            // Hook up to the watchdog timer
            Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler;

            PrintFileToConsole("startuplogo.txt");

            // For now, start at the 'root' level by default
            if (SceneManager.Scenes.Count == 1) // If there is only one region, select it
            {
                ChangeSelectedRegion("region",
                                     new string[] { "change", "region", SceneManager.Scenes[0].RegionInfo.RegionName });
            }
            else
            {
                ChangeSelectedRegion("region", new string[] { "change", "region", "root" });
            }

            //Run Startup Commands
            if (String.IsNullOrEmpty(m_startupCommandsFile))
            {
                m_log.Info("[STARTUP]: No startup command script specified. Moving on...");
            }
            else
            {
                RunCommandScript(m_startupCommandsFile);
            }

            // Start timer script (run a script every xx seconds)
            if (m_timedScript != "disabled")
            {
                m_scriptTimer          = new Timer();
                m_scriptTimer.Enabled  = true;
                m_scriptTimer.Interval = m_timeInterval * 1000;
                m_scriptTimer.Elapsed += RunAutoTimerScript;
            }
        }
Ejemplo n.º 31
0
        /// <summary>
        /// Constructor Creates MainConsole.Instance to take commands and provide the place to write data
        /// </summary>
        public BotManager()
        {
            InitBotSendAgentUpdates = true;
            InitBotRequestObjectTextures = true;

            LoginDelay = DefaultLoginDelay;

            Rng = new Random(Environment.TickCount);
            AssetsReceived = new Dictionary<UUID, bool>();
            RegionsKnown = new Dictionary<ulong, GridRegion>();

            m_console = CreateConsole();
            MainConsole.Instance = m_console;

            // Make log4net see the console
            //
            ILoggerRepository repository = LogManager.GetRepository();
            IAppender[] appenders = repository.GetAppenders();
            OpenSimAppender consoleAppender = null;

            foreach (IAppender appender in appenders)
            {
                if (appender.Name == "Console")
                {
                    consoleAppender = (OpenSimAppender)appender;
                    consoleAppender.Console = m_console;
                    break;
                }
            }

            m_console.Commands.AddCommand(
                "bot", false, "shutdown", "shutdown", "Shutdown bots and exit", HandleShutdown);

            m_console.Commands.AddCommand(
                "bot", false, "quit", "quit", "Shutdown bots and exit", HandleShutdown);

            m_console.Commands.AddCommand(
                "bot", false, "connect", "connect [<n>]", "Connect bots",
                "If an <n> is given, then the first <n> disconnected bots by postfix number are connected.\n"
                    + "If no <n> is given, then all currently disconnected bots are connected.",
                HandleConnect);

            m_console.Commands.AddCommand(
                "bot", false, "disconnect", "disconnect [<n>]", "Disconnect bots",
                "Disconnecting bots will interupt any bot connection process, including connection on startup.\n"
                    + "If an <n> is given, then the last <n> connected bots by postfix number are disconnected.\n"
                    + "If no <n> is given, then all currently connected bots are disconnected.",
                HandleDisconnect);

            m_console.Commands.AddCommand(
                "bot", false, "add behaviour", "add behaviour <abbreviated-name> [<bot-number>]", 
                "Add a behaviour to a bot",
                "If no bot number is specified then behaviour is added to all bots.\n"
                    + "Can be performed on connected or disconnected bots.",
                HandleAddBehaviour);

            m_console.Commands.AddCommand(
                "bot", false, "remove behaviour", "remove behaviour <abbreviated-name> [<bot-number>]", 
                "Remove a behaviour from a bot",
                "If no bot number is specified then behaviour is added to all bots.\n"
                    + "Can be performed on connected or disconnected bots.",
                HandleRemoveBehaviour);

            m_console.Commands.AddCommand(
                "bot", false, "sit", "sit", "Sit all bots on the ground.",
                HandleSit);

            m_console.Commands.AddCommand(
                "bot", false, "stand", "stand", "Stand all bots.",
                HandleStand);

            m_console.Commands.AddCommand(
                "bot", false, "set bots", "set bots <key> <value>", "Set a setting for all bots.", HandleSetBots);

            m_console.Commands.AddCommand(
                "bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions);

            m_console.Commands.AddCommand(
                "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus);

            m_console.Commands.AddCommand(
                "bot", false, "show bot", "show bot <bot-number>", 
                "Shows the detailed status and settings of a particular bot.", HandleShowBotStatus);

            m_bots = new List<Bot>();
        }
Ejemplo n.º 32
0
        static void Main(string[] args)
        {
            //Console.OutputEncoding = System.Text.Encoding.Unicode;
            CommandConsole console = new CommandConsole()
            {
                Prefix = "", PrintTimestamp = false, VerboseLevel = VerboseTag.Info
            };
            bool running = true;

            Dictionary <string, BaseCDNModule> modules    = new Dictionary <string, BaseCDNModule>();
            LinkedList <ScriptedProvider>      dynModules = new LinkedList <ScriptedProvider>();

            modules.Add("dailymotion", new DailymotionModule("dailymotion"));
            modules.Add("youtube", new YoutubeModule("youtube"));
            modules.Add("vimeo", new ScriptedProvider("vimeo", "Modules\\vimeo.lua"));
            dynModules.AddLast((ScriptedProvider)modules["vimeo"]);
            //TODO: Add more modules here

            //Commands (TODO: package this better than anonymous functions)
            console.RegisterCommand("quit", new EventCommand(new Action <object, EventCmdArgs>((sender, eventArgs) =>
            {
                running = false;
            })));
            //console.RegisterCommand("exec",
            console.RegisterCommand("help", new EventCommand(new Action <object, EventCmdArgs>((sender, eventArgs) =>
            {
                console.Print("List of functions:\n    ->" + string.Join("\n    ->", console.GetCommandList()));
            })));
            console.RegisterCommand("list_modules", new EventCommand(new Action <object, EventCmdArgs>((sender, eventArgs) =>
            {
                console.Print("Modules:\n    ->" + string.Join("\n    ->", modules.Keys.ToArray()));
            })));
            console.RegisterCommand("load_module", new EventCommand(new Action <object, EventCmdArgs>((sender, eventArgs) =>
            {
                if (eventArgs.Arguments.Length == 2)
                {
                    modules.Add(eventArgs.Arguments[0], new ScriptedProvider(eventArgs.Arguments[0], eventArgs.Arguments[1]));
                }
                else
                {
                    console.Print("Usage: load_module [name] [module_file]");
                }
            })));
            console.RegisterCommand("reload_module", new EventCommand(new Action <object, EventCmdArgs>((sender, eventArgs) =>
            {
                if (eventArgs.Arguments.Length == 1)
                {
                    ScriptedProvider module = modules[eventArgs.Arguments[0]] as ScriptedProvider;
                    if (module != null)
                    {
                        module.Reload();
                    }
                }
                else
                {
                    console.Print("Usage: reload_module [module]");
                }
            })));
            console.RegisterCommand("browse", new EventCommand(new Action <object, EventCmdArgs>((sender, eventArgs) =>
            {
                if (eventArgs.Arguments.Length == 3)
                {
                    console.Print(string.Join("\n", modules[eventArgs.Arguments[0]].Browse(eventArgs.Arguments[1], Convert.ToInt32(eventArgs.Arguments[2])).GetEnumerator()));
                }
                else
                {
                    console.Print("Usage: browse [module] [type] [page]");
                }
            })));
            console.RegisterCommand("get_list", new EventCommand(new Action <object, EventCmdArgs>((sender, eventArgs) =>
            {
                if (eventArgs.Arguments.Length == 2)
                {
                    ContentSeries show = modules[eventArgs.Arguments[0]].GetContentList(eventArgs.Arguments[1]);
                    console.Print(show.Name + "\n" + string.Join("\n", show.Installments.GetEnumerator()));
                }
                else
                {
                    console.Print("Usage: get_list [module] [relative_path]");
                }
            })));
            console.RegisterCommand("get_link", new EventCommand(new Action <object, EventCmdArgs>((sender, eventArgs) =>
            {
                if (eventArgs.Arguments.Length == 2)
                {
                    console.Print(string.Join("\n", modules[eventArgs.Arguments[0]].GetContentLink(eventArgs.Arguments[1]).GetEnumerator()));
                }
                else
                {
                    console.Print("Usage: get_link [module] [relative_path]");
                }
            })));

            EventCommandValue val = new EventCommandValue()
            {
                Value = "0"
            };

            val.OnValueChange += new EventHandler <ValueArgs>((sender, eventArgs) =>
            {
                foreach (ScriptedProvider module in dynModules)
                {
                    if (eventArgs.NewValue == "1")
                    {
                        module.AssertErrors = true;
                    }
                    else if (eventArgs.NewValue == "0")
                    {
                        module.AssertErrors = false;
                    }
                    else
                    {
                        break;
                    }
                }
            });
            console.RegisterCommand("debug_module", val);

            //Runs the CLI arguments if there are any arguments, else the console goes into interactive mode
            if (args.Length != 0)
            {
                console.Call(string.Join(" ", args), false, true);
            }
            else
            {
                while (running)
                {
                    console.Call(Console.ReadLine(), false, true);
                }
            }
        }
Ejemplo n.º 33
0
        private void RegisterConsoleCommands(CommandConsole console)
        {
            m_console = console;
            m_console.Commands.AddCommand("userserver", false, "create user",
                    "create user [<first> [<last> [<pass> [<x> <y> [<email>]]]]]",
                    "Create a new user account", RunCommand);

            m_console.Commands.AddCommand("userserver", false, "reset user password",
                    "reset user password [<first> [<last> [<new password>]]]",
                    "Reset a user's password", RunCommand);

            m_console.Commands.AddCommand("userserver", false, "login level",
                    "login level <level>",
                    "Set the minimum user level to log in", HandleLoginCommand);

            m_console.Commands.AddCommand("userserver", false, "login reset",
                    "login reset",
                    "Reset the login level to allow all users",
                    HandleLoginCommand);

            m_console.Commands.AddCommand("userserver", false, "login text",
                    "login text <text>",
                    "Set the text users will see on login", HandleLoginCommand);

            m_console.Commands.AddCommand("userserver", false, "test-inventory",
                    "test-inventory",
                    "Perform a test inventory transaction", RunCommand);

            m_console.Commands.AddCommand("userserver", false, "logoff-user",
                    "logoff-user <first> <last> <message>",
                    "Log off a named user", RunCommand);

            m_console.Commands.AddCommand("default", false, "default regions",
                                          "default regions [<filename>]",
                                          "Show or set the default region locations via a file of locations", HandleDefault);
            m_console.Commands.AddCommand("default", false, "default logins",
                                          "default logins [<filename>]",
                                          "Show or set the initial region locations for new users via a file of locations", HandleDefault);
        }
Ejemplo n.º 34
0
 private void Awake()
 {
     _instance = this;
 }
Ejemplo n.º 35
0
        /// <summary>
        /// Constructor Creates MainConsole.Instance to take commands and provide the place to write data
        /// </summary>
        public BotManager()
        {
            InitBotSendAgentUpdates      = true;
            InitBotRequestObjectTextures = true;

            LoginDelay = DefaultLoginDelay;

            Rng            = new Random(Environment.TickCount);
            AssetsReceived = new Dictionary <UUID, bool>();
            RegionsKnown   = new Dictionary <ulong, GridRegion>();

            m_console            = CreateConsole();
            MainConsole.Instance = m_console;

            // Make log4net see the console
            //
            ILoggerRepository repository = LogManager.GetRepository();

            IAppender[]     appenders       = repository.GetAppenders();
            OpenSimAppender consoleAppender = null;

            foreach (IAppender appender in appenders)
            {
                if (appender.Name == "Console")
                {
                    consoleAppender         = (OpenSimAppender)appender;
                    consoleAppender.Console = m_console;
                    break;
                }
            }

            m_console.Commands.AddCommand(
                "bot", false, "shutdown", "shutdown", "Shutdown bots and exit", HandleShutdown);

            m_console.Commands.AddCommand(
                "bot", false, "quit", "quit", "Shutdown bots and exit", HandleShutdown);

            m_console.Commands.AddCommand(
                "bot", false, "connect", "connect [<n>]", "Connect bots",
                "If an <n> is given, then the first <n> disconnected bots by postfix number are connected.\n"
                + "If no <n> is given, then all currently disconnected bots are connected.",
                HandleConnect);

            m_console.Commands.AddCommand(
                "bot", false, "disconnect", "disconnect [<n>]", "Disconnect bots",
                "Disconnecting bots will interupt any bot connection process, including connection on startup.\n"
                + "If an <n> is given, then the last <n> connected bots by postfix number are disconnected.\n"
                + "If no <n> is given, then all currently connected bots are disconnected.",
                HandleDisconnect);

            m_console.Commands.AddCommand(
                "bot", false, "add behaviour", "add behaviour <abbreviated-name> [<bot-number>]",
                "Add a behaviour to a bot",
                "If no bot number is specified then behaviour is added to all bots.\n"
                + "Can be performed on connected or disconnected bots.",
                HandleAddBehaviour);

            m_console.Commands.AddCommand(
                "bot", false, "remove behaviour", "remove behaviour <abbreviated-name> [<bot-number>]",
                "Remove a behaviour from a bot",
                "If no bot number is specified then behaviour is added to all bots.\n"
                + "Can be performed on connected or disconnected bots.",
                HandleRemoveBehaviour);

            m_console.Commands.AddCommand(
                "bot", false, "sit", "sit", "Sit all bots on the ground.",
                HandleSit);

            m_console.Commands.AddCommand(
                "bot", false, "stand", "stand", "Stand all bots.",
                HandleStand);

            m_console.Commands.AddCommand(
                "bot", false, "set bots", "set bots <key> <value>", "Set a setting for all bots.", HandleSetBots);

            m_console.Commands.AddCommand(
                "bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions);

            m_console.Commands.AddCommand(
                "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus);

            m_console.Commands.AddCommand(
                "bot", false, "show bot", "show bot <bot-number>",
                "Shows the detailed status and settings of a particular bot.", HandleShowBotStatus);

            m_bots = new List <Bot>();
        }
Ejemplo n.º 36
0
        /// <summary>
        /// Performs initialisation of the scene, such as loading configuration from disk.
        /// </summary>
        protected override void StartupSpecific()
        {
            m_log.Info("====================================================================");
            m_log.Info("========================= STARTING OPENSIM =========================");
            m_log.Info("====================================================================");
            m_log.InfoFormat("[OPENSIM MAIN]: Running in {0} mode",
                             (ConfigurationSettings.Standalone ? "sandbox" : "grid"));
            //m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString());
            // http://msdn.microsoft.com/en-us/library/bb384202.aspx
            //GCSettings.LatencyMode = GCLatencyMode.Batch;
            //m_log.InfoFormat("[OPENSIM MAIN]: GC Latency Mode: {0}", GCSettings.LatencyMode.ToString());

            if (m_gui) // Driven by external GUI
                m_console = new CommandConsole("Region");
            else
                m_console = new LocalConsole("Region");
            MainConsole.Instance = m_console;

            RegisterConsoleCommands();

            base.StartupSpecific();

            //Run Startup Commands
            if (String.IsNullOrEmpty(m_startupCommandsFile))
            {
                m_log.Info("[STARTUP]: No startup command script specified. Moving on...");
            }
            else
            {
                RunCommandScript(m_startupCommandsFile);
            }

            // Start timer script (run a script every xx seconds)
            if (m_timedScript != "disabled")
            {
                m_scriptTimer = new Timer();
                m_scriptTimer.Enabled = true;
                m_scriptTimer.Interval = 1200*1000;
                m_scriptTimer.Elapsed += RunAutoTimerScript;
            }

            PrintFileToConsole("startuplogo.txt");

            // For now, start at the 'root' level by default
            if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it
                ChangeSelectedRegion("region",
                                     new string[] {"change", "region", m_sceneManager.Scenes[0].RegionInfo.RegionName});
            else
                ChangeSelectedRegion("region", new string[] {"change", "region", "root"});
        }
Ejemplo n.º 37
0
 public static void Execute(string[] arguments)
 {
     s_log.Info("The following commands are available: {0}", CommandConsole.GetCommandList());
 }
Ejemplo n.º 38
0
        /// <summary>
        /// Constructor Creates MainConsole.Instance to take commands and provide the place to write data
        /// </summary>
        public BotManager()
        {
            LoginDelay = DefaultLoginDelay;

            Rng = new Random(Environment.TickCount);
            AssetsReceived = new Dictionary<UUID, bool>();
            RegionsKnown = new Dictionary<ulong, GridRegion>();

            m_console = CreateConsole();
            MainConsole.Instance = m_console;

            // Make log4net see the console
            //
            ILoggerRepository repository = LogManager.GetRepository();
            IAppender[] appenders = repository.GetAppenders();
            OpenSimAppender consoleAppender = null;

            foreach (IAppender appender in appenders)
            {
                if (appender.Name == "Console")
                {
                    consoleAppender = (OpenSimAppender)appender;
                    consoleAppender.Console = m_console;
                    break;
                }
            }

            m_console.Commands.AddCommand("bot", false, "shutdown",
                    "shutdown",
                    "Shutdown bots and exit", HandleShutdown);

            m_console.Commands.AddCommand("bot", false, "quit",
                    "quit",
                    "Shutdown bots and exit",
                    HandleShutdown);

            m_console.Commands.AddCommand("bot", false, "show regions",
                    "show regions",
                    "Show regions known to bots",
                    HandleShowRegions);

            m_console.Commands.AddCommand("bot", false, "show bots",
                    "show bots",
                    "Shows the status of all bots",
                    HandleShowStatus);

//            m_console.Commands.AddCommand("bot", false, "add bots",
//                    "add bots <number>",
//                    "Add more bots", HandleAddBots);

            m_lBot = new List<Bot>();
        }
Ejemplo n.º 39
0
        /// <summary>
        /// Constructor Creates MainConsole.Instance to take commands and provide the place to write data
        /// </summary>
        public BotManager()
        {
            // We set this to avoid issues with bots running out of HTTP connections if many are run from a single machine
            // to multiple regions.
            Settings.MAX_HTTP_CONNECTIONS = int.MaxValue;

//            System.Threading.ThreadPool.SetMaxThreads(600, 240);
//
//            int workerThreads, iocpThreads;
//            System.Threading.ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads);
//            Console.WriteLine("ThreadPool.GetMaxThreads {0} {1}", workerThreads, iocpThreads);

            InitBotSendAgentUpdates = true;
            InitBotRequestObjectTextures = true;

            LoginDelay = DefaultLoginDelay;

            Rng = new Random(Environment.TickCount);
            AssetsReceived = new Dictionary<UUID, bool>();
            RegionsKnown = new Dictionary<ulong, GridRegion>();

            m_console = CreateConsole();
            MainConsole.Instance = m_console;

            // Make log4net see the console
            //
            ILoggerRepository repository = LogManager.GetRepository();
            IAppender[] appenders = repository.GetAppenders();
            OpenSimAppender consoleAppender = null;

            foreach (IAppender appender in appenders)
            {
                if (appender.Name == "Console")
                {
                    consoleAppender = (OpenSimAppender)appender;
                    consoleAppender.Console = m_console;
                    break;
                }
            }

            m_console.Commands.AddCommand(
                "Bots", false, "shutdown", "shutdown", "Shutdown bots and exit", HandleShutdown);

            m_console.Commands.AddCommand(
                "Bots", false, "quit", "quit", "Shutdown bots and exit", HandleShutdown);

            m_console.Commands.AddCommand(
                "Bots", false, "connect", "connect [<n>]", "Connect bots",
                "If an <n> is given, then the first <n> disconnected bots by postfix number are connected.\n"
                    + "If no <n> is given, then all currently disconnected bots are connected.",
                HandleConnect);

            m_console.Commands.AddCommand(
                "Bots", false, "disconnect", "disconnect [<n>]", "Disconnect bots",
                "Disconnecting bots will interupt any bot connection process, including connection on startup.\n"
                    + "If an <n> is given, then the last <n> connected bots by postfix number are disconnected.\n"
                    + "If no <n> is given, then all currently connected bots are disconnected.",
                HandleDisconnect);

            m_console.Commands.AddCommand(
                "Bots", false, "add behaviour", "add behaviour <abbreviated-name> [<bot-number>]", 
                "Add a behaviour to a bot",
                "If no bot number is specified then behaviour is added to all bots.\n"
                    + "Can be performed on connected or disconnected bots.",
                HandleAddBehaviour);

            m_console.Commands.AddCommand(
                "Bots", false, "remove behaviour", "remove behaviour <abbreviated-name> [<bot-number>]", 
                "Remove a behaviour from a bot",
                "If no bot number is specified then behaviour is added to all bots.\n"
                    + "Can be performed on connected or disconnected bots.",
                HandleRemoveBehaviour);

            m_console.Commands.AddCommand(
                "Bots", false, "sit", "sit", "Sit all bots on the ground.",
                HandleSit);

            m_console.Commands.AddCommand(
                "Bots", false, "stand", "stand", "Stand all bots.",
                HandleStand);

            m_console.Commands.AddCommand(
                "Bots", false, "set bots", "set bots <key> <value>", "Set a setting for all bots.", HandleSetBots);

            m_console.Commands.AddCommand(
                "Bots", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions);

            m_console.Commands.AddCommand(
                "Bots", false, "show bots", "show bots", "Shows the status of all bots.", HandleShowBotsStatus);

            m_console.Commands.AddCommand(
                "Bots", false, "show bot", "show bot <bot-number>", 
                "Shows the detailed status and settings of a particular bot.", HandleShowBotStatus);

            m_console.Commands.AddCommand(
                "Debug", 
                false, 
                "debug lludp packet", 
                "debug lludp packet <level> <avatar-first-name> <avatar-last-name>", 
                "Turn on received packet logging.",
                "If level >  0 then all received packets that are not duplicates are logged.\n"
                + "If level <= 0 then no received packets are logged.",
                HandleDebugLludpPacketCommand);

            m_console.Commands.AddCommand(
                "Bots", false, "show status", "show status", "Shows pCampbot status.", HandleShowStatus);

            m_bots = new List<Bot>();

            Watchdog.Enabled = true;
            StatsManager.RegisterConsoleCommands(m_console);

            m_serverStatsCollector = new ServerStatsCollector();
            m_serverStatsCollector.Initialise(null);
            m_serverStatsCollector.Enabled = true;
            m_serverStatsCollector.Start();

            BotConnectingState = BotManagerBotConnectingState.Ready;
        }
Ejemplo n.º 40
0
        protected virtual void AddPluginCommands(CommandConsole console)
        {
            List<string> topics = GetHelpTopics();

            foreach (string topic in topics)
            {
                string capitalizedTopic = char.ToUpper(topic[0]) + topic.Substring(1);

                // This is a hack to allow the user to enter the help command in upper or lowercase.  This will go
                // away at some point.
                console.Commands.AddCommand(capitalizedTopic, false, "help " + topic,
                                              "help " + capitalizedTopic,
                                              "Get help on plugin command '" + topic + "'",
                                              HandleCommanderHelp);
                console.Commands.AddCommand(capitalizedTopic, false, "help " + capitalizedTopic,
                                              "help " + capitalizedTopic,
                                              "Get help on plugin command '" + topic + "'",
                                              HandleCommanderHelp);

                ICommander commander = null;

                Scene s = SceneManager.CurrentOrFirstScene;

                if (s != null && s.GetCommanders() != null)
                {
                    if (s.GetCommanders().ContainsKey(topic))
                        commander = s.GetCommanders()[topic];
                }

                if (commander == null)
                    continue;

                foreach (string command in commander.Commands.Keys)
                {
                    console.Commands.AddCommand(capitalizedTopic, false,
                                                  topic + " " + command,
                                                  topic + " " + commander.Commands[command].ShortHelp(),
                                                  String.Empty, HandleCommanderCommand);
                }
            }
        }