diff options
author | Melanie | 2010-08-06 18:08:40 +0100 |
---|---|---|
committer | Melanie | 2010-08-06 18:08:40 +0100 |
commit | 26387252f5adbf71dc77084ff2d1b463fad5038c (patch) | |
tree | 0453fd501165368affa2917180ef3e43c5555ea0 /OpenSim/Framework | |
parent | Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/ca... (diff) | |
parent | Fix a parenthesis in prior commit (diff) | |
download | opensim-SC-26387252f5adbf71dc77084ff2d1b463fad5038c.zip opensim-SC-26387252f5adbf71dc77084ff2d1b463fad5038c.tar.gz opensim-SC-26387252f5adbf71dc77084ff2d1b463fad5038c.tar.bz2 opensim-SC-26387252f5adbf71dc77084ff2d1b463fad5038c.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/PrimitiveBaseShape.cs | 115 | ||||
-rw-r--r-- | OpenSim/Framework/Serialization/ArchiveConstants.cs | 29 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 |
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 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.Drawing; | 30 | using System.Drawing; |
30 | using System.Drawing.Imaging; | 31 | using System.Drawing.Imaging; |
32 | using System.IO; | ||
31 | using System.Reflection; | 33 | using System.Reflection; |
34 | using System.Xml; | ||
35 | using System.Xml.Schema; | ||
32 | using System.Xml.Serialization; | 36 | using System.Xml.Serialization; |
33 | using log4net; | 37 | using log4net; |
34 | using OpenMetaverse; | 38 | using OpenMetaverse; |
39 | using OpenMetaverse.StructuredData; | ||
35 | 40 | ||
36 | namespace OpenSim.Framework | 41 | namespace 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 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | ||
30 | using OpenMetaverse; | 31 | using OpenMetaverse; |
31 | 32 | ||
32 | namespace OpenSim.Framework.Serialization | 33 | namespace 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 | { |