diff options
author | Justin Clark-Casey (justincc) | 2012-05-10 23:47:39 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-05-10 23:47:39 +0100 |
commit | 903cff9264ce405d00eab2739fcfb461749b4772 (patch) | |
tree | 6ae0a9ade5785470b67a5cadd40d2c034fdea13d /OpenSim/Region | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-903cff9264ce405d00eab2739fcfb461749b4772.zip opensim-SC_OLD-903cff9264ce405d00eab2739fcfb461749b4772.tar.gz opensim-SC_OLD-903cff9264ce405d00eab2739fcfb461749b4772.tar.bz2 opensim-SC_OLD-903cff9264ce405d00eab2739fcfb461749b4772.tar.xz |
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.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs | 34 |
1 files changed, 26 insertions, 8 deletions
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 | |||
53 | 53 | ||
54 | private List<Scene> m_scenes = new List<Scene>(); | 54 | private List<Scene> m_scenes = new List<Scene>(); |
55 | // private IAvatarFactoryModule m_avatarFactory; | 55 | // private IAvatarFactoryModule m_avatarFactory; |
56 | 56 | ||
57 | public string Name { get { return "Attachments Command Module"; } } | 57 | public string Name { get { return "Attachments Command Module"; } } |
58 | 58 | ||
59 | public Type ReplaceableInterface { get { return null; } } | 59 | public Type ReplaceableInterface { get { return null; } } |
@@ -145,9 +145,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments | |||
145 | { | 145 | { |
146 | sb.AppendFormat("Attachments for {0}\n", sp.Name); | 146 | sb.AppendFormat("Attachments for {0}\n", sp.Name); |
147 | 147 | ||
148 | sb.AppendFormat( | 148 | ConsoleTable ct = new ConsoleTable() { Indent = 2 }; |
149 | " {0,-36} {1,-10} {2,-36} {3,-14} {4,-15}\n", | 149 | ct.Columns.Add(new ConsoleTableColumn("Attachment Name", 36)); |
150 | "Attachment Name", "Local ID", "Item ID", "Attach Point", "Position"); | 150 | ct.Columns.Add(new ConsoleTableColumn("Local ID", 10)); |
151 | ct.Columns.Add(new ConsoleTableColumn("Item ID", 36)); | ||
152 | ct.Columns.Add(new ConsoleTableColumn("Attach Point", 14)); | ||
153 | ct.Columns.Add(new ConsoleTableColumn("Position", 15)); | ||
154 | |||
155 | // sb.AppendFormat( | ||
156 | // " {0,-36} {1,-10} {2,-36} {3,-14} {4,-15}\n", | ||
157 | // "Attachment Name", "Local ID", "Item ID", "Attach Point", "Position"); | ||
151 | 158 | ||
152 | List<SceneObjectGroup> attachmentObjects = sp.GetAttachments(); | 159 | List<SceneObjectGroup> attachmentObjects = sp.GetAttachments(); |
153 | foreach (SceneObjectGroup attachmentObject in attachmentObjects) | 160 | foreach (SceneObjectGroup attachmentObject in attachmentObjects) |
@@ -164,13 +171,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments | |||
164 | // } | 171 | // } |
165 | // else | 172 | // else |
166 | // { | 173 | // { |
167 | sb.AppendFormat( | 174 | // sb.AppendFormat( |
168 | " {0,-36} {1,-10} {2,-36} {3,-14} {4,-15}\n", | 175 | // " {0,-36} {1,-10} {2,-36} {3,-14} {4,-15}\n", |
169 | attachmentObject.Name, attachmentObject.LocalId, attachmentObject.FromItemID, | 176 | // attachmentObject.Name, attachmentObject.LocalId, attachmentObject.FromItemID, |
170 | (AttachmentPoint)attachmentObject.AttachmentPoint, attachmentObject.RootPart.AttachedPos); | 177 | // (AttachmentPoint)attachmentObject.AttachmentPoint, attachmentObject.RootPart.AttachedPos); |
178 | ct.Rows.Add( | ||
179 | new ConsoleTableRow( | ||
180 | new List<string>() | ||
181 | { | ||
182 | attachmentObject.Name, | ||
183 | attachmentObject.LocalId.ToString(), | ||
184 | attachmentObject.FromItemID.ToString(), | ||
185 | ((AttachmentPoint)attachmentObject.AttachmentPoint).ToString(), | ||
186 | attachmentObject.RootPart.AttachedPos.ToString() | ||
187 | })); | ||
171 | // } | 188 | // } |
172 | } | 189 | } |
173 | 190 | ||
191 | ct.AddToStringBuilder(sb); | ||
174 | sb.Append("\n"); | 192 | sb.Append("\n"); |
175 | } | 193 | } |
176 | } | 194 | } |