From 903cff9264ce405d00eab2739fcfb461749b4772 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 10 May 2012 23:47:39 +0100 Subject: Add ConsoleTable framework class for future uniform formatting of console output tables. Still subject to change - if you use this be prepared to change your output code if/when the methods change. Make new "attachments show" command use this. --- .../Avatar/Attachments/AttachmentsCommandModule.cs | 34 +++++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs index ce23613..a95514c 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs @@ -53,7 +53,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments private List m_scenes = new List(); // private IAvatarFactoryModule m_avatarFactory; - + public string Name { get { return "Attachments Command Module"; } } public Type ReplaceableInterface { get { return null; } } @@ -145,9 +145,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments { sb.AppendFormat("Attachments for {0}\n", sp.Name); - sb.AppendFormat( - " {0,-36} {1,-10} {2,-36} {3,-14} {4,-15}\n", - "Attachment Name", "Local ID", "Item ID", "Attach Point", "Position"); + ConsoleTable ct = new ConsoleTable() { Indent = 2 }; + ct.Columns.Add(new ConsoleTableColumn("Attachment Name", 36)); + ct.Columns.Add(new ConsoleTableColumn("Local ID", 10)); + ct.Columns.Add(new ConsoleTableColumn("Item ID", 36)); + ct.Columns.Add(new ConsoleTableColumn("Attach Point", 14)); + ct.Columns.Add(new ConsoleTableColumn("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 attachmentObjects = sp.GetAttachments(); foreach (SceneObjectGroup attachmentObject in attachmentObjects) @@ -164,13 +171,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments // } // 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); +// 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.Rows.Add( + new ConsoleTableRow( + new List() + { + attachmentObject.Name, + attachmentObject.LocalId.ToString(), + attachmentObject.FromItemID.ToString(), + ((AttachmentPoint)attachmentObject.AttachmentPoint).ToString(), + attachmentObject.RootPart.AttachedPos.ToString() + })); // } } + ct.AddToStringBuilder(sb); sb.Append("\n"); } } -- cgit v1.1