diff options
author | UbitUmarov | 2018-01-25 08:02:45 +0000 |
---|---|---|
committer | UbitUmarov | 2018-01-25 08:02:45 +0000 |
commit | cdd3ef857c296a3aee88eea0386d166222684c04 (patch) | |
tree | de610b2876f25e4cab0009a12c4e05ed4f345946 /OpenSim/Framework/LLSDxmlEncode.cs | |
parent | add a low level LLSDxml encoder for cases where it makes no sense to use more... (diff) | |
download | opensim-SC-cdd3ef857c296a3aee88eea0386d166222684c04.zip opensim-SC-cdd3ef857c296a3aee88eea0386d166222684c04.tar.gz opensim-SC-cdd3ef857c296a3aee88eea0386d166222684c04.tar.bz2 opensim-SC-cdd3ef857c296a3aee88eea0386d166222684c04.tar.xz |
a few changes to encoder and a few more uses
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/LLSDxmlEncode.cs | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/OpenSim/Framework/LLSDxmlEncode.cs b/OpenSim/Framework/LLSDxmlEncode.cs index afa0214..e095363 100644 --- a/OpenSim/Framework/LLSDxmlEncode.cs +++ b/OpenSim/Framework/LLSDxmlEncode.cs | |||
@@ -40,7 +40,7 @@ namespace OpenSim.Framework | |||
40 | { | 40 | { |
41 | static readonly DateTime depoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); | 41 | static readonly DateTime depoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); |
42 | 42 | ||
43 | public static void AddStartHeader(StringBuilder sb, bool addxmlversion = false) | 43 | public static void AddStart(StringBuilder sb, bool addxmlversion = false) |
44 | { | 44 | { |
45 | if(addxmlversion) | 45 | if(addxmlversion) |
46 | sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><llsd>"); // legacy llsd xml name still valid | 46 | sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><llsd>"); // legacy llsd xml name still valid |
@@ -48,13 +48,13 @@ namespace OpenSim.Framework | |||
48 | sb.Append("<llsd>"); | 48 | sb.Append("<llsd>"); |
49 | } | 49 | } |
50 | 50 | ||
51 | public static void AddEndHeader(StringBuilder sb) | 51 | public static void AddEnd(StringBuilder sb) |
52 | { | 52 | { |
53 | sb.Append("</llsd>"); | 53 | sb.Append("</llsd>"); |
54 | } | 54 | } |
55 | 55 | ||
56 | // map == a list of key value pairs | 56 | // map == a list of key value pairs |
57 | public static void AddStartMap(StringBuilder sb) | 57 | public static void AddMap(StringBuilder sb) |
58 | { | 58 | { |
59 | sb.Append("<map>"); | 59 | sb.Append("<map>"); |
60 | } | 60 | } |
@@ -70,7 +70,7 @@ namespace OpenSim.Framework | |||
70 | } | 70 | } |
71 | 71 | ||
72 | // array == a list values | 72 | // array == a list values |
73 | public static void AddStartArray(StringBuilder sb) | 73 | public static void AddArray(StringBuilder sb) |
74 | { | 74 | { |
75 | sb.Append("<array>"); | 75 | sb.Append("<array>"); |
76 | } | 76 | } |
@@ -99,6 +99,18 @@ namespace OpenSim.Framework | |||
99 | sb.Append("<boolean />"); | 99 | sb.Append("<boolean />"); |
100 | } | 100 | } |
101 | 101 | ||
102 | public static void AddElem(byte e, StringBuilder sb) | ||
103 | { | ||
104 | if(e == 0) | ||
105 | sb.Append("<integer />"); | ||
106 | else | ||
107 | { | ||
108 | sb.Append("<integer>"); | ||
109 | sb.Append(e.ToString()); | ||
110 | sb.Append("</integer>"); | ||
111 | } | ||
112 | } | ||
113 | |||
102 | public static void AddElem(int e, StringBuilder sb) | 114 | public static void AddElem(int e, StringBuilder sb) |
103 | { | 115 | { |
104 | if(e == 0) | 116 | if(e == 0) |
@@ -171,7 +183,7 @@ namespace OpenSim.Framework | |||
171 | } | 183 | } |
172 | } | 184 | } |
173 | 185 | ||
174 | public static void AddURIElem(Uri e, StringBuilder sb) | 186 | public static void AddElem(Uri e, StringBuilder sb) |
175 | { | 187 | { |
176 | if(e == null) | 188 | if(e == null) |
177 | { | 189 | { |
@@ -218,7 +230,7 @@ namespace OpenSim.Framework | |||
218 | //************ key value ******************* | 230 | //************ key value ******************* |
219 | // assumes name is a valid llsd key | 231 | // assumes name is a valid llsd key |
220 | 232 | ||
221 | public static void AddStartMap(string name, StringBuilder sb) | 233 | public static void AddMap(string name, StringBuilder sb) |
222 | { | 234 | { |
223 | sb.Append("<key>"); | 235 | sb.Append("<key>"); |
224 | sb.Append(name); | 236 | sb.Append(name); |
@@ -233,7 +245,7 @@ namespace OpenSim.Framework | |||
233 | } | 245 | } |
234 | 246 | ||
235 | // array == a list values | 247 | // array == a list values |
236 | public static void AddStartArray(string name, StringBuilder sb) | 248 | public static void AddArray(string name, StringBuilder sb) |
237 | { | 249 | { |
238 | sb.Append("<key>"); | 250 | sb.Append("<key>"); |
239 | sb.Append(name); | 251 | sb.Append(name); |
@@ -267,6 +279,22 @@ namespace OpenSim.Framework | |||
267 | sb.Append("<boolean />"); | 279 | sb.Append("<boolean />"); |
268 | } | 280 | } |
269 | 281 | ||
282 | public static void AddElem(string name, byte e, StringBuilder sb) | ||
283 | { | ||
284 | sb.Append("<key>"); | ||
285 | sb.Append(name); | ||
286 | sb.Append("</key>"); | ||
287 | |||
288 | if(e == 0) | ||
289 | sb.Append("<integer />"); | ||
290 | else | ||
291 | { | ||
292 | sb.Append("<integer>"); | ||
293 | sb.Append(e.ToString()); | ||
294 | sb.Append("</integer>"); | ||
295 | } | ||
296 | } | ||
297 | |||
270 | public static void AddElem(string name, int e, StringBuilder sb) | 298 | public static void AddElem(string name, int e, StringBuilder sb) |
271 | { | 299 | { |
272 | sb.Append("<key>"); | 300 | sb.Append("<key>"); |
@@ -363,7 +391,7 @@ namespace OpenSim.Framework | |||
363 | } | 391 | } |
364 | } | 392 | } |
365 | 393 | ||
366 | public static void AddURIElem(string name, Uri e, StringBuilder sb) | 394 | public static void AddElem(string name, Uri e, StringBuilder sb) |
367 | { | 395 | { |
368 | sb.Append("<key>"); | 396 | sb.Append("<key>"); |
369 | sb.Append(name); | 397 | sb.Append(name); |