aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-08-06 18:28:53 +0100
committerJustin Clark-Casey (justincc)2010-08-06 18:29:30 +0100
commit1270727c969db07831866947b611d49873031739 (patch)
tree8fd490eaf5c49d69be948fd9e58c0be1f7e38331 /OpenSim/Framework
parentChange XEngine to use the new constant (diff)
parentfix mysql/mssql prim serialization problem (diff)
downloadopensim-SC-1270727c969db07831866947b611d49873031739.zip
opensim-SC-1270727c969db07831866947b611d49873031739.tar.gz
opensim-SC-1270727c969db07831866947b611d49873031739.tar.bz2
opensim-SC-1270727c969db07831866947b611d49873031739.tar.xz
Merge branch 'moap'
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs115
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs2
2 files changed, 114 insertions, 3 deletions
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 4d1de22..70a61cc 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -26,12 +26,17 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.Drawing; 30using System.Drawing;
30using System.Drawing.Imaging; 31using System.Drawing.Imaging;
32using System.IO;
31using System.Reflection; 33using System.Reflection;
34using System.Xml;
35using System.Xml.Schema;
32using System.Xml.Serialization; 36using System.Xml.Serialization;
33using log4net; 37using log4net;
34using OpenMetaverse; 38using OpenMetaverse;
39using OpenMetaverse.StructuredData;
35 40
36namespace OpenSim.Framework 41namespace OpenSim.Framework
37{ 42{
@@ -170,6 +175,13 @@ namespace OpenSim.Framework
170 } 175 }
171 } 176 }
172 } 177 }
178
179 /// <summary>
180 /// Entries to store media textures on each face
181 /// </summary>
182 /// Do not change this value directly - always do it through an IMoapModule.
183 /// Lock before manipulating.
184 public MediaList Media { get; set; }
173 185
174 public PrimitiveBaseShape() 186 public PrimitiveBaseShape()
175 { 187 {
@@ -1207,5 +1219,104 @@ namespace OpenSim.Framework
1207 1219
1208 return prim; 1220 return prim;
1209 } 1221 }
1210 } 1222
1211} 1223 /// <summary>
1224 /// Encapsulates a list of media entries.
1225 /// </summary>
1226 /// This class is necessary because we want to replace auto-serialization of MediaEntry with something more
1227 /// OSD like and less vulnerable to change.
1228 public class MediaList : List<MediaEntry>, IXmlSerializable
1229 {
1230 public const string MEDIA_TEXTURE_TYPE = "sl";
1231
1232 public MediaList() : base() {}
1233 public MediaList(IEnumerable<MediaEntry> collection) : base(collection) {}
1234 public MediaList(int capacity) : base(capacity) {}
1235
1236 public XmlSchema GetSchema()
1237 {
1238 return null;
1239 }
1240
1241 public string ToXml()
1242 {
1243 lock (this)
1244 {
1245 using (StringWriter sw = new StringWriter())
1246 {
1247 using (XmlTextWriter xtw = new XmlTextWriter(sw))
1248 {
1249 xtw.WriteStartElement("OSMedia");
1250 xtw.WriteAttributeString("type", MEDIA_TEXTURE_TYPE);
1251 xtw.WriteAttributeString("version", "0.1");
1252
1253 OSDArray meArray = new OSDArray();
1254 foreach (MediaEntry me in this)
1255 {
1256 OSD osd = (null == me ? new OSD() : me.GetOSD());
1257 meArray.Add(osd);
1258 }
1259
1260 xtw.WriteStartElement("OSData");
1261 xtw.WriteRaw(OSDParser.SerializeLLSDXmlString(meArray));
1262 xtw.WriteEndElement();
1263
1264 xtw.WriteEndElement();
1265
1266 xtw.Flush();
1267 return sw.ToString();
1268 }
1269 }
1270 }
1271 }
1272
1273 public void WriteXml(XmlWriter writer)
1274 {
1275 writer.WriteRaw(ToXml());
1276 }
1277
1278 public static MediaList FromXml(string rawXml)
1279 {
1280 MediaList ml = new MediaList();
1281 ml.ReadXml(rawXml);
1282 return ml;
1283 }
1284
1285 public void ReadXml(string rawXml)
1286 {
1287 using (StringReader sr = new StringReader(rawXml))
1288 {
1289 using (XmlTextReader xtr = new XmlTextReader(sr))
1290 {
1291 xtr.MoveToContent();
1292
1293 string type = xtr.GetAttribute("type");
1294 //m_log.DebugFormat("[MOAP]: Loaded media texture entry with type {0}", type);
1295
1296 if (type != MEDIA_TEXTURE_TYPE)
1297 return;
1298
1299 xtr.ReadStartElement("OSMedia");
1300
1301 OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml());
1302 foreach (OSD osdMe in osdMeArray)
1303 {
1304 MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry());
1305 Add(me);
1306 }
1307
1308 xtr.ReadEndElement();
1309 }
1310 }
1311 }
1312
1313 public void ReadXml(XmlReader reader)
1314 {
1315 if (reader.IsEmptyElement)
1316 return;
1317
1318 ReadXml(reader.ReadInnerXml());
1319 }
1320 }
1321 }
1322} \ No newline at end of file
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 8123f2f..ffa30d5 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -362,7 +362,7 @@ namespace OpenSim.Framework.Servers.HttpServer
362 string path = request.RawUrl; 362 string path = request.RawUrl;
363 string handlerKey = GetHandlerKey(request.HttpMethod, path); 363 string handlerKey = GetHandlerKey(request.HttpMethod, path);
364 364
365 //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); 365// m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path);
366 366
367 if (TryGetStreamHandler(handlerKey, out requestHandler)) 367 if (TryGetStreamHandler(handlerKey, out requestHandler))
368 { 368 {