aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Capabilities/LLSDHelpers.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Capabilities/LLSDHelpers.cs')
-rw-r--r--OpenSim/Capabilities/LLSDHelpers.cs27
1 files changed, 26 insertions, 1 deletions
diff --git a/OpenSim/Capabilities/LLSDHelpers.cs b/OpenSim/Capabilities/LLSDHelpers.cs
index d582267..4a7c6a5 100644
--- a/OpenSim/Capabilities/LLSDHelpers.cs
+++ b/OpenSim/Capabilities/LLSDHelpers.cs
@@ -30,6 +30,7 @@ using System.Collections;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Xml; 32using System.Xml;
33using OpenMetaverse;
33 34
34namespace OpenSim.Framework.Capabilities 35namespace OpenSim.Framework.Capabilities
35{ 36{
@@ -53,6 +54,19 @@ namespace OpenSim.Framework.Capabilities
53 return sw.ToString(); 54 return sw.ToString();
54 } 55 }
55 56
57 public static string SerialiseLLSDReplyNoHeader(object obj)
58 {
59 StringWriter sw = new StringWriter();
60 XmlTextWriter writer = new XmlTextWriter(sw);
61 writer.Formatting = Formatting.None;
62 SerializeOSDType(writer, obj);
63 writer.Close();
64
65 //m_log.DebugFormat("[LLSD Helpers]: Generated serialized LLSD reply {0}", sw.ToString());
66
67 return sw.ToString();
68 }
69
56 private static void SerializeOSDType(XmlTextWriter writer, object obj) 70 private static void SerializeOSDType(XmlTextWriter writer, object obj)
57 { 71 {
58 Type myType = obj.GetType(); 72 Type myType = obj.GetType();
@@ -160,7 +174,18 @@ namespace OpenSim.Framework.Capabilities
160 else if(enumerator.Value is Boolean && field.FieldType == typeof(int) ) 174 else if(enumerator.Value is Boolean && field.FieldType == typeof(int) )
161 { 175 {
162 int i = (bool)enumerator.Value ? 1 : 0; 176 int i = (bool)enumerator.Value ? 1 : 0;
163 field.SetValue(obj, (object)i); 177 field.SetValue(obj, i);
178 }
179 else if(field.FieldType == typeof(bool) && enumerator.Value is int)
180 {
181 bool b = (int)enumerator.Value != 0;
182 field.SetValue(obj, b);
183 }
184 else if(field.FieldType == typeof(UUID) && enumerator.Value is string)
185 {
186 UUID u;
187 UUID.TryParse((string)enumerator.Value, out u);
188 field.SetValue(obj, u);
164 } 189 }
165 else 190 else
166 { 191 {