aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server
diff options
context:
space:
mode:
authorJohn Hurliman2010-02-20 16:21:13 -0800
committerJohn Hurliman2010-02-20 16:21:13 -0800
commit845a390e9308f6b6823c85ac319ecb211f968d4b (patch)
tree7cc28abeb9396c845db7c3a8f4f04a4eb17af685 /OpenSim/Server
parent* Fixed SL asset type enum to mime type conversion and added more helper func... (diff)
downloadopensim-SC_OLD-845a390e9308f6b6823c85ac319ecb211f968d4b.zip
opensim-SC_OLD-845a390e9308f6b6823c85ac319ecb211f968d4b.tar.gz
opensim-SC_OLD-845a390e9308f6b6823c85ac319ecb211f968d4b.tar.bz2
opensim-SC_OLD-845a390e9308f6b6823c85ac319ecb211f968d4b.tar.xz
* Added a sanity check for missing asset data in LLClientView
* Moved the SL asset type to content type conversion methods from ServerUtils to OpenSim.Framework.SLUtil * Linked content type to asset type in AssetMetadata
Diffstat (limited to 'OpenSim/Server')
-rw-r--r--OpenSim/Server/Base/ServerUtils.cs177
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs4
2 files changed, 2 insertions, 179 deletions
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs
index c79785f..2fbcea4 100644
--- a/OpenSim/Server/Base/ServerUtils.cs
+++ b/OpenSim/Server/Base/ServerUtils.cs
@@ -42,183 +42,6 @@ namespace OpenSim.Server.Base
42 { 42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 #region SL / file extension / content-type conversions
46
47 public static string SLAssetTypeToContentType(int assetType)
48 {
49 switch ((AssetType)assetType)
50 {
51 case AssetType.Texture:
52 return "image/x-j2c";
53 case AssetType.Sound:
54 return "application/ogg";
55 case AssetType.CallingCard:
56 return "application/vnd.ll.callingcard";
57 case AssetType.Landmark:
58 return "application/vnd.ll.landmark";
59 case AssetType.Clothing:
60 return "application/vnd.ll.clothing";
61 case AssetType.Object:
62 return "application/vnd.ll.primitive";
63 case AssetType.Notecard:
64 return "application/vnd.ll.notecard";
65 case AssetType.Folder:
66 return "application/vnd.ll.folder";
67 case AssetType.RootFolder:
68 return "application/vnd.ll.rootfolder";
69 case AssetType.LSLText:
70 return "application/vnd.ll.lsltext";
71 case AssetType.LSLBytecode:
72 return "application/vnd.ll.lslbyte";
73 case AssetType.TextureTGA:
74 case AssetType.ImageTGA:
75 return "image/tga";
76 case AssetType.Bodypart:
77 return "application/vnd.ll.bodypart";
78 case AssetType.TrashFolder:
79 return "application/vnd.ll.trashfolder";
80 case AssetType.SnapshotFolder:
81 return "application/vnd.ll.snapshotfolder";
82 case AssetType.LostAndFoundFolder:
83 return "application/vnd.ll.lostandfoundfolder";
84 case AssetType.SoundWAV:
85 return "audio/x-wav";
86 case AssetType.ImageJPEG:
87 return "image/jpeg";
88 case AssetType.Animation:
89 return "application/vnd.ll.animation";
90 case AssetType.Gesture:
91 return "application/vnd.ll.gesture";
92 case AssetType.Simstate:
93 return "application/x-metaverse-simstate";
94 case AssetType.Unknown:
95 default:
96 return "application/octet-stream";
97 }
98 }
99
100 public static sbyte ContentTypeToSLAssetType(string contentType)
101 {
102 switch (contentType)
103 {
104 case "image/x-j2c":
105 case "image/jp2":
106 return (sbyte)AssetType.Texture;
107 case "application/ogg":
108 return (sbyte)AssetType.Sound;
109 case "application/vnd.ll.callingcard":
110 case "application/x-metaverse-callingcard":
111 return (sbyte)AssetType.CallingCard;
112 case "application/vnd.ll.landmark":
113 case "application/x-metaverse-landmark":
114 return (sbyte)AssetType.Landmark;
115 case "application/vnd.ll.clothing":
116 case "application/x-metaverse-clothing":
117 return (sbyte)AssetType.Clothing;
118 case "application/vnd.ll.primitive":
119 case "application/x-metaverse-primitive":
120 return (sbyte)AssetType.Object;
121 case "application/vnd.ll.notecard":
122 case "application/x-metaverse-notecard":
123 return (sbyte)AssetType.Notecard;
124 case "application/vnd.ll.folder":
125 return (sbyte)AssetType.Folder;
126 case "application/vnd.ll.rootfolder":
127 return (sbyte)AssetType.RootFolder;
128 case "application/vnd.ll.lsltext":
129 case "application/x-metaverse-lsl":
130 return (sbyte)AssetType.LSLText;
131 case "application/vnd.ll.lslbyte":
132 case "application/x-metaverse-lso":
133 return (sbyte)AssetType.LSLBytecode;
134 case "image/tga":
135 // Note that AssetType.TextureTGA will be converted to AssetType.ImageTGA
136 return (sbyte)AssetType.ImageTGA;
137 case "application/vnd.ll.bodypart":
138 case "application/x-metaverse-bodypart":
139 return (sbyte)AssetType.Bodypart;
140 case "application/vnd.ll.trashfolder":
141 return (sbyte)AssetType.TrashFolder;
142 case "application/vnd.ll.snapshotfolder":
143 return (sbyte)AssetType.SnapshotFolder;
144 case "application/vnd.ll.lostandfoundfolder":
145 return (sbyte)AssetType.LostAndFoundFolder;
146 case "audio/x-wav":
147 return (sbyte)AssetType.SoundWAV;
148 case "image/jpeg":
149 return (sbyte)AssetType.ImageJPEG;
150 case "application/vnd.ll.animation":
151 case "application/x-metaverse-animation":
152 return (sbyte)AssetType.Animation;
153 case "application/vnd.ll.gesture":
154 case "application/x-metaverse-gesture":
155 return (sbyte)AssetType.Gesture;
156 case "application/x-metaverse-simstate":
157 return (sbyte)AssetType.Simstate;
158 case "application/octet-stream":
159 default:
160 return (sbyte)AssetType.Unknown;
161 }
162 }
163
164 public static sbyte ContentTypeToSLInvType(string contentType)
165 {
166 switch (contentType)
167 {
168 case "image/x-j2c":
169 case "image/jp2":
170 case "image/tga":
171 case "image/jpeg":
172 return (sbyte)InventoryType.Texture;
173 case "application/ogg":
174 case "audio/x-wav":
175 return (sbyte)InventoryType.Sound;
176 case "application/vnd.ll.callingcard":
177 case "application/x-metaverse-callingcard":
178 return (sbyte)InventoryType.CallingCard;
179 case "application/vnd.ll.landmark":
180 case "application/x-metaverse-landmark":
181 return (sbyte)InventoryType.Landmark;
182 case "application/vnd.ll.clothing":
183 case "application/x-metaverse-clothing":
184 case "application/vnd.ll.bodypart":
185 case "application/x-metaverse-bodypart":
186 return (sbyte)InventoryType.Wearable;
187 case "application/vnd.ll.primitive":
188 case "application/x-metaverse-primitive":
189 return (sbyte)InventoryType.Object;
190 case "application/vnd.ll.notecard":
191 case "application/x-metaverse-notecard":
192 return (sbyte)InventoryType.Notecard;
193 case "application/vnd.ll.folder":
194 return (sbyte)InventoryType.Folder;
195 case "application/vnd.ll.rootfolder":
196 return (sbyte)InventoryType.RootCategory;
197 case "application/vnd.ll.lsltext":
198 case "application/x-metaverse-lsl":
199 case "application/vnd.ll.lslbyte":
200 case "application/x-metaverse-lso":
201 return (sbyte)InventoryType.LSL;
202 case "application/vnd.ll.trashfolder":
203 case "application/vnd.ll.snapshotfolder":
204 case "application/vnd.ll.lostandfoundfolder":
205 return (sbyte)InventoryType.Folder;
206 case "application/vnd.ll.animation":
207 case "application/x-metaverse-animation":
208 return (sbyte)InventoryType.Animation;
209 case "application/vnd.ll.gesture":
210 case "application/x-metaverse-gesture":
211 return (sbyte)InventoryType.Gesture;
212 case "application/x-metaverse-simstate":
213 return (sbyte)InventoryType.Snapshot;
214 case "application/octet-stream":
215 default:
216 return (sbyte)InventoryType.Unknown;
217 }
218 }
219
220 #endregion SL / file extension / content-type conversions
221
222 public static byte[] SerializeResult(XmlSerializer xs, object data) 45 public static byte[] SerializeResult(XmlSerializer xs, object data)
223 { 46 {
224 MemoryStream ms = new MemoryStream(); 47 MemoryStream ms = new MemoryStream();
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs
index fe0da0b..43c1693 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs
@@ -91,7 +91,7 @@ namespace OpenSim.Server.Handlers.Asset
91 91
92 httpResponse.StatusCode = (int)HttpStatusCode.OK; 92 httpResponse.StatusCode = (int)HttpStatusCode.OK;
93 httpResponse.ContentType = 93 httpResponse.ContentType =
94 ServerUtils.SLAssetTypeToContentType(metadata.Type); 94 SLUtil.SLAssetTypeToContentType(metadata.Type);
95 } 95 }
96 else 96 else
97 { 97 {
@@ -111,7 +111,7 @@ namespace OpenSim.Server.Handlers.Asset
111 111
112 httpResponse.StatusCode = (int)HttpStatusCode.OK; 112 httpResponse.StatusCode = (int)HttpStatusCode.OK;
113 httpResponse.ContentType = 113 httpResponse.ContentType =
114 ServerUtils.SLAssetTypeToContentType(asset.Type); 114 SLUtil.SLAssetTypeToContentType(asset.Type);
115 } 115 }
116 else 116 else
117 { 117 {