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.OutputFormat("Total: {0}", sensorInfo.Count);
        }
Пример #2
0
        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());
        }
Пример #3
0
        private void HandleShowBordersCommand(string module, string[] args)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("Borders for {0}:\n", m_scene.Name);

            ConsoleDisplayTable cdt = new ConsoleDisplayTable();
            cdt.AddColumn("Cross Direction", 15);
            cdt.AddColumn("Line", 34);
            cdt.AddColumn("Trigger Region", 14);

            foreach (Border b in m_scene.NorthBorders)
                cdt.AddRow(b.CrossDirection, b.BorderLine, string.Format("{0}, {1}", b.TriggerRegionX, b.TriggerRegionY));

            foreach (Border b in m_scene.EastBorders)
                cdt.AddRow(b.CrossDirection, b.BorderLine, string.Format("{0}, {1}", b.TriggerRegionX, b.TriggerRegionY));

            foreach (Border b in m_scene.SouthBorders)
                cdt.AddRow(b.CrossDirection, b.BorderLine, string.Format("{0}, {1}", b.TriggerRegionX, b.TriggerRegionY));

            foreach (Border b in m_scene.WestBorders)
                cdt.AddRow(b.CrossDirection, b.BorderLine, string.Format("{0}, {1}", b.TriggerRegionX, b.TriggerRegionY));

            cdt.AddToStringBuilder(sb);

            MainConsole.Instance.Output(sb.ToString());
        }
Пример #4
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());
        }
Пример #5
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());
        }
        private void GetAttachmentsReport(ScenePresence sp, StringBuilder sb)
        {
            sb.AppendFormat("Attachments for {0}\n", sp.Name);

            ConsoleDisplayTable ct = new ConsoleDisplayTable() { Indent = 2 };
            ct.Columns.Add(new ConsoleDisplayTableColumn("Attachment Name", 50));
            ct.Columns.Add(new ConsoleDisplayTableColumn("Local ID", 10));
            ct.Columns.Add(new ConsoleDisplayTableColumn("Item ID", 36));
            ct.Columns.Add(new ConsoleDisplayTableColumn("Attach Point", 14));
            ct.Columns.Add(new ConsoleDisplayTableColumn("Position", 15));

//            sb.AppendFormat(
//                "  {0,-36}  {1,-10}  {2,-36}  {3,-14}  {4,-15}\n",
//                "Attachment Name", "Local ID", "Item ID", "Attach Point", "Position");

            List<SceneObjectGroup> attachmentObjects = sp.GetAttachments();
            foreach (SceneObjectGroup attachmentObject in attachmentObjects)
            {
//                InventoryItemBase attachmentItem
//                    = m_scenes[0].InventoryService.GetItem(new InventoryItemBase(attachmentObject.FromItemID));

//                if (attachmentItem == null)
//                {
//                    sb.AppendFormat(
//                        "WARNING: Couldn't find attachment for item {0} at point {1}\n",
//                        attachmentData.ItemID, (AttachmentPoint)attachmentData.AttachPoint);
//                        continue;
//                }
//                else
//                {
//                    sb.AppendFormat(
//                        "  {0,-36}  {1,-10}  {2,-36}  {3,-14}  {4,-15}\n",
//                        attachmentObject.Name, attachmentObject.LocalId, attachmentObject.FromItemID,
//                        (AttachmentPoint)attachmentObject.AttachmentPoint, attachmentObject.RootPart.AttachedPos);

                    ct.AddRow(
                        attachmentObject.Name,
                        attachmentObject.LocalId,
                        attachmentObject.FromItemID,
                        ((AttachmentPoint)attachmentObject.AttachmentPoint),
                        attachmentObject.RootPart.AttachedPos);
//                }
            }

            ct.AddToStringBuilder(sb);
            sb.Append("\n");
        }
Пример #7
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",
                            Util.GetViewerName(aCircuit));
                });

            MainConsole.Instance.Output(cdt.ToString());
        }
Пример #8
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());
        }
        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();
        }
Пример #10
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());
        }
Пример #11
0
        private void HandleCheckWearablesCommand(string module, string[] cmd)
        {
            if (cmd.Length != 4)
            {
                MainConsole.Instance.OutputFormat("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);

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

                            if (aw.Count > 0)
                            {
                                sb.Append(Enum.GetName(typeof(WearableType), i));
                                sb.Append("\n");

                                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");
                                }
                            }
                        }
                    }
                }
            }

            MainConsole.Instance.Output(sb.ToString());
        }
Пример #12
0
        protected void HandleShowWearablesCommand(string module, string[] cmd)
        {
            if (cmd.Length != 2 && cmd.Length < 4)
            {
                MainConsole.Instance.OutputFormat("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 GetAttachmentsReport(ScenePresence sp, StringBuilder sb)
        {
            sb.AppendFormat("Animations for {0}\n", sp.Name);

            ConsoleDisplayList cdl = new ConsoleDisplayList() { Indent = 2 };
            ScenePresenceAnimator spa = sp.Animator;
            AnimationSet anims = sp.Animator.Animations;

            string cma = spa.CurrentMovementAnimation;
            cdl.AddRow(
                "Current movement anim", 
                string.Format("{0}, {1}", DefaultAvatarAnimations.GetDefaultAnimation(cma), cma));

            UUID defaultAnimId = anims.DefaultAnimation.AnimID;
            cdl.AddRow(
                "Default anim", 
                string.Format("{0}, {1}", defaultAnimId, sp.Animator.GetAnimName(defaultAnimId)));

            UUID implicitDefaultAnimId = anims.ImplicitDefaultAnimation.AnimID;
            cdl.AddRow(
                "Implicit default anim", 
                string.Format("{0}, {1}", 
                    implicitDefaultAnimId, sp.Animator.GetAnimName(implicitDefaultAnimId)));

            cdl.AddToStringBuilder(sb);

            ConsoleDisplayTable cdt = new ConsoleDisplayTable() { Indent = 2 };
            cdt.AddColumn("Animation ID", 36);
            cdt.AddColumn("Name", 20);
            cdt.AddColumn("Seq", 3);
            cdt.AddColumn("Object ID", 36);

            UUID[] animIds;
            int[] sequenceNumbers;
            UUID[] objectIds;

            sp.Animator.Animations.GetArrays(out animIds, out sequenceNumbers, out objectIds);

            for (int i = 0; i < animIds.Length; i++)
            {
                UUID animId = animIds[i];
                string animName = sp.Animator.GetAnimName(animId);
                int seq = sequenceNumbers[i];
                UUID objectId = objectIds[i];

                cdt.AddRow(animId, animName, seq, objectId);
            }

            cdt.AddToStringBuilder(sb);
            sb.Append("\n");
        }
Пример #14
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())
                cdt.AddRow(
                    item.Name,
                    ((InventoryType)item.InvType).ToString(),
                    (InventoryType)item.InvType == InventoryType.LSL ? item.ScriptRunning.ToString() : "n/a",
                    item.ItemID.ToString(),
                    item.AssetID.ToString());

            return sb.Append(cdt.ToString());
        }
Пример #15
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);
            cdt.AddColumn("ChildAgent?", 7);
            cdt.AddColumn("ping(ms)", 8);

            SceneManager.ForEachScene(
                s => s.ForEachClient(
                    c =>
                        {
                            bool child = false;
                            if(c.SceneAgent != null && c.SceneAgent.IsChildAgent)
                                child = true;
                            cdt.AddRow(
                            s.Name,
                            c.Name,
                            c.CircuitCode.ToString(),
                            c.RemoteEndPoint.ToString(),
                            c.IsActive.ToString(),
                            child.ToString(),
                            c.PingTimeMS);
                        }));

            MainConsole.Instance.Output(cdt.ToString());
        }
Пример #16
0
        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());
        }
Пример #17
0
        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());
        }
        private void AppendParcelsSummaryReport(StringBuilder report)
        {           
            report.AppendFormat("Land information for {0}\n", m_scene.Name);

            ConsoleDisplayTable cdt = new ConsoleDisplayTable();
            cdt.AddColumn("Parcel Name", ConsoleDisplayUtil.ParcelNameSize);
            cdt.AddColumn("ID", 3);
            cdt.AddColumn("Area", 6);
            cdt.AddColumn("Starts", ConsoleDisplayUtil.VectorSize);
            cdt.AddColumn("Ends", ConsoleDisplayUtil.VectorSize);
            cdt.AddColumn("Owner", ConsoleDisplayUtil.UserNameSize);
            
            lock (m_landList)
            {
                foreach (ILandObject lo in m_landList.Values)
                {
                    LandData ld = lo.LandData;
                    cdt.AddRow(
                        ld.Name, ld.LocalID, ld.Area, lo.StartPoint, lo.EndPoint, m_userManager.GetUserName(ld.OwnerID));
                }
            }

            report.Append(cdt.ToString());
        } 
Пример #19
0
        // see BaseOpenSimServer
        /// <summary>
        /// Many commands list objects for debugging.  Some of the types are listed  here
        /// </summary>
        /// <param name="mod"></param>
        /// <param name="cmd"></param>
        public override void HandleShow(string mod, string[] cmd)
        {
            base.HandleShow(mod, cmd);

            List<string> args = new List<string>(cmd);
            args.RemoveAt(0);
            string[] showParams = args.ToArray();

            switch (showParams[0])
            {
                case "users":
                    IList agents;
                    if (showParams.Length > 1 && showParams[1] == "full")
                    {
                        agents = SceneManager.GetCurrentScenePresences();
                    } else
                    {
                        agents = SceneManager.GetCurrentSceneAvatars();
                    }
                
                    MainConsole.Instance.Output(String.Format("\nAgents connected: {0}\n", agents.Count));

                    MainConsole.Instance.Output(
                        String.Format("{0,-16} {1,-16} {2,-37} {3,-11} {4,-16} {5,-30}", "Firstname", "Lastname",
                                      "Agent ID", "Root/Child", "Region", "Position")
                    );

                    foreach (ScenePresence presence in agents)
                    {
                        RegionInfo regionInfo = presence.Scene.RegionInfo;
                        string regionName;

                        if (regionInfo == null)
                        {
                            regionName = "Unresolvable";
                        } else
                        {
                            regionName = regionInfo.RegionName;
                        }

                        MainConsole.Instance.Output(
                            String.Format(
                                "{0,-16} {1,-16} {2,-37} {3,-11} {4,-16} {5,-30}",
                                presence.Firstname,
                                presence.Lastname,
                                presence.UUID,
                                presence.IsChildAgent ? "Child" : "Root",
                                regionName,
                                presence.AbsolutePosition.ToString())
                        );
                    }

                    MainConsole.Instance.Output(String.Empty);
                    break;

                case "connections":
                    HandleShowConnections();
                    break;

                case "circuits":
                    HandleShowCircuits();
                    break;

                case "modules":
                    SceneManager.ForEachSelectedScene(
                        scene => 
                        {
                            MainConsole.Instance.OutputFormat("Loaded region modules in {0} are:", scene.Name);

                            List<IRegionModuleBase> sharedModules = new List<IRegionModuleBase>();
                            List<IRegionModuleBase> nonSharedModules = new List<IRegionModuleBase>();

                            foreach (IRegionModuleBase module in scene.RegionModules.Values)
                            {
                                if (module.GetType().GetInterface("ISharedRegionModule") == null)
                                    nonSharedModules.Add(module);
                                else
                                    sharedModules.Add(module);
                            }

                            foreach (IRegionModuleBase module in sharedModules.OrderBy(m => m.Name))
                                MainConsole.Instance.OutputFormat("New Region Module (Shared): {0}", module.Name);

                            foreach (IRegionModuleBase module in nonSharedModules.OrderBy(m => m.Name))
                                MainConsole.Instance.OutputFormat("New Region Module (Non-Shared): {0}", module.Name);
                        }
                    );

                    MainConsole.Instance.Output("");
                    break;

                case "regions":
                    ConsoleDisplayTable cdt = new ConsoleDisplayTable();
                    cdt.AddColumn("Name", ConsoleDisplayUtil.RegionNameSize);
                    cdt.AddColumn("ID", ConsoleDisplayUtil.UuidSize);
                    cdt.AddColumn("Position", ConsoleDisplayUtil.CoordTupleSize);
                    cdt.AddColumn("Port", ConsoleDisplayUtil.PortSize);
                    cdt.AddColumn("Ready?", 6);
                    cdt.AddColumn("Estate", ConsoleDisplayUtil.EstateNameSize);
                    SceneManager.ForEachScene(
                        scene => 
                        { 
                            RegionInfo ri = scene.RegionInfo; 
                            cdt.AddRow(
                                ri.RegionName, ri.RegionID, string.Format("{0},{1}", ri.RegionLocX, ri.RegionLocY), 
                                ri.InternalEndPoint.Port, scene.Ready ? "Yes" : "No", ri.EstateSettings.EstateName);
                        }
                    );

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

                case "ratings":
                    SceneManager.ForEachScene(
                    delegate(Scene scene)
                    {
                        string rating = "";
                        if (scene.RegionInfo.RegionSettings.Maturity == 1)
                        {
                            rating = "MATURE";
                        }
                        else if (scene.RegionInfo.RegionSettings.Maturity == 2)
                        {
                            rating = "ADULT";
                        }
                        else
                        {
                            rating = "PG";
                        }
                        MainConsole.Instance.Output(String.Format(
                                   "Region Name: {0}, Region Rating {1}",
                                   scene.RegionInfo.RegionName,
                                   rating));
                    });
                    break;
            }
        }
        private void HandleShowTimers(string module, string[] cmdparams)
        {
            if (!IsSceneSelected())
                return;

            Timer timerPlugin = AsyncCommandManager.GetTimerPlugin(m_engine);

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

            List<Timer.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 (Timer.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.OutputFormat("Total: {0}", timersInfo.Count);
        }
        private void AppendParcelsSummaryReport(StringBuilder report)
        {           
            report.AppendFormat("Land information for {0}\n", m_scene.Name);

            ConsoleDisplayTable cdt = new ConsoleDisplayTable();
            cdt.AddColumn("Parcel Name", ConsoleDisplayUtil.ParcelNameSize);
            cdt.AddColumn("ID", 3);
            cdt.AddColumn("Area", 6);
            cdt.AddColumn("Starts", ConsoleDisplayUtil.VectorSize);
            cdt.AddColumn("Ends", ConsoleDisplayUtil.VectorSize);
            cdt.AddColumn("Owner", ConsoleDisplayUtil.UserNameSize);
            
            lock (m_landList)
            {
                foreach (ILandObject lo in m_landList.Values)
                {
                    LandData ld = lo.LandData;
                    string ownerName;
                    if (ld.IsGroupOwned)
                    {
                        GroupRecord rec = m_groupManager.GetGroupRecord(ld.GroupID);
                        ownerName = (rec != null) ? rec.GroupName : "Unknown Group";
                    }
                    else
                    {
                        ownerName = m_userManager.GetUserName(ld.OwnerID);
                    }
                    cdt.AddRow(
                        ld.Name, ld.LocalID, ld.Area, lo.StartPoint, lo.EndPoint, ownerName);
                }
            }

            report.Append(cdt.ToString());
        } 
Пример #22
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());
        }
Пример #23
0
        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;

            string[] names;

            UserData ud;

            lock (m_UserCache)
            {
                if (!m_UserCache.TryGetValue(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());
        }
Пример #24
0
        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);

            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());
        }
Пример #25
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.Data.RegionFlags flags = (OpenSim.Data.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());
        }
Пример #26
0
        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());
        }
Пример #27
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());
        }
        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());
        }