From 3d938f76b7c2f8ede862f9979383d79dfb21372c Mon Sep 17 00:00:00 2001
From: Adam Johnson
Date: Fri, 7 Dec 2007 08:54:31 +0000
Subject: Updates to LibSL revision 1498. Thanks Johan!
---
OpenSim/Framework/Communications/Capabilities/Caps.cs | 2 +-
.../Communications/Capabilities/LLSDHelpers.cs | 18 ++++++++++--------
.../Communications/Capabilities/LLSDStreamHandler.cs | 6 ++++--
OpenSim/Framework/Util.cs | 6 ++++++
4 files changed, 21 insertions(+), 11 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index 4603280..f7cb20c 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -258,7 +258,7 @@ namespace OpenSim.Region.Capabilities
///
public string NoteCardAgentInventory(string request, string path, string param)
{
- Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Helpers.StringToField(request));
+ libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap)libsecondlife.StructuredData.LLSDParser.DeserializeBinary(Helpers.StringToField(request));
LLSDItemUpdate llsdRequest = new LLSDItemUpdate();
LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs
index 8252a63..793c366 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Region.Capabilities
return sw.ToString();
}
- public static void SerializeLLSDType(XmlTextWriter writer, object obj)
+ private static void SerializeLLSDType(XmlTextWriter writer, object obj)
{
Type myType = obj.GetType();
LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false);
@@ -76,7 +76,8 @@ namespace OpenSim.Region.Capabilities
writer.WriteStartElement(String.Empty, "key", String.Empty);
writer.WriteString(fields[i].Name);
writer.WriteEndElement();
- LLSD.LLSDWriteOne(writer, fieldValue);
+ libsecondlife.StructuredData.LLSDParser.SerializeXmlElement(
+ writer, libsecondlife.StructuredData.LLSD.FromObject(fieldValue));
}
}
writer.WriteEndElement();
@@ -99,11 +100,12 @@ namespace OpenSim.Region.Capabilities
}
else
{
- LLSD.LLSDWriteOne(writer, obj);
+ libsecondlife.StructuredData.LLSDParser.SerializeXmlElement(
+ writer, libsecondlife.StructuredData.LLSD.FromObject(obj));
}
}
-
- public static object DeserialiseLLSDMap(Hashtable llsd, object obj)
+
+ public static object DeserialiseLLSDMap(libsecondlife.StructuredData.LLSDMap llsd, object obj)
{
Type myType = obj.GetType();
LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false);
@@ -118,10 +120,10 @@ namespace OpenSim.Region.Capabilities
FieldInfo field = myType.GetField((string) enumerator.Key);
if (field != null)
{
- if (enumerator.Value is Hashtable)
+ if (enumerator.Value is libsecondlife.StructuredData.LLSDMap)
{
object fieldValue = field.GetValue(obj);
- DeserialiseLLSDMap((Hashtable) enumerator.Value, fieldValue);
+ DeserialiseLLSDMap((libsecondlife.StructuredData.LLSDMap) enumerator.Value, fieldValue);
}
else if (enumerator.Value is ArrayList)
{
@@ -143,4 +145,4 @@ namespace OpenSim.Region.Capabilities
return obj;
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs
index 08e9563..ed25e71 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs
@@ -31,6 +31,7 @@ using System.IO;
using System.Text;
using libsecondlife;
using OpenSim.Framework.Servers;
+using System.Xml;
namespace OpenSim.Region.Capabilities
{
@@ -53,7 +54,8 @@ namespace OpenSim.Region.Capabilities
//string requestBody = streamReader.ReadToEnd();
//streamReader.Close();
- Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request);
+ libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap)
+ libsecondlife.StructuredData.LLSDParser.DeserializeXml(new XmlTextReader(request));
TRequest llsdRequest = new TRequest();
LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
@@ -64,4 +66,4 @@ namespace OpenSim.Region.Capabilities
return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response));
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index c731561..a9aff60 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -46,6 +46,12 @@ namespace OpenSim.Framework
private static object XferLock = new object();
private static Dictionary capsURLS = new Dictionary();
+ public static double GetDistanceTo(LLVector3 a, LLVector3 b) {
+ float dx = a.X - b.X;
+ float dy = a.Y - b.Y;
+ float dz = a.Z - b.Z;
+ return Math.Sqrt(dx * dx + dy * dy + dz * dz);
+ }
public static ulong UIntsToLong(uint X, uint Y)
{
--
cgit v1.1