aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs9
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityInventory.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs26
3 files changed, 41 insertions, 7 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 1200105..bf80a1c 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -237,6 +237,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
237 SceneObjectGroup object1 = new SceneObjectGroup(part1); 237 SceneObjectGroup object1 = new SceneObjectGroup(part1);
238 238
239 // Let's put some inventory items into our object 239 // Let's put some inventory items into our object
240 string soundItemName = "sound-item1";
240 UUID soundItemUuid = UUID.Parse("00000000-0000-0000-0000-000000000002"); 241 UUID soundItemUuid = UUID.Parse("00000000-0000-0000-0000-000000000002");
241 Type type = GetType(); 242 Type type = GetType();
242 Assembly assembly = type.Assembly; 243 Assembly assembly = type.Assembly;
@@ -269,7 +270,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
269 asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav"; 270 asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav";
270 */ 271 */
271 272
272 TaskInventoryItem item1 = new TaskInventoryItem { AssetID = soundUuid, ItemID = soundItemUuid }; 273 TaskInventoryItem item1
274 = new TaskInventoryItem { AssetID = soundUuid, ItemID = soundItemUuid, Name = soundItemName };
273 part1.Inventory.AddInventoryItem(item1, true); 275 part1.Inventory.AddInventoryItem(item1, true);
274 } 276 }
275 } 277 }
@@ -305,14 +307,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
305 Assert.That( 307 Assert.That(
306 object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal"); 308 object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal");
307 309
308 // Need to implement a method to get the task inventory item by name (since the uuid will have changed on load) 310 TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItems(soundItemName)[0];
309 /*
310 TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItem(soundItemUuid);
311 Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null"); 311 Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null");
312 AssetBase loadedSoundAsset = scene.AssetService.Get(loadedSoundItem.AssetID.ToString()); 312 AssetBase loadedSoundAsset = scene.AssetService.Get(loadedSoundItem.AssetID.ToString());
313 Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null"); 313 Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null");
314 Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match"); 314 Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match");
315 */
316 315
317 // Temporary 316 // Temporary
318 Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); 317 Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index eeb5102..fa9bf19 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -71,7 +71,8 @@ namespace OpenSim.Region.Framework.Interfaces
71 /// <summary> 71 /// <summary>
72 /// Start all the scripts contained in this entity's inventory 72 /// Start all the scripts contained in this entity's inventory
73 /// </summary> 73 /// </summary>
74 void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); 74 void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource);
75
75 ArrayList GetScriptErrors(UUID itemID); 76 ArrayList GetScriptErrors(UUID itemID);
76 77
77 /// <summary> 78 /// <summary>
@@ -143,6 +144,16 @@ namespace OpenSim.Region.Framework.Interfaces
143 TaskInventoryItem GetInventoryItem(UUID itemId); 144 TaskInventoryItem GetInventoryItem(UUID itemId);
144 145
145 /// <summary> 146 /// <summary>
147 /// Get inventory items by name.
148 /// </summary>
149 /// <param name="name"></param>
150 /// <returns>
151 /// A list of inventory items with that name.
152 /// If no inventory item has that name then an empty list is returned.
153 /// </returns>
154 IList<TaskInventoryItem> GetInventoryItems(string name);
155
156 /// <summary>
146 /// Update an existing inventory item. 157 /// Update an existing inventory item.
147 /// </summary> 158 /// </summary>
148 /// <param name="item">The updated item. An item with the same id must already exist 159 /// <param name="item">The updated item. An item with the same id must already exist
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 5f13278..b37e1a2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -554,8 +554,32 @@ namespace OpenSim.Region.Framework.Scenes
554 m_items.TryGetValue(itemId, out item); 554 m_items.TryGetValue(itemId, out item);
555 555
556 return item; 556 return item;
557 } 557 }
558
559 /// <summary>
560 /// Get inventory items by name.
561 /// </summary>
562 /// <param name="name"></param>
563 /// <returns>
564 /// A list of inventory items with that name.
565 /// If no inventory item has that name then an empty list is returned.
566 /// </returns>
567 public IList<TaskInventoryItem> GetInventoryItems(string name)
568 {
569 IList<TaskInventoryItem> items = new List<TaskInventoryItem>();
558 570
571 lock (m_items)
572 {
573 foreach (TaskInventoryItem item in m_items.Values)
574 {
575 if (item.Name == name)
576 items.Add(item);
577 }
578 }
579
580 return items;
581 }
582
559 /// <summary> 583 /// <summary>
560 /// Update an existing inventory item. 584 /// Update an existing inventory item.
561 /// </summary> 585 /// </summary>