public static FromXml2Format ( string xmlData ) : SceneObjectGroup | ||
xmlData | string | |
Résultat | SceneObjectGroup |
public static SceneObjectGroup DeserializeGroupFromXml2(string xmlString) { XmlDocument doc = new XmlDocument(); XmlNode rootNode; XmlTextReader reader = new XmlTextReader(new StringReader(xmlString)); reader.WhitespaceHandling = WhitespaceHandling.None; doc.Load(reader); reader.Close(); rootNode = doc.FirstChild; // This is to deal with neighbouring regions that are still surrounding the group xml with the <scene> // tag. It should be possible to remove the first part of this if statement once we go past 0.5.9 (or // when some other changes forces all regions to upgrade). // This might seem rather pointless since prim crossing from this revision to an earlier revision remains // broken. But it isn't much work to accomodate the old format here. if (rootNode.LocalName.Equals("scene")) { foreach (XmlNode aPrimNode in rootNode.ChildNodes) { // There is only ever one prim. This oddity should be removeable post 0.5.9 return(SceneObjectSerializer.FromXml2Format(aPrimNode.OuterXml)); } return(null); } else { return(SceneObjectSerializer.FromXml2Format(rootNode.OuterXml)); } }
/// <summary> /// Create a prim from the xml2 representation. /// </summary> /// <param name="scene"></param> /// <param name="xmlData"></param> /// <returns>The scene object created. null if the scene object already existed</returns> protected static SceneObjectGroup CreatePrimFromXml2(Scene scene, string xmlData) { SceneObjectGroup obj = SceneObjectSerializer.FromXml2Format(xmlData); if (scene.AddRestoredSceneObject(obj, true, false)) { return(obj); } else { return(null); } }
public static SceneObjectGroup DeserializeGroupFromXml2(string xmlString, Scene scene) { XmlDocument doc = new XmlDocument(); XmlNode rootNode; XmlTextReader reader = new XmlTextReader(new StringReader(xmlString)); reader.WhitespaceHandling = WhitespaceHandling.None; doc.Load(reader); reader.Close(); rootNode = doc.FirstChild; return(SceneObjectSerializer.FromXml2Format(rootNode.OuterXml, scene)); }
public static SceneObjectGroup DeserializeGroupFromXml2(byte[] xml, IScene scene) { XmlDocument doc = new XmlDocument(); MemoryStream stream = new MemoryStream(xml); XmlTextReader reader = new XmlTextReader(stream) { WhitespaceHandling = WhitespaceHandling.None }; doc.Load(reader); reader.Close(); stream.Close(); XmlNode rootNode = doc.FirstChild; return(SceneObjectSerializer.FromXml2Format(rootNode.OuterXml, scene)); }
public static SceneObjectGroup DeserializeGroupFromXml2(string xmlString) { return(SceneObjectSerializer.FromXml2Format(xmlString)); }