public void DeserializeUUID() { OSD theSD = null; OSDArray array = null; OSDUUID tempUUID = null; String testSD = @"<?xml version='1.0' encoding='UTF-8'?> <llsd> <array> <uuid>d7f4aeca-88f1-42a1-b385-b9db18abb255</uuid> <uuid/> </array> </llsd>"; //Deserialize the string byte[] bytes = Encoding.UTF8.GetBytes(testSD); theSD = OSDParser.DeserializeLLSDXml(bytes); Assert.IsTrue(theSD is OSDArray); array = (OSDArray)theSD; Assert.AreEqual(OSDType.UUID, array[0].Type); tempUUID = (OSDUUID)array[0]; Assert.AreEqual(new UUID("d7f4aeca-88f1-42a1-b385-b9db18abb255"), tempUUID.AsUUID()); Assert.AreEqual(OSDType.UUID, array[1].Type); tempUUID = (OSDUUID)array[1]; Assert.AreEqual(UUID.Zero, tempUUID.AsUUID()); }
public void DeserializeLLSDSample() { OSD theSD = null; OSDMap map = null; OSD tempSD = null; OSDUUID tempUUID = null; OSDString tempStr = null; OSDReal tempReal = null; String testSD = @"<?xml version='1.0' encoding='UTF-8'?> <llsd> <map> <key>region_id</key> <uuid>67153d5b-3659-afb4-8510-adda2c034649</uuid> <key>scale</key> <string>one minute</string> <key>simulator statistics</key> <map> <key>time dilation</key> <real>0.9878624</real> <key>sim fps</key> <real>44.38898</real> <key>agent updates per second</key> <real>nan</real> <key>total task count</key> <real>4</real> <key>active task count</key> <real>0</real> <key>pending uploads</key> <real>0.0001096525</real> </map> </map> </llsd>"; //Deserialize the string byte[] bytes = Encoding.UTF8.GetBytes(testSD); theSD = OSDParser.DeserializeLLSDXml(bytes); //Confirm the contents Assert.IsNotNull(theSD); Assert.IsTrue(theSD is OSDMap); Assert.IsTrue(theSD.Type == OSDType.Map); map = (OSDMap)theSD; tempSD = map["region_id"]; Assert.IsNotNull(tempSD); Assert.IsTrue(tempSD is OSDUUID); Assert.IsTrue(tempSD.Type == OSDType.UUID); tempUUID = (OSDUUID)tempSD; Assert.AreEqual(new UUID("67153d5b-3659-afb4-8510-adda2c034649"), tempUUID.AsUUID()); tempSD = map["scale"]; Assert.IsNotNull(tempSD); Assert.IsTrue(tempSD is OSDString); Assert.IsTrue(tempSD.Type == OSDType.String); tempStr = (OSDString)tempSD; Assert.AreEqual("one minute", tempStr.AsString()); tempSD = map["simulator statistics"]; Assert.IsNotNull(tempSD); Assert.IsTrue(tempSD is OSDMap); Assert.IsTrue(tempSD.Type == OSDType.Map); map = (OSDMap)tempSD; tempSD = map["time dilation"]; Assert.IsNotNull(tempSD); Assert.IsTrue(tempSD is OSDReal); Assert.IsTrue(tempSD.Type == OSDType.Real); tempReal = (OSDReal)tempSD; Assert.AreEqual(0.9878624d, tempReal.AsReal()); //TODO - figure out any relevant rounding variability for 64 bit reals tempSD = map["sim fps"]; Assert.IsNotNull(tempSD); Assert.IsTrue(tempSD is OSDReal); Assert.IsTrue(tempSD.Type == OSDType.Real); tempReal = (OSDReal)tempSD; Assert.AreEqual(44.38898d, tempReal.AsReal()); tempSD = map["agent updates per second"]; Assert.IsNotNull(tempSD); Assert.IsTrue(tempSD is OSDReal); Assert.IsTrue(tempSD.Type == OSDType.Real); tempReal = (OSDReal)tempSD; Assert.AreEqual(Double.NaN, tempSD.AsReal()); tempSD = map["total task count"]; Assert.IsNotNull(tempSD); Assert.IsTrue(tempSD is OSDReal); Assert.IsTrue(tempSD.Type == OSDType.Real); tempReal = (OSDReal)tempSD; Assert.AreEqual(4.0d, tempReal.AsReal()); tempSD = map["active task count"]; Assert.IsNotNull(tempSD); Assert.IsTrue(tempSD is OSDReal); Assert.IsTrue(tempSD.Type == OSDType.Real); tempReal = (OSDReal)tempSD; Assert.AreEqual(0.0d, tempReal.AsReal()); tempSD = map["pending uploads"]; Assert.IsNotNull(tempSD); Assert.IsTrue(tempSD is OSDReal); Assert.IsTrue(tempSD.Type == OSDType.Real); tempReal = (OSDReal)tempSD; Assert.AreEqual(0.0001096525d, tempReal.AsReal()); }
private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) { features["LSLSyntaxId"] = new OSDUUID(m_SyntaxID); }