aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/PrimitiveBaseShape.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-08-03 15:58:17 +0100
committerJustin Clark-Casey (justincc)2010-08-03 15:58:17 +0100
commitac07d853b89d9b2bda2dd058f7f9ea94211a26f1 (patch)
tree0280d76d87bee0342cbc24c6753868a18b334353 /OpenSim/Framework/PrimitiveBaseShape.cs
parentserialize media textures to inventory with a largely osd representation rathe... (diff)
downloadopensim-SC_OLD-ac07d853b89d9b2bda2dd058f7f9ea94211a26f1.zip
opensim-SC_OLD-ac07d853b89d9b2bda2dd058f7f9ea94211a26f1.tar.gz
opensim-SC_OLD-ac07d853b89d9b2bda2dd058f7f9ea94211a26f1.tar.bz2
opensim-SC_OLD-ac07d853b89d9b2bda2dd058f7f9ea94211a26f1.tar.xz
remove duplicated serialization code
Diffstat (limited to 'OpenSim/Framework/PrimitiveBaseShape.cs')
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs38
1 files changed, 26 insertions, 12 deletions
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index de7e42d..685599a 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -1238,7 +1238,7 @@ namespace OpenSim.Framework
1238 return null; 1238 return null;
1239 } 1239 }
1240 1240
1241 public void WriteXml(XmlWriter writer) 1241 public string ToXml()
1242 { 1242 {
1243 lock (this) 1243 lock (this)
1244 { 1244 {
@@ -1265,18 +1265,26 @@ namespace OpenSim.Framework
1265 xtw.WriteEndElement(); 1265 xtw.WriteEndElement();
1266 1266
1267 xtw.Flush(); 1267 xtw.Flush();
1268 writer.WriteRaw(sw.ToString()); 1268 return sw.ToString();
1269 } 1269 }
1270 } 1270 }
1271 } 1271 }
1272 } 1272 }
1273 1273
1274 public void ReadXml(XmlReader reader) 1274 public void WriteXml(XmlWriter writer)
1275 {
1276 writer.WriteRaw(ToXml());
1277 }
1278
1279 public static MediaList FromXml(string rawXml)
1275 { 1280 {
1276 if (reader.IsEmptyElement) 1281 MediaList ml = new MediaList();
1277 return; 1282 ml.ReadXml(rawXml);
1278 1283 return ml;
1279 string rawXml = reader.ReadInnerXml(); 1284 }
1285
1286 public void ReadXml(string rawXml)
1287 {
1280 using (StringReader sr = new StringReader(rawXml)) 1288 using (StringReader sr = new StringReader(rawXml))
1281 { 1289 {
1282 using (XmlTextReader xtr = new XmlTextReader(sr)) 1290 using (XmlTextReader xtr = new XmlTextReader(sr))
@@ -1292,8 +1300,6 @@ namespace OpenSim.Framework
1292 xtr.ReadStartElement("osmedia"); 1300 xtr.ReadStartElement("osmedia");
1293 1301
1294 OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml()); 1302 OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml());
1295
1296 List<MediaEntry> mediaEntries = new List<MediaEntry>();
1297 foreach (OSD osdMe in osdMeArray) 1303 foreach (OSD osdMe in osdMeArray)
1298 { 1304 {
1299 MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry()); 1305 MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry());
@@ -1303,7 +1309,15 @@ namespace OpenSim.Framework
1303 xtr.ReadEndElement(); 1309 xtr.ReadEndElement();
1304 } 1310 }
1305 } 1311 }
1306 } 1312 }
1313
1314 public void ReadXml(XmlReader reader)
1315 {
1316 if (reader.IsEmptyElement)
1317 return;
1318
1319 ReadXml(reader.ReadInnerXml());
1320 }
1307 } 1321 }
1308 } 1322 }
1309} \ No newline at end of file 1323} \ No newline at end of file