diff options
author | UbitUmarov | 2018-01-24 10:02:18 +0000 |
---|---|---|
committer | UbitUmarov | 2018-01-24 10:02:18 +0000 |
commit | fc224b444a8339aae2802fb919c34cfd994595f1 (patch) | |
tree | c3dd0211a1e350ec325885fbb7ce3eb648d0cdd8 /OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs | |
parent | let MinHeap self trim on empty; cleanup (diff) | |
download | opensim-SC-fc224b444a8339aae2802fb919c34cfd994595f1.zip opensim-SC-fc224b444a8339aae2802fb919c34cfd994595f1.tar.gz opensim-SC-fc224b444a8339aae2802fb919c34cfd994595f1.tar.bz2 opensim-SC-fc224b444a8339aae2802fb919c34cfd994595f1.tar.xz |
avoid some large unnecessary strings
Diffstat (limited to 'OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs')
-rw-r--r-- | OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs index 73f2770..89d9e80 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs | |||
@@ -77,10 +77,7 @@ namespace OpenSim.Capabilities.Handlers | |||
77 | } | 77 | } |
78 | 78 | ||
79 | ArrayList foldersrequested = (ArrayList)hash["folders"]; | 79 | ArrayList foldersrequested = (ArrayList)hash["folders"]; |
80 | 80 | ||
81 | StringBuilder tmpresponse = new StringBuilder(1024); | ||
82 | StringBuilder tmpbadfolders = new StringBuilder(1024); | ||
83 | |||
84 | List<LLSDFetchInventoryDescendents> folders = new List<LLSDFetchInventoryDescendents>(); | 81 | List<LLSDFetchInventoryDescendents> folders = new List<LLSDFetchInventoryDescendents>(); |
85 | for (int i = 0; i < foldersrequested.Count; i++) | 82 | for (int i = 0; i < foldersrequested.Count; i++) |
86 | { | 83 | { |
@@ -101,6 +98,8 @@ namespace OpenSim.Capabilities.Handlers | |||
101 | folders.Add(llsdRequest); | 98 | folders.Add(llsdRequest); |
102 | } | 99 | } |
103 | 100 | ||
101 | StringBuilder lastresponse = new StringBuilder(1024); | ||
102 | lastresponse.Append("<llsd>"); | ||
104 | if (folders.Count > 0) | 103 | if (folders.Count > 0) |
105 | { | 104 | { |
106 | List<UUID> bad_folders = new List<UUID>(); | 105 | List<UUID> bad_folders = new List<UUID>(); |
@@ -115,43 +114,39 @@ namespace OpenSim.Capabilities.Handlers | |||
115 | #pragma warning restore 0612 | 114 | #pragma warning restore 0612 |
116 | } | 115 | } |
117 | 116 | ||
118 | string inventoryitemstr = string.Empty; | 117 | if(invcollSet.Count > 0) |
119 | foreach (InventoryCollectionWithDescendents icoll in invcollSet) | ||
120 | { | 118 | { |
121 | LLSDInventoryFolderContents thiscontents = contentsToLLSD(icoll.Collection, icoll.Descendents); | 119 | lastresponse.Append("<map><key>folders</key><array>"); |
122 | inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(thiscontents); | 120 | foreach (InventoryCollectionWithDescendents icoll in invcollSet) |
123 | tmpresponse.Append(inventoryitemstr.Substring(6,inventoryitemstr.Length - 13)); | 121 | { |
122 | LLSDInventoryFolderContents thiscontents = contentsToLLSD(icoll.Collection, icoll.Descendents); | ||
123 | lastresponse.Append(LLSDHelpers.SerialiseLLSDReplyNoHeader(thiscontents)); | ||
124 | } | ||
125 | lastresponse.Append("</array></map>"); | ||
124 | } | 126 | } |
127 | else | ||
128 | lastresponse.Append("<map><key>folders</key><array /></map>"); | ||
125 | 129 | ||
126 | //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Bad folders {0}", string.Join(", ", bad_folders)); | 130 | //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Bad folders {0}", string.Join(", ", bad_folders)); |
127 | foreach (UUID bad in bad_folders) | 131 | if(bad_folders.Count > 0) |
128 | { | 132 | { |
129 | tmpbadfolders.Append("<map><key>folder_id</key><uuid>"); | 133 | lastresponse.Append("<map><key>bad_folders</key><array>"); |
130 | tmpbadfolders.Append(bad.ToString()); | 134 | foreach (UUID bad in bad_folders) |
131 | tmpbadfolders.Append("</uuid><key>error</key><string>Unknown</string></map>"); | 135 | { |
136 | lastresponse.Append("<map><key>folder_id</key><uuid>"); | ||
137 | lastresponse.Append(bad.ToString()); | ||
138 | lastresponse.Append("</uuid><key>error</key><string>Unknown</string></map>"); | ||
139 | } | ||
140 | lastresponse.Append("</array></map>"); | ||
132 | } | 141 | } |
133 | } | 142 | lastresponse.Append("</llsd>"); |
134 | |||
135 | StringBuilder lastresponse = new StringBuilder(1024); | ||
136 | lastresponse.Append("<llsd>"); | ||
137 | if(tmpresponse.Length > 0) | ||
138 | { | ||
139 | lastresponse.Append("<map><key>folders</key><array>"); | ||
140 | lastresponse.Append(tmpresponse.ToString()); | ||
141 | lastresponse.Append("</array></map>"); | ||
142 | } | 143 | } |
143 | else | 144 | else |
144 | lastresponse.Append("<map><key>folders</key><array /></map>"); | ||
145 | |||
146 | if(tmpbadfolders.Length > 0) | ||
147 | { | 145 | { |
148 | lastresponse.Append("<map><key>bad_folders</key><array>"); | 146 | lastresponse.Append("<map><key>folders</key><array /></map></llsd>"); |
149 | lastresponse.Append(tmpbadfolders.ToString()); | ||
150 | lastresponse.Append("</array></map>"); | ||
151 | } | 147 | } |
152 | lastresponse.Append("</llsd>"); | ||
153 | 148 | ||
154 | return lastresponse.ToString(); | 149 | return lastresponse.ToString();; |
155 | } | 150 | } |
156 | 151 | ||
157 | /// <summary> | 152 | /// <summary> |