本文整理汇总了C#中OpenSim.Region.Framework.Scenes.SceneObjectGroup.LoadScriptState方法的典型用法代码示例。如果您正苦于以下问题:C# SceneObjectGroup.LoadScriptState方法的具体用法?C# SceneObjectGroup.LoadScriptState怎么用?C# SceneObjectGroup.LoadScriptState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.SceneObjectGroup
的用法示例。
在下文中一共展示了SceneObjectGroup.LoadScriptState方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromOriginalXmlFormat
/// <summary>
/// Deserialize a scene object from the original xml format
/// </summary>
/// <param name="xmlData"></param>
/// <returns>The scene object deserialized. Null on failure.</returns>
public static SceneObjectGroup FromOriginalXmlFormat(string xmlData)
{
//m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
//int time = System.Environment.TickCount;
try
{
StringReader sr;
XmlTextReader reader;
XmlNodeList parts;
XmlDocument doc;
int linkNum;
doc = new XmlDocument();
doc.LoadXml(xmlData);
parts = doc.GetElementsByTagName("RootPart");
if (parts.Count == 0)
throw new Exception("Invalid Xml format - no root part");
sr = new StringReader(parts[0].InnerXml);
reader = new XmlTextReader(sr);
SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader));
reader.Close();
sr.Close();
parts = doc.GetElementsByTagName("Part");
for (int i = 0; i < parts.Count; i++)
{
sr = new StringReader(parts[i].InnerXml);
reader = new XmlTextReader(sr);
SceneObjectPart part = SceneObjectPart.FromXml(reader);
linkNum = part.LinkNum;
sceneObject.AddPart(part);
part.LinkNum = linkNum;
part.TrimPermissions();
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)
{
m_log.ErrorFormat(
"[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
return null;
}
}
示例2: FromOriginalXmlFormat
/// <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, IRegistryCore scene)
{
//m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
//int time = Util.EnvironmentTickCount();
try
{
StringReader sr;
XmlTextReader reader;
XmlNodeList parts;
XmlDocument doc;
doc = new XmlDocument();
doc.LoadXml(xmlData);
parts = doc.GetElementsByTagName("RootPart");
if (parts.Count == 0)
throw new Exception("Invalid Xml format - no root part");
sr = new StringReader(parts[0].InnerXml);
reader = new XmlTextReader(sr);
Scene m_sceneForGroup = scene is Scene ? (Scene)scene : null;
SceneObjectGroup sceneObject = new SceneObjectGroup(FromXml(reader, scene), m_sceneForGroup, false);
sceneObject.RootPart.FromUserInventoryItemID = fromUserInventoryItemID;
reader.Close();
sr.Close();
parts = doc.GetElementsByTagName("Part");
for (int i = 0; i < parts.Count; i++)
{
sr = new StringReader(parts[i].InnerXml);
reader = new XmlTextReader(sr);
SceneObjectPart part = FromXml(reader, scene);
sceneObject.AddChild(part, part.LinkNum);
part.TrimPermissions();
part.StoreUndoState();
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)
{
m_log.ErrorFormat(
"[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
return null;
}
}
示例3: FromXml2Format
public static SceneObjectGroup FromXml2Format(string xmlData)
{
//m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
//int time = System.Environment.TickCount;
try
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlData);
XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart");
if (parts.Count == 0)
{
m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed: No SceneObjectPart nodes. xml was " + xmlData);
return null;
}
StringReader sr = new StringReader(parts[0].OuterXml);
XmlTextReader reader = new XmlTextReader(sr);
SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader));
reader.Close();
sr.Close();
// Then deal with the rest
for (int i = 1; i < parts.Count; i++)
{
sr = new StringReader(parts[i].OuterXml);
reader = new XmlTextReader(sr);
SceneObjectPart part = SceneObjectPart.FromXml(reader);
int originalLinkNum = part.LinkNum;
sceneObject.AddPart(part);
// SceneObjectGroup.AddPart() tries to be smart and automatically set the LinkNum.
// We override that here
if (originalLinkNum != 0)
part.LinkNum = originalLinkNum;
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)
{
m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
return null;
}
}
示例4: FromXml2Format
public static SceneObjectGroup FromXml2Format(string xmlData, Scene scene)
{
//m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
//int time = Util.EnvironmentTickCount();
try
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlData);
XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart");
if (parts.Count == 0)
{
m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed: No SceneObjectPart nodes. xml was " + xmlData);
return null;
}
StringReader sr = new StringReader(parts[0].OuterXml);
XmlTextReader reader = new XmlTextReader(sr);
SceneObjectGroup sceneObject = new SceneObjectGroup(FromXml(reader, scene), scene);
reader.Close();
sr.Close();
// Then deal with the rest
for (int i = 1; i < parts.Count; i++)
{
sr = new StringReader(parts[i].OuterXml);
reader = new XmlTextReader(sr);
SceneObjectPart part = FromXml(reader, scene);
sceneObject.AddChild(part, part.LinkNum);
part.StoreUndoState();
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)
{
m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
return null;
}
}
示例5: FromXml2Format
public static SceneObjectGroup FromXml2Format(string xmlData)
{
//m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
//int time = System.Environment.TickCount;
// libomv.types changes UUID to Guid
xmlData = xmlData.Replace("<UUID>", "<Guid>");
xmlData = xmlData.Replace("</UUID>", "</Guid>");
// Handle Nested <UUID><UUID> property
xmlData = xmlData.Replace("<Guid><Guid>", "<UUID><Guid>");
xmlData = xmlData.Replace("</Guid></Guid>", "</Guid></UUID>");
try
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlData);
XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart");
if (parts.Count == 0)
{
m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed: No SceneObjectPart nodes. xml was " + xmlData);
return null;
}
StringReader sr = new StringReader(parts[0].OuterXml);
XmlTextReader reader = new XmlTextReader(sr);
SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader));
reader.Close();
sr.Close();
// Then deal with the rest
for (int i = 1; i < parts.Count; i++)
{
sr = new StringReader(parts[i].OuterXml);
reader = new XmlTextReader(sr);
SceneObjectPart part = SceneObjectPart.FromXml(reader);
sceneObject.AddPart(part);
part.StoreUndoState();
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)
{
m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
return null;
}
}
示例6: FromOriginalXmlFormat
/// <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)
{
//m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
//int time = System.Environment.TickCount;
SceneObjectGroup sceneObject = new SceneObjectGroup();
// libomv.types changes UUID to Guid
xmlData = xmlData.Replace("<UUID>", "<Guid>");
xmlData = xmlData.Replace("</UUID>", "</Guid>");
// Handle Nested <UUID><UUID> property
xmlData = xmlData.Replace("<Guid><Guid>", "<UUID><Guid>");
xmlData = xmlData.Replace("</Guid></Guid>", "</Guid></UUID>");
try
{
StringReader sr;
XmlTextReader reader;
XmlNodeList parts;
XmlDocument doc;
int linkNum;
doc = new XmlDocument();
doc.LoadXml(xmlData);
parts = doc.GetElementsByTagName("RootPart");
if (parts.Count == 0)
{
throw new Exception("Invalid Xml format - no root part");
}
else
{
sr = new StringReader(parts[0].InnerXml);
reader = new XmlTextReader(sr);
sceneObject.SetRootPart(SceneObjectPart.FromXml(fromUserInventoryItemID, reader));
reader.Close();
sr.Close();
}
parts = doc.GetElementsByTagName("Part");
for (int i = 0; i < parts.Count; i++)
{
sr = new StringReader(parts[i].InnerXml);
reader = new XmlTextReader(sr);
SceneObjectPart part = SceneObjectPart.FromXml(reader);
linkNum = part.LinkNum;
sceneObject.AddPart(part);
part.LinkNum = linkNum;
part.TrimPermissions();
part.StoreUndoState();
reader.Close();
sr.Close();
}
// Script state may, or may not, exist. Not having any, is NOT
// ever a problem.
sceneObject.LoadScriptState(doc);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
}
//m_log.DebugFormat("[SERIALIZER]: Finished deserialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time);
return sceneObject;
}
示例7: FromXml2Format
public static SceneObjectGroup FromXml2Format(string xmlData)
{
//m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
//int time = System.Environment.TickCount;
SceneObjectGroup sceneObject = new SceneObjectGroup();
// libomv.types changes UUID to Guid
xmlData = xmlData.Replace("<UUID>", "<Guid>");
xmlData = xmlData.Replace("</UUID>", "</Guid>");
// Handle Nested <UUID><UUID> property
xmlData = xmlData.Replace("<Guid><Guid>", "<UUID><Guid>");
xmlData = xmlData.Replace("</Guid></Guid>", "</Guid></UUID>");
try
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlData);
XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart");
// Process the root part first
if (parts.Count > 0)
{
StringReader sr = new StringReader(parts[0].OuterXml);
XmlTextReader reader = new XmlTextReader(sr);
sceneObject.SetRootPart(SceneObjectPart.FromXml(reader));
reader.Close();
sr.Close();
}
// Then deal with the rest
for (int i = 1; i < parts.Count; i++)
{
StringReader sr = new StringReader(parts[i].OuterXml);
XmlTextReader reader = new XmlTextReader(sr);
SceneObjectPart part = SceneObjectPart.FromXml(reader);
int originalLinkNum = part.LinkNum;
sceneObject.AddPart(part);
// SceneObjectGroup.AddPart() tries to be smart and automatically set the LinkNum.
// We override that here
if (originalLinkNum != 0)
part.LinkNum = originalLinkNum;
part.StoreUndoState();
reader.Close();
sr.Close();
}
// Script state may, or may not, exist. Not having any, is NOT
// ever a problem.
sceneObject.LoadScriptState(doc);
//m_log.DebugFormat("[SERIALIZER]: Finished deserialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time);
return sceneObject;
}
catch (Exception e)
{
m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
}
return null;
}