Put a wrapper around the media texture region serialization
THIS WILL BREAK EXISTING MEDIA TEXTURE PERSISTENCE. Please delete your existing sqlite databases if you are experimenting with this branch. This wrapper will make it easier to maintain compatibility if the media texture data evolves. This will also make it easier to store non-sl media texture data.prebuild-update
parent
8e8076c947
commit
4736e38e79
|
@ -31,6 +31,7 @@ using System.Data;
|
|||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
using log4net;
|
||||
using Mono.Data.Sqlite;
|
||||
using OpenMetaverse;
|
||||
|
@ -1862,8 +1863,13 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
if (!(row["Media"] is System.DBNull))
|
||||
{
|
||||
string rawMeArray = (string)row["Media"];
|
||||
OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(rawMeArray);
|
||||
using (StringReader sr = new StringReader((string)row["Media"]))
|
||||
{
|
||||
using (XmlTextReader xtr = new XmlTextReader(sr))
|
||||
{
|
||||
xtr.ReadStartElement("osmedia");
|
||||
|
||||
OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml());
|
||||
|
||||
List<MediaEntry> mediaEntries = new List<MediaEntry>();
|
||||
foreach (OSD osdMe in osdMeArray)
|
||||
|
@ -1873,6 +1879,10 @@ namespace OpenSim.Data.SQLite
|
|||
}
|
||||
|
||||
s.Media = mediaEntries;
|
||||
|
||||
xtr.ReadEndElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
|
@ -1921,6 +1931,15 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
if (null != s.Media)
|
||||
{
|
||||
using (StringWriter sw = new StringWriter())
|
||||
{
|
||||
using (XmlTextWriter xtw = new XmlTextWriter(sw))
|
||||
{
|
||||
xtw.WriteStartElement("osmedia");
|
||||
xtw.WriteAttributeString("type", "sl");
|
||||
xtw.WriteAttributeString("major_version", "0");
|
||||
xtw.WriteAttributeString("minor_version", "1");
|
||||
|
||||
OSDArray meArray = new OSDArray();
|
||||
foreach (MediaEntry me in s.Media)
|
||||
{
|
||||
|
@ -1928,7 +1947,16 @@ namespace OpenSim.Data.SQLite
|
|||
meArray.Add(osd);
|
||||
}
|
||||
|
||||
row["Media"] = OSDParser.SerializeLLSDXmlString(meArray);
|
||||
xtw.WriteStartElement("osdata");
|
||||
xtw.WriteRaw(OSDParser.SerializeLLSDXmlString(meArray));
|
||||
xtw.WriteEndElement();
|
||||
|
||||
xtw.WriteEndElement();
|
||||
|
||||
xtw.Flush();
|
||||
row["Media"] = sw.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue