diff options
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 5811ed9..51103cd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Text; | ||
29 | using System.Xml; | 30 | using System.Xml; |
30 | using System.IO; | 31 | using System.IO; |
31 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
@@ -1217,7 +1218,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1217 | 1218 | ||
1218 | Items.LockItemsForRead(false); | 1219 | Items.LockItemsForRead(false); |
1219 | 1220 | ||
1220 | m_inventoryFileData = Utils.StringToBytes(invString.BuildString); | 1221 | m_inventoryFileData = Utils.StringToBytes(invString.GetString()); |
1222 | invString.Close(); | ||
1221 | 1223 | ||
1222 | if (m_inventoryFileData.Length > 2) | 1224 | if (m_inventoryFileData.Length > 2) |
1223 | { | 1225 | { |
@@ -1261,11 +1263,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1261 | 1263 | ||
1262 | public class InventoryStringBuilder | 1264 | public class InventoryStringBuilder |
1263 | { | 1265 | { |
1264 | public string BuildString = String.Empty; | 1266 | private StringBuilder BuildString = new StringBuilder(16384); |
1265 | 1267 | ||
1266 | public InventoryStringBuilder(UUID folderID, UUID parentID) | 1268 | public InventoryStringBuilder(UUID folderID, UUID parentID) |
1267 | { | 1269 | { |
1268 | BuildString += "\tinv_object\t0\n\t{\n"; | 1270 | BuildString.Append("\tinv_object\t0\n\t{\n"); |
1269 | AddNameValueLine("obj_id", folderID.ToString()); | 1271 | AddNameValueLine("obj_id", folderID.ToString()); |
1270 | AddNameValueLine("parent_id", parentID.ToString()); | 1272 | AddNameValueLine("parent_id", parentID.ToString()); |
1271 | AddNameValueLine("type", "category"); | 1273 | AddNameValueLine("type", "category"); |
@@ -1275,46 +1277,53 @@ namespace OpenSim.Region.Framework.Scenes | |||
1275 | 1277 | ||
1276 | public void AddItemStart() | 1278 | public void AddItemStart() |
1277 | { | 1279 | { |
1278 | BuildString += "\tinv_item\t0\n"; | 1280 | BuildString.Append("\tinv_item\t0\n"); |
1279 | AddSectionStart(); | 1281 | AddSectionStart(); |
1280 | } | 1282 | } |
1281 | 1283 | ||
1282 | public void AddPermissionsStart() | 1284 | public void AddPermissionsStart() |
1283 | { | 1285 | { |
1284 | BuildString += "\tpermissions 0\n"; | 1286 | BuildString.Append("\tpermissions 0\n"); |
1285 | AddSectionStart(); | 1287 | AddSectionStart(); |
1286 | } | 1288 | } |
1287 | 1289 | ||
1288 | public void AddSaleStart() | 1290 | public void AddSaleStart() |
1289 | { | 1291 | { |
1290 | BuildString += "\tsale_info\t0\n"; | 1292 | BuildString.Append("\tsale_info\t0\n"); |
1291 | AddSectionStart(); | 1293 | AddSectionStart(); |
1292 | } | 1294 | } |
1293 | 1295 | ||
1294 | protected void AddSectionStart() | 1296 | protected void AddSectionStart() |
1295 | { | 1297 | { |
1296 | BuildString += "\t{\n"; | 1298 | BuildString.Append("\t{\n"); |
1297 | } | 1299 | } |
1298 | 1300 | ||
1299 | public void AddSectionEnd() | 1301 | public void AddSectionEnd() |
1300 | { | 1302 | { |
1301 | BuildString += "\t}\n"; | 1303 | BuildString.Append("\t}\n"); |
1302 | } | 1304 | } |
1303 | 1305 | ||
1304 | public void AddLine(string addLine) | 1306 | public void AddLine(string addLine) |
1305 | { | 1307 | { |
1306 | BuildString += addLine; | 1308 | BuildString.Append(addLine); |
1307 | } | 1309 | } |
1308 | 1310 | ||
1309 | public void AddNameValueLine(string name, string value) | 1311 | public void AddNameValueLine(string name, string value) |
1310 | { | 1312 | { |
1311 | BuildString += "\t\t"; | 1313 | BuildString.Append("\t\t"); |
1312 | BuildString += name + "\t"; | 1314 | BuildString.Append(name + "\t"); |
1313 | BuildString += value + "\n"; | 1315 | BuildString.Append(value + "\n"); |
1316 | } | ||
1317 | |||
1318 | public String GetString() | ||
1319 | { | ||
1320 | return BuildString.ToString(); | ||
1314 | } | 1321 | } |
1315 | 1322 | ||
1316 | public void Close() | 1323 | public void Close() |
1317 | { | 1324 | { |
1325 | BuildString.Clear(); | ||
1326 | BuildString = null; | ||
1318 | } | 1327 | } |
1319 | } | 1328 | } |
1320 | 1329 | ||