mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 22:26:09 +08:00
Resolve merge commits, stage 1
This commit is contained in:
@@ -53,19 +53,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
/// <summary>
|
||||
/// Deserialize a scene object from the original xml format
|
||||
/// </summary>
|
||||
/// <param name="serialization"></param>
|
||||
/// <param name="xmlData"></param>
|
||||
/// <returns></returns>
|
||||
public static SceneObjectGroup FromOriginalXmlFormat(string serialization)
|
||||
{
|
||||
return FromOriginalXmlFormat(UUID.Zero, serialization);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserialize a scene object from the original xml format
|
||||
/// </summary>
|
||||
/// <param name="serialization"></param>
|
||||
/// <returns></returns>
|
||||
public static SceneObjectGroup FromOriginalXmlFormat(UUID fromUserInventoryItemID, string xmlData)
|
||||
public static SceneObjectGroup FromOriginalXmlFormat(string xmlData)
|
||||
{
|
||||
//m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
|
||||
//int time = System.Environment.TickCount;
|
||||
@@ -87,7 +77,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
|
||||
sr = new StringReader(parts[0].InnerXml);
|
||||
reader = new XmlTextReader(sr);
|
||||
SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(fromUserInventoryItemID, reader));
|
||||
SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader));
|
||||
reader.Close();
|
||||
sr.Close();
|
||||
|
||||
@@ -102,7 +92,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
sceneObject.AddPart(part);
|
||||
part.LinkNum = linkNum;
|
||||
part.TrimPermissions();
|
||||
part.StoreUndoState(UndoType.STATE_ALL);
|
||||
reader.Close();
|
||||
sr.Close();
|
||||
}
|
||||
@@ -127,27 +116,37 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
/// <param name="sceneObject"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject)
|
||||
{
|
||||
return ToOriginalXmlFormat(sceneObject, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serialize a scene object to the original xml format
|
||||
/// </summary>
|
||||
/// <param name="sceneObject"></param>
|
||||
/// <param name="doScriptStates">Control whether script states are also serialized.</para>
|
||||
/// <returns></returns>
|
||||
public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject, bool doScriptStates)
|
||||
{
|
||||
using (StringWriter sw = new StringWriter())
|
||||
{
|
||||
using (XmlTextWriter writer = new XmlTextWriter(sw))
|
||||
{
|
||||
ToOriginalXmlFormat(sceneObject, writer);
|
||||
ToOriginalXmlFormat(sceneObject, writer, doScriptStates);
|
||||
}
|
||||
|
||||
return sw.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Serialize a scene object to the original xml format
|
||||
/// </summary>
|
||||
/// <param name="sceneObject"></param>
|
||||
/// <returns></returns>
|
||||
public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer)
|
||||
public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer, bool doScriptStates)
|
||||
{
|
||||
ToOriginalXmlFormat(sceneObject, writer, false);
|
||||
ToOriginalXmlFormat(sceneObject, writer, doScriptStates, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -157,10 +156,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
/// <param name="writer"></param>
|
||||
/// <param name="noRootElement">If false, don't write the enclosing SceneObjectGroup element</param>
|
||||
/// <returns></returns>
|
||||
public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer, bool noRootElement)
|
||||
public static void ToOriginalXmlFormat(
|
||||
SceneObjectGroup sceneObject, XmlTextWriter writer, bool doScriptStates, bool noRootElement)
|
||||
{
|
||||
//m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", Name);
|
||||
//int time = System.Environment.TickCount;
|
||||
// m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", sceneObject.Name);
|
||||
// int time = System.Environment.TickCount;
|
||||
|
||||
if (!noRootElement)
|
||||
writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
|
||||
@@ -183,12 +183,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
}
|
||||
|
||||
writer.WriteEndElement(); // OtherParts
|
||||
sceneObject.SaveScriptedState(writer);
|
||||
|
||||
if (doScriptStates)
|
||||
sceneObject.SaveScriptedState(writer);
|
||||
|
||||
if (!noRootElement)
|
||||
writer.WriteEndElement(); // SceneObjectGroup
|
||||
|
||||
//m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time);
|
||||
// m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", sceneObject.Name, System.Environment.TickCount - time);
|
||||
}
|
||||
|
||||
protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer)
|
||||
@@ -236,15 +238,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
if (originalLinkNum != 0)
|
||||
part.LinkNum = originalLinkNum;
|
||||
|
||||
part.StoreUndoState(UndoType.STATE_ALL);
|
||||
reader.Close();
|
||||
sr.Close();
|
||||
}
|
||||
|
||||
// Script state may, or may not, exist. Not having any, is NOT
|
||||
// ever a problem.
|
||||
|
||||
sceneObject.LoadScriptState(doc);
|
||||
|
||||
return sceneObject;
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -1592,4 +1593,4 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user