diff options
author | Adam Johnson | 2007-12-07 08:54:31 +0000 |
---|---|---|
committer | Adam Johnson | 2007-12-07 08:54:31 +0000 |
commit | 3d938f76b7c2f8ede862f9979383d79dfb21372c (patch) | |
tree | 0c99beb3affa959f596e079f20ed806364e3d3dc /OpenSim/Framework | |
parent | * Added hacked support for 'anyone can move' and 'anyone can copy'. (diff) | |
download | opensim-SC_OLD-3d938f76b7c2f8ede862f9979383d79dfb21372c.zip opensim-SC_OLD-3d938f76b7c2f8ede862f9979383d79dfb21372c.tar.gz opensim-SC_OLD-3d938f76b7c2f8ede862f9979383d79dfb21372c.tar.bz2 opensim-SC_OLD-3d938f76b7c2f8ede862f9979383d79dfb21372c.tar.xz |
Updates to LibSL revision 1498. Thanks Johan!
Diffstat (limited to 'OpenSim/Framework')
4 files changed, 21 insertions, 11 deletions
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 | |||
258 | /// <returns></returns> | 258 | /// <returns></returns> |
259 | public string NoteCardAgentInventory(string request, string path, string param) | 259 | public string NoteCardAgentInventory(string request, string path, string param) |
260 | { | 260 | { |
261 | Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Helpers.StringToField(request)); | 261 | libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap)libsecondlife.StructuredData.LLSDParser.DeserializeBinary(Helpers.StringToField(request)); |
262 | LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); | 262 | LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); |
263 | LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); | 263 | LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); |
264 | 264 | ||
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 | |||
48 | return sw.ToString(); | 48 | return sw.ToString(); |
49 | } | 49 | } |
50 | 50 | ||
51 | public static void SerializeLLSDType(XmlTextWriter writer, object obj) | 51 | private static void SerializeLLSDType(XmlTextWriter writer, object obj) |
52 | { | 52 | { |
53 | Type myType = obj.GetType(); | 53 | Type myType = obj.GetType(); |
54 | LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false); | 54 | LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false); |
@@ -76,7 +76,8 @@ namespace OpenSim.Region.Capabilities | |||
76 | writer.WriteStartElement(String.Empty, "key", String.Empty); | 76 | writer.WriteStartElement(String.Empty, "key", String.Empty); |
77 | writer.WriteString(fields[i].Name); | 77 | writer.WriteString(fields[i].Name); |
78 | writer.WriteEndElement(); | 78 | writer.WriteEndElement(); |
79 | LLSD.LLSDWriteOne(writer, fieldValue); | 79 | libsecondlife.StructuredData.LLSDParser.SerializeXmlElement( |
80 | writer, libsecondlife.StructuredData.LLSD.FromObject(fieldValue)); | ||
80 | } | 81 | } |
81 | } | 82 | } |
82 | writer.WriteEndElement(); | 83 | writer.WriteEndElement(); |
@@ -99,11 +100,12 @@ namespace OpenSim.Region.Capabilities | |||
99 | } | 100 | } |
100 | else | 101 | else |
101 | { | 102 | { |
102 | LLSD.LLSDWriteOne(writer, obj); | 103 | libsecondlife.StructuredData.LLSDParser.SerializeXmlElement( |
104 | writer, libsecondlife.StructuredData.LLSD.FromObject(obj)); | ||
103 | } | 105 | } |
104 | } | 106 | } |
105 | 107 | ||
106 | public static object DeserialiseLLSDMap(Hashtable llsd, object obj) | 108 | public static object DeserialiseLLSDMap(libsecondlife.StructuredData.LLSDMap llsd, object obj) |
107 | { | 109 | { |
108 | Type myType = obj.GetType(); | 110 | Type myType = obj.GetType(); |
109 | LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false); | 111 | LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false); |
@@ -118,10 +120,10 @@ namespace OpenSim.Region.Capabilities | |||
118 | FieldInfo field = myType.GetField((string) enumerator.Key); | 120 | FieldInfo field = myType.GetField((string) enumerator.Key); |
119 | if (field != null) | 121 | if (field != null) |
120 | { | 122 | { |
121 | if (enumerator.Value is Hashtable) | 123 | if (enumerator.Value is libsecondlife.StructuredData.LLSDMap) |
122 | { | 124 | { |
123 | object fieldValue = field.GetValue(obj); | 125 | object fieldValue = field.GetValue(obj); |
124 | DeserialiseLLSDMap((Hashtable) enumerator.Value, fieldValue); | 126 | DeserialiseLLSDMap((libsecondlife.StructuredData.LLSDMap) enumerator.Value, fieldValue); |
125 | } | 127 | } |
126 | else if (enumerator.Value is ArrayList) | 128 | else if (enumerator.Value is ArrayList) |
127 | { | 129 | { |
@@ -143,4 +145,4 @@ namespace OpenSim.Region.Capabilities | |||
143 | return obj; | 145 | return obj; |
144 | } | 146 | } |
145 | } | 147 | } |
146 | } \ No newline at end of file | 148 | } |
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; | |||
31 | using System.Text; | 31 | using System.Text; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | using OpenSim.Framework.Servers; | 33 | using OpenSim.Framework.Servers; |
34 | using System.Xml; | ||
34 | 35 | ||
35 | namespace OpenSim.Region.Capabilities | 36 | namespace OpenSim.Region.Capabilities |
36 | { | 37 | { |
@@ -53,7 +54,8 @@ namespace OpenSim.Region.Capabilities | |||
53 | //string requestBody = streamReader.ReadToEnd(); | 54 | //string requestBody = streamReader.ReadToEnd(); |
54 | //streamReader.Close(); | 55 | //streamReader.Close(); |
55 | 56 | ||
56 | Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request); | 57 | libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap) |
58 | libsecondlife.StructuredData.LLSDParser.DeserializeXml(new XmlTextReader(request)); | ||
57 | TRequest llsdRequest = new TRequest(); | 59 | TRequest llsdRequest = new TRequest(); |
58 | LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); | 60 | LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); |
59 | 61 | ||
@@ -64,4 +66,4 @@ namespace OpenSim.Region.Capabilities | |||
64 | return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response)); | 66 | return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response)); |
65 | } | 67 | } |
66 | } | 68 | } |
67 | } \ No newline at end of file | 69 | } |
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 | |||
46 | private static object XferLock = new object(); | 46 | private static object XferLock = new object(); |
47 | private static Dictionary<LLUUID, string> capsURLS = new Dictionary<LLUUID, string>(); | 47 | private static Dictionary<LLUUID, string> capsURLS = new Dictionary<LLUUID, string>(); |
48 | 48 | ||
49 | public static double GetDistanceTo(LLVector3 a, LLVector3 b) { | ||
50 | float dx = a.X - b.X; | ||
51 | float dy = a.Y - b.Y; | ||
52 | float dz = a.Z - b.Z; | ||
53 | return Math.Sqrt(dx * dx + dy * dy + dz * dz); | ||
54 | } | ||
49 | 55 | ||
50 | public static ulong UIntsToLong(uint X, uint Y) | 56 | public static ulong UIntsToLong(uint X, uint Y) |
51 | { | 57 | { |