aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorTom2010-08-06 11:44:57 -0700
committerTom2010-08-06 11:44:57 -0700
commitf9f776e4071dd983b8d9f52ecb75bc361a2b62ce (patch)
treec202070adf22e071541732c35c90347839a3af36 /OpenSim/Framework
parentImplement CreateNewOutfitAttachments. This addresses mantis #199. (diff)
parentMerge branch 'master' into careminster-presence-refactor (diff)
downloadopensim-SC-f9f776e4071dd983b8d9f52ecb75bc361a2b62ce.zip
opensim-SC-f9f776e4071dd983b8d9f52ecb75bc361a2b62ce.tar.gz
opensim-SC-f9f776e4071dd983b8d9f52ecb75bc361a2b62ce.tar.bz2
opensim-SC-f9f776e4071dd983b8d9f52ecb75bc361a2b62ce.tar.xz
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs115
-rw-r--r--OpenSim/Framework/Serialization/ArchiveConstants.cs29
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs2
3 files changed, 141 insertions, 5 deletions
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 990c859..a4587d8 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/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs
index 475a9de..3143e3b 100644
--- a/OpenSim/Framework/Serialization/ArchiveConstants.cs
+++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text;
30using OpenMetaverse; 31using OpenMetaverse;
31 32
32namespace OpenSim.Framework.Serialization 33namespace OpenSim.Framework.Serialization
@@ -171,6 +172,30 @@ namespace OpenSim.Framework.Serialization
171 public static string CreateOarObjectPath(string objectName, UUID uuid, Vector3 pos) 172 public static string CreateOarObjectPath(string objectName, UUID uuid, Vector3 pos)
172 { 173 {
173 return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos); 174 return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos);
174 } 175 }
176
177 /// <summary>
178 /// Extract a plain path from an IAR path
179 /// </summary>
180 /// <param name="iarPath"></param>
181 /// <returns></returns>
182 public static string ExtractPlainPathFromIarPath(string iarPath)
183 {
184 List<string> plainDirs = new List<string>();
185
186 string[] iarDirs = iarPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
187
188 foreach (string iarDir in iarDirs)
189 {
190 if (!iarDir.Contains(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR))
191 plainDirs.Add(iarDir);
192
193 int i = iarDir.LastIndexOf(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR);
194
195 plainDirs.Add(iarDir.Remove(i));
196 }
197
198 return string.Join("/", plainDirs.ToArray());
199 }
175 } 200 }
176} 201} \ 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 {