private static void OutputAllChecksToConsole(ICommandConsole con)
 {
     foreach (var category in RegisteredChecks.Values)
     {
         OutputCategoryChecksToConsole(con, category);
     }
 }
Beispiel #2
0
        public static void RegisterConsoleCommands(ICommandConsole console)
        {
            console.Commands.AddCommand(
                "General",
                false,
                "stats show",
                "stats show [list|all|(<category>[.<container>])+",
                "Show statistical information for this server",
                "If no final argument is specified then legacy statistics information is currently shown.\n"
                + "'list' argument will show statistic categories.\n"
                + "'all' will show all statistics.\n"
                + "A <category> name will show statistics from that category.\n"
                + "A <category>.<container> name will show statistics from that category in that container.\n"
                + "More than one name can be given separated by spaces.\n",
                HandleShowStatsCommand);

            console.Commands.AddCommand(
                "General",
                false,
                "show stats",
                "show stats [list|all|(<category>[.<container>])+",
                "Alias for 'stats show' command",
                HandleShowStatsCommand);
            StatsLogger.RegisterConsoleCommands(console);
        }
        public static void RegisterConsoleCommands(ICommandConsole console)
        {
            console.Commands.AddCommand(
                "General",
                false,
                "stats show",
                "stats show [list|all|(<category>[.<container>])+",
                "Show statistical information for this server",
                "If no final argument is specified then legacy statistics information is currently shown.\n"
                    + "'list' argument will show statistic categories.\n"
                    + "'all' will show all statistics.\n"
                    + "A <category> name will show statistics from that category.\n"
                    + "A <category>.<container> name will show statistics from that category in that container.\n"
                    + "More than one name can be given separated by spaces.\n"
                    + "THIS STATS FACILITY IS EXPERIMENTAL AND DOES NOT YET CONTAIN ALL STATS",
                HandleShowStatsCommand);

            console.Commands.AddCommand(
                "General",
                false,
                "show stats",
                "show stats [list|all|(<category>[.<container>])+",
                "Alias for 'stats show' command",
                HandleShowStatsCommand);

            StatsLogger.RegisterConsoleCommands(console);
        }
Beispiel #4
0
 private static void OutputAllStatsToConsole(ICommandConsole con)
 {
     foreach (string report in GetAllStatsReports())
     {
         con.Output(report);
     }
 }
Beispiel #5
0
 public static void RegisterHttpConsoleCommands(ICommandConsole console)
 {
     console.Commands.AddCommand(
         "Comms", false, "show http-handlers",
         "show http-handlers",
         "Show all registered http handlers", HandleShowHttpHandlersCommand);
 }
 private static void OutputContainerChecksToConsole(ICommandConsole con, SortedDictionary <string, Check> container)
 {
     foreach (Check check in container.Values)
     {
         con.Output(check.ToConsoleString());
     }
 }
        public static void RegisterHttpConsoleCommands(ICommandConsole console)
        {
            console.Commands.AddCommand(
                "Comms", false, "show http-handlers",
                "show http-handlers",
                "Show all registered http handlers", HandleShowHttpHandlersCommand);

            console.Commands.AddCommand(
                "Debug", false, "debug http", "debug http <in|out|all> [<level>]",
                "Turn on http request logging.",
                "If in or all and\n"
                + "  level <= 0 then no extra logging is done.\n"
                + "  level >= 1 then short warnings are logged when receiving bad input data.\n"
                + "  level >= 2 then long warnings are logged when receiving bad input data.\n"
                + "  level >= 3 then short notices about all incoming non-poll HTTP requests are logged.\n"
                + "  level >= 4 then the time taken to fulfill the request is logged.\n"
                + "  level >= 5 then a sample from the beginning of the data is logged.\n"
                + "  level >= 6 then the entire data is logged.\n"
                + "  no level is specified then the current level is returned.\n\n"
                + "If out or all and\n"
                + "  level >= 3 then short notices about all outgoing requests going through WebUtil are logged.\n"
                + "  level >= 4 then the time taken to fulfill the request is logged.\n"
                + "  level >= 5 then a sample from the beginning of the data is logged.\n"
                + "  level >= 6 then the entire data is logged.\n",
                HandleDebugHttpCommand);
        }
 private static void OutputCategoryChecksToConsole(
     ICommandConsole con, SortedDictionary <string, SortedDictionary <string, Check> > category)
 {
     foreach (var container in category.Values)
     {
         OutputContainerChecksToConsole(con, container);
     }
 }
Beispiel #9
0
        protected ConsoleCommand([NotNull] ICommandConsole console, SceneTree sceneTree)
        {
            Ensure.Any.IsNotNull(console, nameof(console));
            Ensure.Any.IsNotNull(sceneTree, nameof(sceneTree));

            Console   = console;
            SceneTree = sceneTree;
        }
Beispiel #10
0
 private static void OutputCategoryStatsToConsole(
     ICommandConsole con, SortedDictionary <string, SortedDictionary <string, Stat> > category)
 {
     foreach (string report in GetCategoryStatsReports(category))
     {
         con.Output(report);
     }
 }
Beispiel #11
0
 private static void OutputContainerStatsToConsole(
     ICommandConsole con, SortedDictionary <string, Stat> container)
 {
     foreach (string report in GetContainerStatsReports(container))
     {
         con.Output(report);
     }
 }
Beispiel #12
0
        protected ConsoleCommand(ICommandConsole console, SceneTree sceneTree)
        {
            Ensure.That(console, nameof(console)).IsNotNull();
            Ensure.That(sceneTree, nameof(sceneTree)).IsNotNull();

            Console   = console;
            SceneTree = sceneTree;
        }
Beispiel #13
0
        public static void RegisterHttpConsoleCommands(ICommandConsole console)
        {
            console.Commands.AddCommand(
                "Comms", false, "show http-handlers",
                "show http-handlers",
                "Show all registered http handlers", HandleShowHttpHandlersCommand);

        }
        public static void HandleShowchecksCommand(string module, string[] cmd)
        {
            ICommandConsole con = MainConsole.Instance;

            if (cmd.Length > 2)
            {
                foreach (string name in cmd.Skip(2))
                {
                    string[] components = name.Split('.');

                    string categoryName = components[0];
                    //                    string containerName = components.Length > 1 ? components[1] : null;

                    if (categoryName == ListSubCommand)
                    {
                        con.Output("check categories available are:");

                        foreach (string category in RegisteredChecks.Keys)
                        {
                            con.OutputFormat("  {0}", category);
                        }
                    }
                    //                    else
                    //                    {
                    //                        SortedDictionary<string, SortedDictionary<string, Check>> category;
                    //                        if (!Registeredchecks.TryGetValue(categoryName, out category))
                    //                        {
                    //                            con.OutputFormat("No such category as {0}", categoryName);
                    //                        }
                    //                        else
                    //                        {
                    //                            if (String.IsNullOrEmpty(containerName))
                    //                            {
                    //                                OutputConfiguredToConsole(con, category);
                    //                            }
                    //                            else
                    //                            {
                    //                                SortedDictionary<string, Check> container;
                    //                                if (category.TryGetValue(containerName, out container))
                    //                                {
                    //                                    OutputContainerChecksToConsole(con, container);
                    //                                }
                    //                                else
                    //                                {
                    //                                    con.OutputFormat("No such container {0} in category {1}", containerName, categoryName);
                    //                                }
                    //                            }
                    //                        }
                    //                    }
                }
            }
            else
            {
                OutputAllChecksToConsole(con);
            }
        }
Beispiel #15
0
        public void Initialize(GridServerBase gridServer)
        {
            m_core = gridServer;
            m_config = gridServer.Config;
            m_console = MainConsole.Instance;

            AddConsoleCommands();

            SetupGridServices();
        }
Beispiel #16
0
        /// <summary>
        /// Check if the given file path exists.
        /// </summary>
        /// <remarks>If not, warning is printed to the given console.</remarks>
        /// <returns>true if the file does not exist, false otherwise.</returns>
        /// <param name='console'></param>
        /// <param name='path'></param>
        public static bool CheckFileDoesNotExist(ICommandConsole console, string path)
        {
            if (File.Exists(path))
            {
                console.OutputFormat("File {0} already exists.  Please move or remove it.", path);
                return false;
            }

            return true;
        }
        public void Initialize(GridServerBase gridServer)
        {
            m_core    = gridServer;
            m_config  = gridServer.Config;
            m_console = MainConsole.Instance;

            AddConsoleCommands();

            SetupGridServices();
        }
Beispiel #18
0
        /// <summary>
        /// Check if the given file path exists.
        /// </summary>
        /// <remarks>If not, warning is printed to the given console.</remarks>
        /// <returns>true if the file does not exist, false otherwise.</returns>
        /// <param name='console'></param>
        /// <param name='path'></param>
        public static bool CheckFileDoesNotExist(ICommandConsole console, string path)
        {
            if (File.Exists(path))
            {
                console.OutputFormat("File {0} already exists.  Please move or remove it.", path);
                return(false);
            }

            return(true);
        }
Beispiel #19
0
 private static void OutputCategoryStatsToConsole(
     ICommandConsole con, Dictionary <string, Dictionary <string, Stat> > category)
 {
     foreach (var container in category.Values)
     {
         foreach (Stat stat in container.Values)
         {
             con.Output(stat.ToConsoleString());
         }
     }
 }
Beispiel #20
0
        public IEnumerable <IConsoleCommand> CreateCommands(ICommandConsole console)
        {
            var sceneTree = GetTree();

            return(new IConsoleCommand[]
            {
                new ClearCommand(console, sceneTree),
                new HelpCommand(console, sceneTree),
                new QuitCommand(console, sceneTree)
            });
        }
Beispiel #21
0
        /// <summary>
        /// When the module is first started see if
        /// we can find our menu container in the scene.
        /// </summary>
        public override void OnInit()
        {
            menuContainer   = GameObject.FindGameObjectWithTag(MenuContainerTag)?.transform;
            commandConsole  = GetModule <CommandConsoleModule>();
            configContainer = GetModule <ConfigModule>();

            if (menuContainer == null)
            {
                throw new FormatException("Scene is poorly formatted. No menu container found.");
            }
        }
Beispiel #22
0
 public static void RegisterConsoleCommands(ICommandConsole console)
 {
     console.Commands.AddCommand(
         "Debug",
         false,
         "debug stats record",
         "debug stats record start|stop",
         "Control whether stats are being regularly recorded to a separate file.",
         "For debug purposes.  Experimental.",
         HandleStatsRecordCommand);
 }
 public static void RegisterConsoleCommands(ICommandConsole console)
 {
     console.Commands.AddCommand(
         "Debug",
         false,
         "debug stats record",
         "debug stats record start|stop",
         "Control whether stats are being regularly recorded to a separate file.",
         "For debug purposes.  Experimental.",
         HandleStatsRecordCommand);
 }
        public void AddRegion(Scene scene)
        {
//            m_log.DebugFormat("[REGION COMMANDS MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);

            m_scene = scene;
            m_console = MainConsole.Instance;

            m_console.Commands.AddCommand(
                "Regions", false, "show scene",
                "show scene",
                "Show live scene information for the currently selected region.", HandleShowScene);
        }
Beispiel #25
0
        public void AddRegion(Scene scene)
        {
            //            m_log.DebugFormat("[REGION COMMANDS MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);

            m_scene   = scene;
            m_console = MainConsole.Instance;

            m_console.Commands.AddCommand(
                "Regions", false, "show scene",
                "show scene",
                "Show live scene information for the currently selected region.", HandleShowScene);
        }
Beispiel #26
0
 public static void RegisterConsoleCommands(ICommandConsole console)
 {
     console.Commands.AddCommand(
         "General",
         false,
         "show checks",
         "show checks",
         "Show checks configured for this server",
         "If no argument is specified then info on all checks will be shown.\n"
             + "'list' argument will show check categories.\n"
             + "THIS FACILITY IS EXPERIMENTAL",
         HandleShowchecksCommand);
 }
        public IEnumerable <IConsoleCommand> CreateCommands(ICommandConsole console)
        {
            Ensure.Any.IsNotNull(console, nameof(console));

            var sceneTree = GetTree();

            return(new IConsoleCommand[]
            {
                new ClearCommand(console, sceneTree),
                new HelpCommand(console, sceneTree),
                new QuitCommand(console, sceneTree)
            });
        }
 public static void RegisterConsoleCommands(ICommandConsole console)
 {
     console.Commands.AddCommand(
         "General",
         false,
         "show checks",
         "show checks",
         "Show checks configured for this server",
         "If no argument is specified then info on all checks will be shown.\n"
         + "'list' argument will show check categories.\n"
         + "THIS FACILITY IS EXPERIMENTAL",
         HandleShowchecksCommand);
 }
        public void SetUp()
        {
            inputLine = new InputLine();
            stubCommandConsole = MockRepository.GenerateStub<ICommandConsole>();
            stubMessageConsole = MockRepository.GenerateStub<IMessageConsole>();
            stubInputView = MockRepository.GenerateStub<IOverlayView>();
            stubCommandConsoleView = MockRepository.GenerateStub<IOverlayView>();
            stubMessageConsoleView = MockRepository.GenerateStub<IOverlayView>();
            stubPossibleCommandsView = MockRepository.GenerateStub<IOverlayView>();
            stubKeyboard = MockRepository.GenerateStub<IKeyboard>();

            consoleController = new ConsoleController(inputLine, stubCommandConsole, stubMessageConsole, stubInputView, stubCommandConsoleView, stubMessageConsoleView, stubPossibleCommandsView, stubKeyboard);
        }
Beispiel #30
0
        protected virtual void AddPluginCommands(ICommandConsole console)
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }


            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);
                }
            }
        }
Beispiel #31
0
        public void AddRegion(Scene scene)
        {
//            m_log.DebugFormat("[OBJECT COMMANDS MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);

            m_scene   = scene;
            m_console = MainConsole.Instance;

            m_console.Commands.AddCommand("region", false, "delete object owner",
                                          "delete object owner <UUID>",
                                          "Delete a scene object by owner", HandleDeleteObject);
            m_console.Commands.AddCommand("region", false, "delete object creator",
                                          "delete object creator <UUID>",
                                          "Delete a scene object by creator", HandleDeleteObject);
            m_console.Commands.AddCommand("region", false, "delete object uuid",
                                          "delete object uuid <UUID>",
                                          "Delete a scene object by uuid", HandleDeleteObject);
            m_console.Commands.AddCommand("region", false, "delete object name",
                                          "delete object name <name>",
                                          "Delete a scene object by name", HandleDeleteObject);
            m_console.Commands.AddCommand("region", false, "delete object outside",
                                          "delete object outside",
                                          "Delete all scene objects outside region boundaries", HandleDeleteObject);

            m_console.Commands.AddCommand(
                "region",
                false,
                "show object uuid",
                "show object uuid <UUID>",
                "Show details of a scene object with the given UUID", HandleShowObjectByUuid);

            m_console.Commands.AddCommand(
                "region",
                false,
                "show object name",
                "show object name <name>",
                "Show details of scene objects with the given name", HandleShowObjectByName);

            m_console.Commands.AddCommand(
                "region",
                false,
                "show part uuid",
                "show part uuid <UUID>",
                "Show details of a scene object parts with the given UUID", HandleShowPartByUuid);

            m_console.Commands.AddCommand(
                "region",
                false,
                "show part name",
                "show part name <name>",
                "Show details of scene object parts with the given name", HandleShowPartByName);
        }
Beispiel #32
0
        /// <summary>
        /// Convert a console input to a double, automatically complaining if a console is given.
        /// </summary>
        /// <param name='console'>Can be null if no console is available.</param>
        /// <param name='rawConsoleInput'>/param>
        /// <param name='i'></param>
        /// <returns></returns>
        public static bool TryParseConsoleDouble(ICommandConsole console, string rawConsoleInput, out double i)
        {
            if (!double.TryParse(rawConsoleInput, out i))
            {
                if (console != null)
                {
                    console.Output("ERROR: {0} is not a valid double", rawConsoleInput);
                }

                return(false);
            }

            return(true);
        }
Beispiel #33
0
        public ConsoleController(InputLine inputLine, ICommandConsole commandConsole, IMessageConsole messageConsole, 
            IOverlayView inputView, IOverlayView commandConsoleView, IOverlayView messageConsoleView, IOverlayView possibleCommandsView, IKeyboard keyboard)
        {
            this.InputLine = inputLine;
            _commandConsole = commandConsole;
            _messageConsole = messageConsole;
            _inputView = inputView;
            _commandConsoleView = commandConsoleView;
            _messageConsoleView = messageConsoleView;
            _possibleCommandsView = possibleCommandsView;
            _keyboard = keyboard;

            this.InputLine.CurrentInput = "";
        }
Beispiel #34
0
        /// <summary>
        /// Convert a console input to a float, automatically complaining if a console is given.
        /// </summary>
        /// <param name='console'>Can be null if no console is available.</param>
        /// <param name='rawConsoleInput'>/param>
        /// <param name='i'></param>
        /// <returns></returns>
        public static bool TryParseConsoleFloat(ICommandConsole console, string rawConsoleInput, out float i)
        {
            if (!float.TryParse(rawConsoleInput, out i))
            {
                if (console != null)
                {
                    console.Output("ERROR: {0} is not a valid float", rawConsoleInput);
                }

                return(false);
            }

            return(true);
        }
Beispiel #35
0
        /// <summary>
        /// Convert a console integer to an int, automatically complaining if a console is given.
        /// </summary>
        /// <param name='console'>Can be null if no console is available.</param>
        /// <param name='rawConsoleVector'>/param>
        /// <param name='vector'></param>
        /// <returns></returns>
        public static bool TryParseConsoleBool(ICommandConsole console, string rawConsoleString, out bool b)
        {
            if (!bool.TryParse(rawConsoleString, out b))
            {
                if (console != null)
                {
                    console.OutputFormat("ERROR: {0} is not a true or false value", rawConsoleString);
                }

                return(false);
            }

            return(true);
        }
Beispiel #36
0
        /// <summary>
        /// Convert a console integer to an int, automatically complaining if a console is given.
        /// </summary>
        /// <param name='console'>Can be null if no console is available.</param>
        /// <param name='rawConsoleInt'>/param>
        /// <param name='i'></param>
        /// <returns></returns>
        public static bool TryParseConsoleInt(ICommandConsole console, string rawConsoleInt, out int i)
        {
            if (!int.TryParse(rawConsoleInt, out i))
            {
                if (console != null)
                {
                    console.OutputFormat("ERROR: {0} is not a valid integer", rawConsoleInt);
                }

                return(false);
            }

            return(true);
        }
Beispiel #37
0
        /// <summary>
        /// Try to parse a console UUID from the console.
        /// </summary>
        /// <remarks>
        /// Will complain to the console if parsing fails.
        /// </remarks>
        /// <returns></returns>
        /// <param name='console'>If null then no complaint is printed.</param>
        /// <param name='rawUuid'></param>
        /// <param name='uuid'></param>
        public static bool TryParseConsoleUuid(ICommandConsole console, string rawUuid, out UUID uuid)
        {
            if (!UUID.TryParse(rawUuid, out uuid))
            {
                if (console != null)
                {
                    console.OutputFormat("ERROR: {0} is not a valid uuid", rawUuid);
                }

                return(false);
            }

            return(true);
        }
Beispiel #38
0
 public static void RegisterConsoleCommands(ICommandConsole console)
 {
     console.Commands.AddCommand(
         "General",
         false,
         "show stats",
         "show stats [list|all|<category>]",
         "Show statistical information for this server",
         "If no final argument is specified then legacy statistics information is currently shown.\n"
             + "If list is specified then statistic categories are shown.\n"
             + "If all is specified then all registered statistics are shown.\n"
             + "If a category name is specified then only statistics from that category are shown.\n"
             + "THIS STATS FACILITY IS EXPERIMENTAL AND DOES NOT YET CONTAIN ALL STATS",
         HandleShowStatsCommand);
 }
Beispiel #39
0
 public static void RegisterConsoleCommands(ICommandConsole console)
 {
     console.Commands.AddCommand(
         "General",
         false,
         "show stats",
         "show stats [list|all|<category>]",
         "Show statistical information for this server",
         "If no final argument is specified then legacy statistics information is currently shown.\n"
         + "If list is specified then statistic categories are shown.\n"
         + "If all is specified then all registered statistics are shown.\n"
         + "If a category name is specified then only statistics from that category are shown.\n"
         + "THIS STATS FACILITY IS EXPERIMENTAL AND DOES NOT YET CONTAIN ALL STATS",
         HandleShowStatsCommand);
 }
Beispiel #40
0
 private static void OutputAllChecksToConsole(ICommandConsole con)
 {
     RegisteredChecksRwLock.AcquireReaderLock(-1);
     try
     {
         foreach (var category in RegisteredChecks.Values)
         {
             OutputCategoryChecksToConsole(con, category);
         }
     }
     finally
     {
         RegisteredChecksRwLock.ReleaseReaderLock();
     }
 }
        public void AddRegion(Scene scene)
        {
//            m_log.DebugFormat("[REGION COMMANDS MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);

            m_scene = scene;
            m_console = MainConsole.Instance;

            m_console.Commands.AddCommand(
                "Regions", false, "show scene",
                "show scene",
                "Show live information for the currently selected scene (fps, prims, etc.).", HandleShowScene);

            m_console.Commands.AddCommand(
                "Regions", false, "show region",
                "show region",
                "Show control information for the currently selected region (host name, max physical prim size, etc).", 
                HandleShowRegion);
        }
Beispiel #42
0
        public static void RegisterConsoleCommands(ICommandConsole console)
        {
            console.Commands.AddCommand(
                "General",
                false,
                "stats record",
                "stats record start|stop",
                "Control whether stats are being regularly recorded to a separate file.",
                "For debug purposes.  Experimental.",
                HandleStatsRecordCommand);

            console.Commands.AddCommand(
                "General",
                false,
                "stats save",
                "stats save <path>",
                "Save stats snapshot to a file.  If the file already exists, then the report is appended.",
                "For debug purposes.  Experimental.",
                HandleStatsSaveCommand);
        }
Beispiel #43
0
        /// <summary>
        /// Convert a console integer to an int, automatically complaining if a console is given.
        /// </summary>
        /// <param name='console'>Can be null if no console is available.</param>
        /// <param name='rawConsoleInt'>/param>
        /// <param name='i'></param>
        /// <returns></returns>
        public static bool TryParseConsoleInt(ICommandConsole console, string rawConsoleInt, out int i)
        {
            if (!int.TryParse(rawConsoleInt, out i))
            {
                if (console != null)
                    console.OutputFormat("ERROR: {0} is not a valid integer", rawConsoleInt);

                return false;
            }

            return true;
        }
Beispiel #44
0
 private static void OutputAllChecksToConsole(ICommandConsole con)
 {
     foreach (var category in RegisteredChecks.Values)
     {
         OutputCategoryChecksToConsole(con, category);
     }
 }
 private static void OutputContainerStatsToConsole(
     ICommandConsole con, SortedDictionary<string, Stat> container)
 {
     foreach (string report in GetContainerStatsReports(container))
         con.Output(report);
 }
 private static void OutputStatToConsole(ICommandConsole con, Stat stat)
 {
     con.Output(stat.ToConsoleString());
 }
Beispiel #47
0
        private void SetUpConsole()
        {
            List<ICommandConsole> Plugins = AuroraModuleLoader.PickupModules<ICommandConsole>();
            foreach (ICommandConsole plugin in Plugins)
            {
                plugin.Initialize("Region", ConfigSource, this);
            }

            m_console = m_applicationRegistry.Get<ICommandConsole>();
            if (m_console == null)
                m_console = new LocalConsole();
            ILoggerRepository repository = LogManager.GetRepository();
            IAppender[] appenders = repository.GetAppenders();
            OpenSimAppender m_consoleAppender = null;
            foreach (IAppender appender in appenders)
            {
                if (appender.Name == "Console")
                {
                    m_consoleAppender = (OpenSimAppender)appender;
                    break;
                }
            }

            foreach (IAppender appender in appenders)
            {
                if (appender.Name == "LogFileAppender")
                {
                    m_logFileAppender = appender;
                }
            }

            if (null != m_consoleAppender)
            {
                m_consoleAppender.Console = m_console;
                // If there is no threshold set then the threshold is effectively everything.
                if (null == m_consoleAppender.Threshold)
                    m_consoleAppender.Threshold = Level.All;
                m_console.Output(String.Format("Console log level is {0}", m_consoleAppender.Threshold));
            }
            if (m_console == null)
                m_console = new LocalConsole();
            MainConsole.Instance = m_console;
        }
Beispiel #48
0
        /// <summary>
        /// Try to parse a console UUID from the console.
        /// </summary>
        /// <remarks>
        /// Will complain to the console if parsing fails.
        /// </remarks>
        /// <returns></returns>
        /// <param name='console'>If null then no complaint is printed.</param>
        /// <param name='rawUuid'></param>
        /// <param name='uuid'></param>
        public static bool TryParseConsoleUuid(ICommandConsole console, string rawUuid, out UUID uuid)
        {
            if (!UUID.TryParse(rawUuid, out uuid))
            {
                if (console != null)
                    console.OutputFormat("ERROR: {0} is not a valid uuid", rawUuid);

                return false;
            }
    
            return true;
        }
 /// <summary>
 /// Shows help information on the console's Notice method
 /// </summary>
 public void ShowHelp(ICommandConsole console)
 {
     console.Output(String.Join(" ", m_cmdText) + " - " + m_helpText + "\n");
 }
Beispiel #50
0
        protected virtual void AddPluginCommands(ICommandConsole 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);
                }
            }
        }
Beispiel #51
0
        /// <summary>
        /// Convert a console integer to an int, automatically complaining if a console is given.
        /// </summary>
        /// <param name='console'>Can be null if no console is available.</param>
        /// <param name='rawConsoleVector'>/param>
        /// <param name='vector'></param>
        /// <returns></returns>
        public static bool TryParseConsoleBool(ICommandConsole console, string rawConsoleString, out bool b)
        {
            if (!bool.TryParse(rawConsoleString, out b))
            {
                if (console != null)
                    console.OutputFormat("ERROR: {0} is not a true or false value", rawConsoleString);

                return false;
            }

            return true;
        }
Beispiel #52
0
        /// <summary>
        /// Tries to parse the input as either a UUID or a local ID.
        /// </summary>
        /// <returns>true if parsing succeeded, false otherwise.</returns>
        /// <param name='console'></param>
        /// <param name='rawId'></param>
        /// <param name='uuid'></param>
        /// <param name='localId'>
        /// Will be set to ConsoleUtil.LocalIdNotFound if parsing result was a UUID or no parse succeeded.
        /// </param>
        public static bool TryParseConsoleId(ICommandConsole console, string rawId, out UUID uuid, out uint localId)
        {
            if (TryParseConsoleUuid(null, rawId, out uuid))
            {
                localId = LocalIdNotFound;
                return true;
            }

            if (TryParseConsoleLocalId(null, rawId, out localId))
            {
                return true;
            }

            if (console != null)
                console.OutputFormat("ERROR: {0} is not a valid UUID or local id", rawId);

            return false;
        }
Beispiel #53
0
        public static bool TryParseConsoleLocalId(ICommandConsole console, string rawLocalId, out uint localId)
        {
            if (!uint.TryParse(rawLocalId, out localId))
            {
                if (console != null)
                    console.OutputFormat("ERROR: {0} is not a valid local id", localId);

                return false;
            }

            if (localId == 0)
            {
                if (console != null)
                    console.OutputFormat("ERROR: {0} is not a valid local id - it must be greater than 0", localId);

                return false;
            }

            return true;
        }
Beispiel #54
0
 private static void OutputCategoryChecksToConsole(
     ICommandConsole con, SortedDictionary<string, SortedDictionary<string, Check>> category)
 {
     foreach (var container in category.Values)
     {
         OutputContainerChecksToConsole(con, container);
     }
 }
Beispiel #55
0
 private static void OutputContainerChecksToConsole(ICommandConsole con, SortedDictionary<string, Check> container)
 {
     foreach (Check check in container.Values)
     {
         con.Output(check.ToConsoleString());
     }
 }
Beispiel #56
0
        /// <summary>
        /// Convert a console integer to a natural int, automatically complaining if a console is given.
        /// </summary>
        /// <param name='console'>Can be null if no console is available.</param>
        /// <param name='rawConsoleInt'>/param>
        /// <param name='i'></param>
        /// <returns></returns>
        public static bool TryParseConsoleNaturalInt(ICommandConsole console, string rawConsoleInt, out int i)
        {
            if (TryParseConsoleInt(console, rawConsoleInt, out i))
            {
                if (i < 0)
                {
                    if (console != null)
                        console.OutputFormat("ERROR: {0} is not a positive integer", rawConsoleInt);

                    return false;
                }

                return true;
            }

            return false;
        }
Beispiel #57
0
 private static void OutputContainerStatsToConsole( ICommandConsole con, SortedDictionary<string, Stat> container)
 {
     foreach (Stat stat in container.Values)
     {
         con.Output(stat.ToConsoleString());
     }
 }
        public void AddRegion(Scene scene)
        {
//            m_log.DebugFormat("[OBJECT COMMANDS MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);

            m_scene = scene;
            m_console = MainConsole.Instance;

            m_console.Commands.AddCommand(
                "Objects", false, "delete object owner",
                "delete object owner <UUID>",
                "Delete scene objects by owner",
                "Command will ask for confirmation before proceeding.",
                HandleDeleteObject);

            m_console.Commands.AddCommand(
                "Objects", false, "delete object creator",
                "delete object creator <UUID>",
                "Delete scene objects by creator",
                "Command will ask for confirmation before proceeding.",
                HandleDeleteObject);

            m_console.Commands.AddCommand(
                "Objects", false, "delete object id",
                "delete object id <UUID-or-localID>",
                "Delete a scene object by uuid or localID",
                HandleDeleteObject);

            m_console.Commands.AddCommand(
                "Objects", false, "delete object name",
                "delete object name [--regex] <name>",
                "Delete a scene object by name.",
                "Command will ask for confirmation before proceeding.\n"
                  + "If --regex is specified then the name is treatead as a regular expression",
                HandleDeleteObject);

            m_console.Commands.AddCommand(
                "Objects", false, "delete object outside",
                "delete object outside",
                "Delete all scene objects outside region boundaries",
                "Command will ask for confirmation before proceeding.",
                HandleDeleteObject);

            m_console.Commands.AddCommand(
                "Objects",
                false,
                "delete object pos",
                "delete object pos <start-coord> to <end-coord>",
                "Delete scene objects within the given area.",
                ConsoleUtil.CoordHelp,
                HandleDeleteObject);

            m_console.Commands.AddCommand(
                "Objects",
                false,
                "show object id",
                "show object id [--full] <UUID-or-localID>",
                "Show details of a scene object with the given UUID or localID",
                "The --full option will print out information on all the parts of the object.\n"
                    + "For yet more detailed part information, use the \"show part\" commands.",
                HandleShowObjectById);

            m_console.Commands.AddCommand(
                "Objects",
                false,
                "show object name",
                "show object name [--full] [--regex] <name>",
                "Show details of scene objects with the given name.",
                "The --full option will print out information on all the parts of the object.\n"
                    + "For yet more detailed part information, use the \"show part\" commands.\n"
                    + "If --regex is specified then the name is treatead as a regular expression.",
                HandleShowObjectByName);

            m_console.Commands.AddCommand(
                "Objects",
                false,
                "show object pos",
                "show object pos [--full] <start-coord> to <end-coord>",
                "Show details of scene objects within the given area.",
                "The --full option will print out information on all the parts of the object.\n"
                    + "For yet more detailed part information, use the \"show part\" commands.\n"
                    + ConsoleUtil.CoordHelp,
                HandleShowObjectByPos);

            m_console.Commands.AddCommand(
                "Objects",
                false,
                "show part id",
                "show part id <UUID-or-localID>",
                "Show details of a scene object part with the given UUID or localID", HandleShowPartById);

            m_console.Commands.AddCommand(
                "Objects",
                false,
                "show part name",
                "show part name [--regex] <name>",
                "Show details of scene object parts with the given name.",
                "If --regex is specified then the name is treated as a regular expression",
                HandleShowPartByName);

            m_console.Commands.AddCommand(
                "Objects",
                false,
                "show part pos",
                "show part pos <start-coord> to <end-coord>",
                "Show details of scene object parts within the given area.",
                ConsoleUtil.CoordHelp,
                HandleShowPartByPos);

            m_console.Commands.AddCommand(
                "Objects",
                false,
                "dump object id",
                "dump object id <UUID-or-localID>",
                "Dump the formatted serialization of the given object to the file <UUID>.xml",
                "e.g. dump object uuid c1ed6809-cc24-4061-a4c2-93082a2d1f1d will dump serialization to c1ed6809-cc24-4061-a4c2-93082a2d1f1d.xml\n"
                    + "To locate the UUID or localID in the first place, you need to use the other show object commands.\n"
                    + "If a local ID is given then the filename used is still that for the UUID",
                HandleDumpObjectById);
        }
Beispiel #59
0
        public static void RegisterHttpConsoleCommands(ICommandConsole console)
        {
            console.Commands.AddCommand(
                "Comms", false, "show http-handlers",
                "show http-handlers",
                "Show all registered http handlers", HandleShowHttpHandlersCommand);

            console.Commands.AddCommand(
                "Debug", false, "debug http", "debug http <in|out|all> [<level>]",
                "Turn on http request logging.",
                "If in or all and\n"
                    + "  level <= 0 then no extra logging is done.\n"
                    + "  level >= 1 then short warnings are logged when receiving bad input data.\n"
                    + "  level >= 2 then long warnings are logged when receiving bad input data.\n"
                    + "  level >= 3 then short notices about all incoming non-poll HTTP requests are logged.\n"
                    + "  level >= 4 then the time taken to fulfill the request is logged.\n"
                    + "  level >= 5 then a sample from the beginning of the incoming data is logged.\n"
                    + "  level >= 6 then the entire incoming data is logged.\n"
                    + "  no level is specified then the current level is returned.\n\n"
                    + "If out or all and\n"
                    + "  level >= 3 then short notices about all outgoing requests going through WebUtil are logged.\n"
                    + "  level >= 4 then the time taken to fulfill the request is logged.\n",
                HandleDebugHttpCommand);
        }