Updates to LibSL revision 1498. Thanks Johan!

This commit is contained in:
Adam Johnson
2007-12-07 08:54:31 +00:00
parent 57f666497b
commit 3d938f76b7
14 changed files with 63 additions and 56 deletions

View File

@@ -258,7 +258,7 @@ namespace OpenSim.Region.Capabilities
/// <returns></returns>
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);

View File

@@ -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;
}
}
}
}

View File

@@ -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));
}
}
}
}

View File

@@ -46,6 +46,12 @@ namespace OpenSim.Framework
private static object XferLock = new object();
private static Dictionary<LLUUID, string> capsURLS = new Dictionary<LLUUID, string>();
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)
{