aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Base/ServerUtils.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Server/Base/ServerUtils.cs56
1 files changed, 9 insertions, 47 deletions
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs
index a5d28a4..9c54410 100644
--- a/OpenSim/Server/Base/ServerUtils.cs
+++ b/OpenSim/Server/Base/ServerUtils.cs
@@ -34,55 +34,13 @@ using System.Text;
34using System.Collections.Generic; 34using System.Collections.Generic;
35using log4net; 35using log4net;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenMetaverse;
37 38
38namespace OpenSim.Server.Base 39namespace OpenSim.Server.Base
39{ 40{
40 public static class ServerUtils 41 public static class ServerUtils
41 { 42 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43
44 public static string SLAssetTypeToContentType(int assetType)
45 {
46 switch (assetType)
47 {
48 case 0:
49 return "image/jp2";
50 case 1:
51 return "application/ogg";
52 case 2:
53 return "application/x-metaverse-callingcard";
54 case 3:
55 return "application/x-metaverse-landmark";
56 case 5:
57 return "application/x-metaverse-clothing";
58 case 6:
59 return "application/x-metaverse-primitive";
60 case 7:
61 return "application/x-metaverse-notecard";
62 case 8:
63 return "application/x-metaverse-folder";
64 case 10:
65 return "application/x-metaverse-lsl";
66 case 11:
67 return "application/x-metaverse-lso";
68 case 12:
69 return "image/tga";
70 case 13:
71 return "application/x-metaverse-bodypart";
72 case 17:
73 return "audio/x-wav";
74 case 19:
75 return "image/jpeg";
76 case 20:
77 return "application/x-metaverse-animation";
78 case 21:
79 return "application/x-metaverse-gesture";
80 case 22:
81 return "application/x-metaverse-simstate";
82 default:
83 return "application/octet-stream";
84 }
85 }
86 44
87 public static byte[] SerializeResult(XmlSerializer xs, object data) 45 public static byte[] SerializeResult(XmlSerializer xs, object data)
88 { 46 {
@@ -182,12 +140,13 @@ namespace OpenSim.Server.Base
182 140
183 if (name.EndsWith("[]")) 141 if (name.EndsWith("[]"))
184 { 142 {
185 if (result.ContainsKey(name)) 143 string cleanName = name.Substring(0, name.Length - 2);
144 if (result.ContainsKey(cleanName))
186 { 145 {
187 if (!(result[name] is List<string>)) 146 if (!(result[cleanName] is List<string>))
188 continue; 147 continue;
189 148
190 List<string> l = (List<string>)result[name]; 149 List<string> l = (List<string>)result[cleanName];
191 150
192 l.Add(value); 151 l.Add(value);
193 } 152 }
@@ -197,7 +156,7 @@ namespace OpenSim.Server.Base
197 156
198 newList.Add(value); 157 newList.Add(value);
199 158
200 result[name] = newList; 159 result[cleanName] = newList;
201 } 160 }
202 } 161 }
203 else 162 else
@@ -278,6 +237,9 @@ namespace OpenSim.Server.Base
278 { 237 {
279 foreach (KeyValuePair<string, object> kvp in data) 238 foreach (KeyValuePair<string, object> kvp in data)
280 { 239 {
240 if (kvp.Value == null)
241 continue;
242
281 XmlElement elem = parent.OwnerDocument.CreateElement("", 243 XmlElement elem = parent.OwnerDocument.CreateElement("",
282 kvp.Key, ""); 244 kvp.Key, "");
283 245