protected virtual void HandleShowUsers(string module, string[] cmd)
        {
            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            cdt.AddColumn("UUID", 36);
            cdt.AddColumn("Name", 60);
            cdt.AddColumn("HomeURL", 40);
            cdt.AddColumn("Checked", 10);

            Dictionary <UUID, UserData> copyDict;

            lock (m_UserCache)
            {
                copyDict = new Dictionary <UUID, UserData>(m_UserCache);
            }

            foreach (KeyValuePair <UUID, UserData> kvp in copyDict)
            {
                string name = string.Empty;

                if (!string.IsNullOrWhiteSpace(kvp.Value.DisplayName))
                {
                    name = string.Format("{0} ({1})", kvp.Value.DisplayName, string.Format("{0}.{1}", kvp.Value.FirstName, kvp.Value.LastName).ToLower());
                }
                else
                {
                    name = string.Format("{0} {1}", kvp.Value.FirstName, kvp.Value.LastName);
                }

                cdt.AddRow(kvp.Key, name, kvp.Value.HomeURL, kvp.Value.HasGridUserTried ? "yes" : "no");
            }

            MainConsole.Instance.Output(cdt.ToString());
        }
Пример #2
0
        private void HandleShowCircuits()
        {
            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            cdt.AddColumn("Region", 20);
            cdt.AddColumn("Avatar name", 24);
            cdt.AddColumn("Type", 5);
            cdt.AddColumn("Code", 10);
            cdt.AddColumn("IP", 16);
            cdt.AddColumn("Viewer Name", 24);

            SceneManager.ForEachScene(
                s =>
            {
                foreach (AgentCircuitData aCircuit in s.AuthenticateHandler.GetAgentCircuits().Values)
                {
                    cdt.AddRow(
                        s.Name,
                        aCircuit.Name,
                        aCircuit.child ? "child" : "root",
                        aCircuit.circuitcode.ToString(),
                        aCircuit.IPAddress != null ? aCircuit.IPAddress.ToString() : "not set",
                        aCircuit.Viewer);
                }
            });

            MainConsole.Instance.Output(cdt.ToString());
        }
Пример #3
0
        protected virtual void HandleShowUser(string module, string[] cmd)
        {
            if (cmd.Length < 3)
            {
                MainConsole.Instance.OutputFormat("Usage: show name <uuid>");
                return;
            }

            UUID userId;

            if (!ConsoleUtil.TryParseConsoleUuid(MainConsole.Instance, cmd[2], out userId))
            {
                return;
            }

            UserData ud;

            if (!GetUser(userId, out ud))
            {
                MainConsole.Instance.OutputFormat("No name known for user with id {0}", userId);
                return;
            }

            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            cdt.AddColumn("UUID", 36);
            cdt.AddColumn("Name", 30);
            cdt.AddColumn("HomeURL", 40);
            cdt.AddRow(userId, string.Format("{0} {1}", ud.FirstName, ud.LastName), ud.HomeURL);

            MainConsole.Instance.Output(cdt.ToString());
        }
Пример #4
0
        private StringBuilder AddScenePartItemsReport(StringBuilder sb, IEntityInventory inv)
        {
            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            cdt.Indent = 2;

            cdt.AddColumn("Name", 50);
            cdt.AddColumn("Type", 12);
            cdt.AddColumn("Running", 7);
            cdt.AddColumn("Item UUID", 36);
            cdt.AddColumn("Asset UUID", 36);

            foreach (TaskInventoryItem item in inv.GetInventoryItems())
            {
                bool foundScriptInstance, scriptRunning;
                foundScriptInstance
                    = SceneObjectPartInventory.TryGetScriptInstanceRunning(m_scene, item, out scriptRunning);

                cdt.AddRow(
                    item.Name,
                    ((InventoryType)item.InvType).ToString(),
                    foundScriptInstance ? scriptRunning.ToString() : "n/a",
                    item.ItemID.ToString(),
                    item.AssetID.ToString());
            }

            return(sb.Append(cdt.ToString()));
        }
Пример #5
0
        /// -----------------------------------------------------------------
        /// <summary>
        /// </summary>
        /// -----------------------------------------------------------------
        private void HandleShowCapabilities(string module, string[] cmd)
        {
            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            cdt.Indent = 2;
            cdt.AddColumn("Capability", 36);
            cdt.AddColumn("Expiration", 15);
            cdt.AddColumn("User Name", 30);
            cdt.AddColumn("Scene", 30);
            cdt.AddColumn("Domains", 50);

            int now = Util.EnvironmentTickCount();

            List <CapabilityInfo> caps = m_capCache.DumpCapabilities();

            foreach (CapabilityInfo cap in caps)
            {
                int    span = (cap.LifeSpan - Util.EnvironmentTickCountSubtract(now, cap.LastRefresh)) / 1000;
                string name = cap.Account.FirstName + ' ' + cap.Account.LastName;
                string time = DateTime.Now.AddSeconds(span).ToLongTimeString();

                string doms = "";
                foreach (string s in cap.DomainList)
                {
                    doms += s + ",";
                }

                cdt.AddRow(cap.Capability.ToString(), time, name, cap.SceneName, doms);
            }

            m_console.OutputFormat(cdt.ToString());
        }
Пример #6
0
        private void HandleShowSensors(string module, string[] cmdparams)
        {
            if (!IsSceneSelected())
            {
                return;
            }

            SensorRepeat sr = AsyncCommandManager.GetSensorRepeatPlugin(m_engine);

            if (sr == null)
            {
                MainConsole.Instance.Output("Plugin not yet initialized");
                return;
            }

            List <SensorRepeat.SensorInfo> sensorInfo = sr.GetSensorInfo();

            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            cdt.AddColumn("Part name", 40);
            cdt.AddColumn("Script item ID", 36);
            cdt.AddColumn("Type", 4);
            cdt.AddColumn("Interval", 8);
            cdt.AddColumn("Range", 8);
            cdt.AddColumn("Arc", 8);

            foreach (SensorRepeat.SensorInfo s in sensorInfo)
            {
                cdt.AddRow(s.host.Name, s.itemID, s.type, s.interval, s.range, s.arc);
            }

            MainConsole.Instance.Output(cdt.ToString());
            MainConsole.Instance.Output("Total: {0}", sensorInfo.Count);
        }
Пример #7
0
        private void HandleShowTimers(string module, string[] cmdparams)
        {
            if (!IsSceneSelected())
            {
                return;
            }

            ScriptTimer timerPlugin = AsyncCommandManager.GetTimerPlugin(m_engine);

            if (timerPlugin == null)
            {
                MainConsole.Instance.Output("Plugin not yet initialized");
                return;
            }

            List <ScriptTimer.TimerInfo> timersInfo = timerPlugin.GetTimersInfo();

            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            cdt.AddColumn("Part local ID", 13);
            cdt.AddColumn("Script item ID", 36);
            cdt.AddColumn("Interval", 10);
            cdt.AddColumn("Next", 8);

            foreach (ScriptTimer.TimerInfo t in timersInfo)
            {
                // Convert from 100 ns ticks back to seconds
                cdt.AddRow(t.localID, t.itemID, (double)t.interval / 10000000, t.next);
            }

            MainConsole.Instance.Output(cdt.ToString());
            MainConsole.Instance.Output("Total: {0}", timersInfo.Count);
        }
        private void BuildDetailedStatsByCapReport(StringBuilder sb, string capName)
        {
            sb.AppendFormat("Capability name {0}\n", capName);

            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            cdt.AddColumn("User Name", 34);
            cdt.AddColumn("Req Received", 12);
            cdt.AddColumn("Req Handled", 12);
            cdt.Indent = 2;

            Dictionary <string, int> receivedStats = new Dictionary <string, int>();
            Dictionary <string, int> handledStats  = new Dictionary <string, int>();

            m_scene.ForEachScenePresence(
                sp =>
            {
                Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);

                if (caps == null)
                {
                    return;
                }

                Dictionary <string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers();

                IRequestHandler reqHandler;
                if (capsHandlers.TryGetValue(capName, out reqHandler))
                {
                    receivedStats[sp.Name] = reqHandler.RequestsReceived;
                    handledStats[sp.Name]  = reqHandler.RequestsHandled;
                }
                else
                {
                    PollServiceEventArgs pollHandler = null;
                    if (caps.TryGetPollHandler(capName, out pollHandler))
                    {
                        receivedStats[sp.Name] = pollHandler.RequestsReceived;
                        handledStats[sp.Name]  = pollHandler.RequestsHandled;
                    }
                }
            }
                );

            foreach (KeyValuePair <string, int> kvp in receivedStats.OrderByDescending(kp => kp.Value))
            {
                cdt.AddRow(kvp.Key, kvp.Value, handledStats[kvp.Key]);
            }

            sb.Append(cdt.ToString());
        }
        private void HandleShowUsers(string module, string[] cmd)
        {
            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            cdt.AddColumn("UUID", 36);
            cdt.AddColumn("Name", 30);
            cdt.AddColumn("HomeURL", 40);
            cdt.AddColumn("Checked", 10);

            m_UserCache.ForEach(delegate(KeyValuePair <UUID, UserData> kvp)
            {
                cdt.AddRow(kvp.Key, string.Format("{0} {1}", kvp.Value.FirstName, kvp.Value.LastName), kvp.Value.HomeURL, kvp.Value.HasGridUserTried ? "yes" : "no");
            });

            MainConsole.Instance.Output(cdt.ToString());
        }
        private void BuildSummaryStatsByUserReport(StringBuilder sb)
        {
            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            cdt.AddColumn("Name", 32);
            cdt.AddColumn("Type", 5);
            cdt.AddColumn("Req Received", 12);
            cdt.AddColumn("Req Handled", 12);
            cdt.Indent = 2;

            m_scene.ForEachScenePresence(
                sp =>
            {
                Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);

                if (caps == null)
                {
                    return;
                }

                Dictionary <string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers();

                int totalRequestsReceived = 0;
                int totalRequestsHandled  = 0;

                foreach (IRequestHandler reqHandler in capsHandlers.Values)
                {
                    totalRequestsReceived += reqHandler.RequestsReceived;
                    totalRequestsHandled  += reqHandler.RequestsHandled;
                }

                Dictionary <string, PollServiceEventArgs> capsPollHandlers = caps.GetPollHandlers();

                foreach (PollServiceEventArgs handler in capsPollHandlers.Values)
                {
                    totalRequestsReceived += handler.RequestsReceived;
                    totalRequestsHandled  += handler.RequestsHandled;
                }

                cdt.AddRow(sp.Name, sp.IsChildAgent ? "child" : "root", totalRequestsReceived, totalRequestsHandled);
            }
                );

            sb.Append(cdt.ToString());
        }
Пример #11
0
        private void HandleShowUsers(string module, string[] cmd)
        {
            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            cdt.AddColumn("UUID", 36);
            cdt.AddColumn("Name", 30);
            cdt.AddColumn("HomeURL", 40);

            lock (m_UserCache)
            {
                foreach (KeyValuePair <UUID, UserData> kvp in m_UserCache)
                {
                    cdt.AddRow(kvp.Key, string.Format("{0} {1}", kvp.Value.FirstName, kvp.Value.LastName), kvp.Value.HomeURL);
                }
            }

            MainConsole.Instance.Output(cdt.ToString());
        }
Пример #12
0
        private void HandleShowBotsStatus(string module, string[] cmd)
        {
            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            cdt.AddColumn("Name", 24);
            cdt.AddColumn("Region", 24);
            cdt.AddColumn("Status", 13);
            cdt.AddColumn("Conns", 5);
            cdt.AddColumn("Behaviours", 20);

            Dictionary <ConnectionState, int> totals = new Dictionary <ConnectionState, int>();

            foreach (object o in Enum.GetValues(typeof(ConnectionState)))
            {
                totals[(ConnectionState)o] = 0;
            }

            lock (m_bots)
            {
                foreach (Bot bot in m_bots)
                {
                    Simulator currentSim = bot.Client.Network.CurrentSim;
                    totals[bot.ConnectionState]++;

                    cdt.AddRow(
                        bot.Name,
                        currentSim != null ? currentSim.Name : "(none)",
                        bot.ConnectionState,
                        bot.SimulatorsCount,
                        string.Join(",", bot.Behaviours.Keys.ToArray()));
                }
            }

            MainConsole.Instance.Output(cdt.ToString());

            ConsoleDisplayList cdl = new ConsoleDisplayList();

            foreach (KeyValuePair <ConnectionState, int> kvp in totals)
            {
                cdl.AddRow(kvp.Key, kvp.Value);
            }

            MainConsole.Instance.Output(cdl.ToString());
        }
Пример #13
0
        private void HandleShowConnections()
        {
            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            cdt.AddColumn("Region", 20);
            cdt.AddColumn("Avatar name", 24);
            cdt.AddColumn("Circuit code", 12);
            cdt.AddColumn("Endpoint", 23);
            cdt.AddColumn("Active?", 7);

            SceneManager.ForEachScene(
                s => s.ForEachClient(
                    c => cdt.AddRow(
                        s.Name,
                        c.Name,
                        c.CircuitCode.ToString(),
                        c.RemoteEndPoint.ToString(),
                        c.IsActive.ToString())));

            MainConsole.Instance.Output(cdt.ToString());
        }
        private void HandleShowUser(string module, string[] cmd)
        {
            if (cmd.Length < 3)
            {
                MainConsole.Instance.OutputFormat("Usage: show name <uuid>");
                return;
            }

            UUID userId;

            if (!ConsoleUtil.TryParseConsoleUuid(MainConsole.Instance, cmd[2], out userId))
            {
                return;
            }

            UserData ud;

            m_UserCacheRwLock.AcquireReaderLock(-1);
            try
            {
                if (!m_UserCache.TryGetValue(userId, out ud))
                {
                    MainConsole.Instance.OutputFormat("No name known for user with id {0}", userId);
                    return;
                }
            }
            finally
            {
                m_UserCacheRwLock.ReleaseReaderLock();
            }

            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            cdt.AddColumn("UUID", 36);
            cdt.AddColumn("Name", 30);
            cdt.AddColumn("HomeURL", 40);
            cdt.AddRow(userId, string.Format("{0} {1}", ud.FirstName, ud.LastName), ud.HomeURL);

            MainConsole.Instance.Output(cdt.ToString());
        }
Пример #15
0
        private void AppendWearablesDetailReport(ScenePresence sp, StringBuilder sb)
        {
            sb.AppendFormat("\nWearables for {0}\n", sp.Name);

            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            cdt.AddColumn("Type", 10);
            cdt.AddColumn("Item UUID", ConsoleDisplayUtil.UuidSize);
            cdt.AddColumn("Asset UUID", ConsoleDisplayUtil.UuidSize);

            for (int i = (int)WearableType.Shape; i < (int)WearableType.Physics; i++)
            {
                AvatarWearable aw = sp.Appearance.Wearables[i];

                for (int j = 0; j < aw.Count; j++)
                {
                    WearableItem wi = aw[j];
                    cdt.AddRow(Enum.GetName(typeof(WearableType), i), wi.ItemID, wi.AssetID);
                }
            }

            sb.Append(cdt.ToString());
        }
Пример #16
0
        protected virtual void HandleShowUsers(string module, string[] cmd)
        {
            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            cdt.AddColumn("UUID", 36);
            cdt.AddColumn("Name", 30);
            cdt.AddColumn("HomeURL", 40);
            cdt.AddColumn("Checked", 10);

            Dictionary <UUID, UserData> copyDict;

            lock (m_UserCache)
            {
                copyDict = new Dictionary <UUID, UserData>(m_UserCache);
            }

            foreach (KeyValuePair <UUID, UserData> kvp in copyDict)
            {
                cdt.AddRow(kvp.Key, string.Format("{0} {1}", kvp.Value.FirstName, kvp.Value.LastName), kvp.Value.HomeURL, kvp.Value.HasGridUserTried ? "yes" : "no");
            }

            MainConsole.Instance.Output(cdt.ToString());
        }
Пример #17
0
        private void OutputRegionsToConsoleSummary(List <RegionData> regions)
        {
            ConsoleDisplayTable dispTable = new ConsoleDisplayTable();

            dispTable.AddColumn("Name", 16);
            dispTable.AddColumn("ID", 36);
            dispTable.AddColumn("Position", 11);
            dispTable.AddColumn("Owner ID", 36);
            dispTable.AddColumn("Flags", 60);

            foreach (RegionData r in regions)
            {
                OpenSim.Framework.RegionFlags flags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(r.Data["flags"]);
                dispTable.AddRow(
                    r.RegionName,
                    r.RegionID.ToString(),
                    string.Format("{0},{1}", r.coordX, r.coordY),
                    r.Data["owner_uuid"].ToString(),
                    flags.ToString());
            }

            MainConsole.Instance.Output(dispTable.ToString());
        }
        private void BuildDetailedStatsByUserReport(StringBuilder sb, ScenePresence sp)
        {
            sb.AppendFormat("Avatar name {0}, type {1}\n", sp.Name, sp.IsChildAgent ? "child" : "root");

            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            cdt.AddColumn("Cap Name", 34);
            cdt.AddColumn("Req Received", 12);
            cdt.AddColumn("Req Handled", 12);
            cdt.Indent = 2;

            Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);

            if (caps == null)
            {
                return;
            }

            List <CapTableRow> capRows = new List <CapTableRow>();

            foreach (IRequestHandler reqHandler in caps.CapsHandlers.GetCapsHandlers().Values)
            {
                capRows.Add(new CapTableRow(reqHandler.Name, reqHandler.RequestsReceived, reqHandler.RequestsHandled));
            }

            foreach (KeyValuePair <string, PollServiceEventArgs> kvp in caps.GetPollHandlers())
            {
                capRows.Add(new CapTableRow(kvp.Key, kvp.Value.RequestsReceived, kvp.Value.RequestsHandled));
            }

            foreach (CapTableRow ctr in capRows.OrderByDescending(ctr => ctr.RequestsReceived))
            {
                cdt.AddRow(ctr.Name, ctr.RequestsReceived, ctr.RequestsHandled);
            }

            sb.Append(cdt.ToString());
        }
Пример #19
0
        public override string ToConsoleString()
        {
            // Message types that are not reported. There should be only one of these messages anyway.
            string leaveOutMsgs = "GetObjec,GetPrese,GetTerra,Terrain,GetRegio,RegionIn,";
            // Remembers the name of the actor on the other side of a connector
            Dictionary <string, string> otherActor = new Dictionary <string, string>();

            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            SortedDictionary <string, SortedDictionary <string, Stat> > DSGStats;

            if (StatsManager.TryGetStatsForCategory(SyncStatisticCollector.DSGDetailCategory, out DSGStats))
            {
                // Find all the column names
                Dictionary <string, int> cols = new Dictionary <string, int>();
                int maxColumn = 2;  // two extra columns at beginning
                foreach (string container in DSGStats.Keys)
                {
                    foreach (KeyValuePair <string, Stat> aStat in DSGStats[container])
                    {
                        string colName = ExtractColumnNameFromStatShortname(aStat.Value.ShortName);
                        if (!leaveOutMsgs.Contains(colName + ",") && !cols.ContainsKey(colName))
                        {
                            cols.Add(colName, maxColumn++);
                        }
                        if (!otherActor.ContainsKey(container))
                        {
                            SyncConnectorStat conStat = aStat.Value as SyncConnectorStat;
                            if (conStat != null)
                            {
                                otherActor[container] = conStat.OtherSideActorID;
                            }
                        }
                    }
                }

                // Add all the columns to the table
                cdt.AddColumn("Connection", 22);
                cdt.AddColumn("OtherActor", 10);
                foreach (KeyValuePair <string, int> kvp in cols)
                {
                    cdt.AddColumn(kvp.Key, 8);
                }

                // Add a row for each of the containers
                foreach (string container in DSGStats.Keys)
                {
                    string[] values = new string[maxColumn];
                    values.Initialize();

                    values[0] = container;
                    if (otherActor.ContainsKey(container))
                    {
                        values[1] = otherActor[container];
                    }

                    foreach (KeyValuePair <string, Stat> aStat in DSGStats[container])
                    {
                        string colName = ExtractColumnNameFromStatShortname(aStat.Value.ShortName);
                        if (cols.ContainsKey(colName))
                        {
                            values[cols[colName]] = aStat.Value.Value.ToString();
                        }
                    }

                    cdt.AddRow(values);
                }
            }
            return(cdt.ToString());
        }
Пример #20
0
        private void HandleCheckWearablesCommand(string module, string[] cmd)
        {
            if (cmd.Length != 4)
            {
                MainConsole.Instance.Output("Usage: wearables check <first-name> <last-name>");
                return;
            }

            string firstname = cmd[2];
            string lastname  = cmd[3];

            StringBuilder sb           = new StringBuilder();
            UuidGatherer  uuidGatherer = new UuidGatherer(m_scenes[0].AssetService);

            lock (m_scenes)
            {
                foreach (Scene scene in m_scenes)
                {
                    ScenePresence sp = scene.GetScenePresence(firstname, lastname);
                    if (sp != null && !sp.IsChildAgent)
                    {
                        sb.AppendFormat("Wearables checks for {0}\n\n", sp.Name);

                        AvatarWearable[] wearables = sp.Appearance.Wearables;
                        if (wearables.Length == 0)
                        {
                            MainConsole.Instance.Output("avatar has no wearables");
                            return;
                        }

                        for (int i = 0; i < wearables.Length; i++)
                        {
                            AvatarWearable aw = wearables[i];

                            sb.Append(Enum.GetName(typeof(WearableType), i));
                            sb.Append("\n");
                            if (aw.Count > 0)
                            {
                                for (int j = 0; j < aw.Count; j++)
                                {
                                    WearableItem wi = aw[j];

                                    ConsoleDisplayList cdl = new ConsoleDisplayList();
                                    cdl.Indent = 2;
                                    cdl.AddRow("Item UUID", wi.ItemID);
                                    cdl.AddRow("Assets", "");
                                    sb.Append(cdl.ToString());

                                    uuidGatherer.AddForInspection(wi.AssetID);
                                    uuidGatherer.GatherAll();
                                    string[] assetStrings
                                        = Array.ConvertAll <UUID, string>(uuidGatherer.GatheredUuids.Keys.ToArray(), u => u.ToString());

                                    bool[] existChecks = scene.AssetService.AssetsExist(assetStrings);

                                    ConsoleDisplayTable cdt = new ConsoleDisplayTable();
                                    cdt.Indent = 4;
                                    cdt.AddColumn("Type", 10);
                                    cdt.AddColumn("UUID", ConsoleDisplayUtil.UuidSize);
                                    cdt.AddColumn("Found", 5);

                                    for (int k = 0; k < existChecks.Length; k++)
                                    {
                                        cdt.AddRow(
                                            (AssetType)uuidGatherer.GatheredUuids[new UUID(assetStrings[k])],
                                            assetStrings[k], existChecks[k] ? "yes" : "no");
                                    }

                                    sb.Append(cdt.ToString());
                                    sb.Append("\n");
                                }
                            }
                            else
                            {
                                sb.Append("  Empty\n");
                            }
                        }
                    }
                }
            }

            MainConsole.Instance.Output(sb.ToString());
        }
Пример #21
0
        protected void HandleShowWearablesCommand(string module, string[] cmd)
        {
            if (cmd.Length != 2 && cmd.Length < 4)
            {
                MainConsole.Instance.Output("Usage: wearables show [<first-name> <last-name>]");
                return;
            }

            bool   targetNameSupplied      = false;
            string optionalTargetFirstName = null;
            string optionalTargetLastName  = null;

            if (cmd.Length >= 4)
            {
                targetNameSupplied      = true;
                optionalTargetFirstName = cmd[2];
                optionalTargetLastName  = cmd[3];
            }

            StringBuilder sb = new StringBuilder();

            if (targetNameSupplied)
            {
                lock (m_scenes)
                {
                    foreach (Scene scene in m_scenes)
                    {
                        ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName);
                        if (sp != null && !sp.IsChildAgent)
                        {
                            AppendWearablesDetailReport(sp, sb);
                        }
                    }
                }
            }
            else
            {
                ConsoleDisplayTable cdt = new ConsoleDisplayTable();
                cdt.AddColumn("Name", ConsoleDisplayUtil.UserNameSize);
                cdt.AddColumn("Wearables", 2);

                lock (m_scenes)
                {
                    foreach (Scene scene in m_scenes)
                    {
                        scene.ForEachRootScenePresence(
                            sp =>
                        {
                            int count = 0;

                            for (int i = (int)WearableType.Shape; i < (int)WearableType.Physics; i++)
                            {
                                count += sp.Appearance.Wearables[i].Count;
                            }

                            cdt.AddRow(sp.Name, count);
                        }
                            );
                    }
                }

                sb.Append(cdt.ToString());
            }

            MainConsole.Instance.Output(sb.ToString());
        }
        private void BuildSummaryStatsByCapReport(StringBuilder sb)
        {
            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            cdt.AddColumn("Name", 34);
            cdt.AddColumn("Req Received", 12);
            cdt.AddColumn("Req Handled", 12);
            cdt.Indent = 2;

            Dictionary <string, int> receivedStats = new Dictionary <string, int>();
            Dictionary <string, int> handledStats  = new Dictionary <string, int>();

            m_scene.ForEachScenePresence(
                sp =>
            {
                Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);

                if (caps == null)
                {
                    return;
                }

                foreach (IRequestHandler reqHandler in caps.CapsHandlers.GetCapsHandlers().Values)
                {
                    string reqName = reqHandler.Name ?? "";

                    if (!receivedStats.ContainsKey(reqName))
                    {
                        receivedStats[reqName] = reqHandler.RequestsReceived;
                        handledStats[reqName]  = reqHandler.RequestsHandled;
                    }
                    else
                    {
                        receivedStats[reqName] += reqHandler.RequestsReceived;
                        handledStats[reqName]  += reqHandler.RequestsHandled;
                    }
                }

                foreach (KeyValuePair <string, PollServiceEventArgs> kvp in caps.GetPollHandlers())
                {
                    string name = kvp.Key;
                    PollServiceEventArgs pollHandler = kvp.Value;

                    if (!receivedStats.ContainsKey(name))
                    {
                        receivedStats[name] = pollHandler.RequestsReceived;
                        handledStats[name]  = pollHandler.RequestsHandled;
                    }
                    else
                    {
                        receivedStats[name] += pollHandler.RequestsReceived;
                        handledStats[name]  += pollHandler.RequestsHandled;
                    }
                }
            }
                );

            foreach (KeyValuePair <string, int> kvp in receivedStats.OrderByDescending(kp => kp.Value))
            {
                cdt.AddRow(kvp.Key, kvp.Value, handledStats[kvp.Key]);
            }

            sb.Append(cdt.ToString());
        }