aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs110
1 files changed, 55 insertions, 55 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs
index dc0b94a..b9c0065 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs
@@ -35,62 +35,62 @@ using OpenMetaverse;
35 35
36namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 36namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
37{ 37{
38 public class InventoryItem : IInventoryItem 38 public class InventoryItem : IInventoryItem
39 { 39 {
40 TaskInventoryItem m_privateItem; 40 TaskInventoryItem m_privateItem;
41 Scene m_rootSceene; 41 Scene m_rootSceene;
42 42
43 public InventoryItem(Scene rootScene, TaskInventoryItem internalItem) 43 public InventoryItem(Scene rootScene, TaskInventoryItem internalItem)
44 { 44 {
45 m_rootSceene = rootScene; 45 m_rootSceene = rootScene;
46 m_privateItem = internalItem; 46 m_privateItem = internalItem;
47 } 47 }
48 48
49 // Marked internal, to prevent scripts from accessing the internal type 49 // Marked internal, to prevent scripts from accessing the internal type
50 internal TaskInventoryItem ToTaskInventoryItem() 50 internal TaskInventoryItem ToTaskInventoryItem()
51 { 51 {
52 return m_privateItem; 52 return m_privateItem;
53 } 53 }
54 54
55 /// <summary> 55 /// <summary>
56 /// This will attempt to convert from an IInventoryItem to an InventoryItem object 56 /// This will attempt to convert from an IInventoryItem to an InventoryItem object
57 /// </summary> 57 /// </summary>
58 /// <description> 58 /// <description>
59 /// In order for this to work the object which implements IInventoryItem must inherit from InventoryItem, otherwise 59 /// In order for this to work the object which implements IInventoryItem must inherit from InventoryItem, otherwise
60 /// an exception is thrown. 60 /// an exception is thrown.
61 /// </description> 61 /// </description>
62 /// <param name="i"> 62 /// <param name="i">
63 /// The interface to upcast <see cref="IInventoryItem"/> 63 /// The interface to upcast <see cref="IInventoryItem"/>
64 /// </param> 64 /// </param>
65 /// <returns> 65 /// <returns>
66 /// The object backing the interface implementation <see cref="InventoryItem"/> 66 /// The object backing the interface implementation <see cref="InventoryItem"/>
67 /// </returns> 67 /// </returns>
68 internal static InventoryItem FromInterface(IInventoryItem i) 68 internal static InventoryItem FromInterface(IInventoryItem i)
69 { 69 {
70 if(typeof(InventoryItem).IsAssignableFrom(i.GetType())) 70 if (typeof(InventoryItem).IsAssignableFrom(i.GetType()))
71 { 71 {
72 return (InventoryItem)i; 72 return (InventoryItem)i;
73 } 73 }
74 else 74 else
75 { 75 {
76 throw new ApplicationException("[MRM] There is no legal conversion from IInventoryItem to InventoryItem"); 76 throw new ApplicationException("[MRM] There is no legal conversion from IInventoryItem to InventoryItem");
77 } 77 }
78 } 78 }
79 79
80 public int Type { get { return m_privateItem.Type; } } 80 public int Type { get { return m_privateItem.Type; } }
81 public UUID AssetID { get { return m_privateItem.AssetID; } } 81 public UUID AssetID { get { return m_privateItem.AssetID; } }
82 82
83 public T RetreiveAsset<T>() where T : OpenMetaverse.Asset, new() 83 public T RetreiveAsset<T>() where T : OpenMetaverse.Asset, new()
84 { 84 {
85 AssetBase a = m_rootSceene.AssetService.Get(AssetID.ToString()); 85 AssetBase a = m_rootSceene.AssetService.Get(AssetID.ToString());
86 T result = new T(); 86 T result = new T();
87 87
88 if((sbyte)result.AssetType != a.Type) 88 if ((sbyte)result.AssetType != a.Type)
89 throw new ApplicationException("[MRM] The supplied asset class does not match the found asset"); 89 throw new ApplicationException("[MRM] The supplied asset class does not match the found asset");
90 90
91 result.AssetData = a.Data; 91 result.AssetData = a.Data;
92 result.Decode(); 92 result.Decode();
93 return result; 93 return result;
94 } 94 }
95 } 95 }
96} 96}