diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/SLUtil.cs | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs index cb73e8f..9249105 100644 --- a/OpenSim/Framework/SLUtil.cs +++ b/OpenSim/Framework/SLUtil.cs | |||
@@ -39,8 +39,32 @@ namespace OpenSim.Framework | |||
39 | { | 39 | { |
40 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 40 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
41 | 41 | ||
42 | /// <summary> | ||
43 | /// Asset types used only in OpenSim. | ||
44 | /// To avoid clashing with the code numbers used in Second Life, use only negative numbers here. | ||
45 | /// </summary> | ||
46 | public enum OpenSimAssetType : sbyte | ||
47 | { | ||
48 | Material = -2 | ||
49 | } | ||
50 | |||
51 | |||
42 | #region SL / file extension / content-type conversions | 52 | #region SL / file extension / content-type conversions |
43 | 53 | ||
54 | /// <summary> | ||
55 | /// Returns the Enum entry corresponding to the given code, regardless of whether it belongs | ||
56 | /// to the AssetType or OpenSimAssetType enums. | ||
57 | /// </summary> | ||
58 | public static object AssetTypeFromCode(sbyte assetType) | ||
59 | { | ||
60 | if (Enum.IsDefined(typeof(OpenMetaverse.AssetType), assetType)) | ||
61 | return (OpenMetaverse.AssetType)assetType; | ||
62 | else if (Enum.IsDefined(typeof(OpenSimAssetType), assetType)) | ||
63 | return (OpenSimAssetType)assetType; | ||
64 | else | ||
65 | return OpenMetaverse.AssetType.Unknown; | ||
66 | } | ||
67 | |||
44 | private class TypeMapping | 68 | private class TypeMapping |
45 | { | 69 | { |
46 | private sbyte assetType; | 70 | private sbyte assetType; |
@@ -56,12 +80,7 @@ namespace OpenSim.Framework | |||
56 | 80 | ||
57 | public object AssetType | 81 | public object AssetType |
58 | { | 82 | { |
59 | get { | 83 | get { return AssetTypeFromCode(assetType); } |
60 | if (Enum.IsDefined(typeof(OpenMetaverse.AssetType), assetType)) | ||
61 | return (OpenMetaverse.AssetType)assetType; | ||
62 | else | ||
63 | return OpenMetaverse.AssetType.Unknown; | ||
64 | } | ||
65 | } | 84 | } |
66 | 85 | ||
67 | public InventoryType InventoryType | 86 | public InventoryType InventoryType |
@@ -102,6 +121,11 @@ namespace OpenSim.Framework | |||
102 | : this((sbyte)assetType, inventoryType, contentType, null, extension) | 121 | : this((sbyte)assetType, inventoryType, contentType, null, extension) |
103 | { | 122 | { |
104 | } | 123 | } |
124 | |||
125 | public TypeMapping(OpenSimAssetType assetType, InventoryType inventoryType, string contentType, string extension) | ||
126 | : this((sbyte)assetType, inventoryType, contentType, null, extension) | ||
127 | { | ||
128 | } | ||
105 | } | 129 | } |
106 | 130 | ||
107 | /// <summary> | 131 | /// <summary> |
@@ -142,7 +166,9 @@ namespace OpenSim.Framework | |||
142 | new TypeMapping(AssetType.CurrentOutfitFolder, InventoryType.Unknown, "application/vnd.ll.currentoutfitfolder", "currentoutfitfolder"), | 166 | new TypeMapping(AssetType.CurrentOutfitFolder, InventoryType.Unknown, "application/vnd.ll.currentoutfitfolder", "currentoutfitfolder"), |
143 | new TypeMapping(AssetType.OutfitFolder, InventoryType.Unknown, "application/vnd.ll.outfitfolder", "outfitfolder"), | 167 | new TypeMapping(AssetType.OutfitFolder, InventoryType.Unknown, "application/vnd.ll.outfitfolder", "outfitfolder"), |
144 | new TypeMapping(AssetType.MyOutfitsFolder, InventoryType.Unknown, "application/vnd.ll.myoutfitsfolder", "myoutfitsfolder"), | 168 | new TypeMapping(AssetType.MyOutfitsFolder, InventoryType.Unknown, "application/vnd.ll.myoutfitsfolder", "myoutfitsfolder"), |
145 | new TypeMapping(AssetType.Mesh, InventoryType.Mesh, "application/vnd.ll.mesh", "llm") | 169 | new TypeMapping(AssetType.Mesh, InventoryType.Mesh, "application/vnd.ll.mesh", "llm"), |
170 | |||
171 | new TypeMapping(OpenSimAssetType.Material, InventoryType.Unknown, "application/llsd+xml", "material") | ||
146 | }; | 172 | }; |
147 | 173 | ||
148 | private static Dictionary<sbyte, string> asset2Content; | 174 | private static Dictionary<sbyte, string> asset2Content; |