diff options
author | UbitUmarov | 2018-01-27 05:35:40 +0000 |
---|---|---|
committer | UbitUmarov | 2018-01-27 05:35:40 +0000 |
commit | f89b2379a05c53d38643f0c8bdeddfb376dd2737 (patch) | |
tree | 255a2f306bef7f6e1769b936e1990338f4584bda /OpenSim/Framework/LLSDxmlEncode.cs | |
parent | add Cap_FetchLib2 note that this is still local to regions, not using grid as... (diff) | |
download | opensim-SC-f89b2379a05c53d38643f0c8bdeddfb376dd2737.zip opensim-SC-f89b2379a05c53d38643f0c8bdeddfb376dd2737.tar.gz opensim-SC-f89b2379a05c53d38643f0c8bdeddfb376dd2737.tar.bz2 opensim-SC-f89b2379a05c53d38643f0c8bdeddfb376dd2737.tar.xz |
add a few more encoding to LLSDxmlEncode.. (W or S ?)
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/LLSDxmlEncode.cs | 224 |
1 files changed, 224 insertions, 0 deletions
diff --git a/OpenSim/Framework/LLSDxmlEncode.cs b/OpenSim/Framework/LLSDxmlEncode.cs index bd99cd6..a740866 100644 --- a/OpenSim/Framework/LLSDxmlEncode.cs +++ b/OpenSim/Framework/LLSDxmlEncode.cs | |||
@@ -128,6 +128,18 @@ namespace OpenSim.Framework | |||
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
131 | public static void AddElem(byte[] e, StringBuilder sb) | ||
132 | { | ||
133 | if(e == null || e.Length == 0) | ||
134 | sb.Append("binary />"); | ||
135 | else | ||
136 | { | ||
137 | sb.Append("<binary>"); // encode64 is default | ||
138 | sb.Append(Convert.ToBase64String(e,Base64FormattingOptions.None)); | ||
139 | sb.Append("</binary>"); | ||
140 | } | ||
141 | } | ||
142 | |||
131 | public static void AddElem(int e, StringBuilder sb) | 143 | public static void AddElem(int e, StringBuilder sb) |
132 | { | 144 | { |
133 | if(e == 0) | 145 | if(e == 0) |
@@ -152,6 +164,101 @@ namespace OpenSim.Framework | |||
152 | } | 164 | } |
153 | } | 165 | } |
154 | 166 | ||
167 | public static void AddElem(Vector2 e, StringBuilder sb) | ||
168 | { | ||
169 | sb.Append("<map><key>x</key>"); | ||
170 | |||
171 | if(e.X == 0) | ||
172 | sb.Append("<real /><key>y</key>"); | ||
173 | else | ||
174 | { | ||
175 | sb.Append("<real>"); | ||
176 | sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); | ||
177 | sb.Append("</real><key>y</key>"); | ||
178 | } | ||
179 | |||
180 | if(e.Y == 0) | ||
181 | sb.Append("<real /></map>"); | ||
182 | else | ||
183 | { | ||
184 | sb.Append("<real>"); | ||
185 | sb.Append(e.Y.ToString(CultureInfo.InvariantCulture)); | ||
186 | sb.Append("</real></map>"); | ||
187 | } | ||
188 | } | ||
189 | |||
190 | public static void AddElem(Vector3 e, StringBuilder sb) | ||
191 | { | ||
192 | sb.Append("<map>key>x</key>"); | ||
193 | |||
194 | if(e.X == 0) | ||
195 | sb.Append("<real /><key>y</key>"); | ||
196 | else | ||
197 | { | ||
198 | sb.Append("<real>"); | ||
199 | sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); | ||
200 | sb.Append("</real><key>y</key>"); | ||
201 | } | ||
202 | |||
203 | if(e.Y == 0) | ||
204 | sb.Append("<real /><key>z</key>"); | ||
205 | else | ||
206 | { | ||
207 | sb.Append("<real>"); | ||
208 | sb.Append(e.Y.ToString(CultureInfo.InvariantCulture)); | ||
209 | sb.Append("</real><key>z</key>"); | ||
210 | } | ||
211 | |||
212 | if(e.Z == 0) | ||
213 | sb.Append("<real /></map>"); | ||
214 | else | ||
215 | { | ||
216 | sb.Append("<real>"); | ||
217 | sb.Append(e.Z.ToString(CultureInfo.InvariantCulture)); | ||
218 | sb.Append("</real></map>"); | ||
219 | } | ||
220 | } | ||
221 | |||
222 | public static void AddElem(Quaternion e, StringBuilder sb) | ||
223 | { | ||
224 | sb.Append("<map><key>x</key>"); | ||
225 | |||
226 | if(e.X == 0) | ||
227 | sb.Append("<real /><key>y</key>"); | ||
228 | else | ||
229 | { | ||
230 | sb.Append("<real>"); | ||
231 | sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); | ||
232 | sb.Append("</real><key>y</key>"); | ||
233 | } | ||
234 | |||
235 | if(e.Y == 0) | ||
236 | sb.Append("<real /><key>z</key>"); | ||
237 | else | ||
238 | { | ||
239 | sb.Append("<real>"); | ||
240 | sb.Append(e.Y.ToString(CultureInfo.InvariantCulture)); | ||
241 | sb.Append("</real><key>z</key>"); | ||
242 | } | ||
243 | if(e.Z == 0) | ||
244 | sb.Append("<real /><key>w</key>"); | ||
245 | else | ||
246 | { | ||
247 | sb.Append("<real>"); | ||
248 | sb.Append(e.Z.ToString(CultureInfo.InvariantCulture)); | ||
249 | sb.Append("</real><key>w</key>"); | ||
250 | } | ||
251 | |||
252 | if(e.W == 0) | ||
253 | sb.Append("<real /></map>"); | ||
254 | else | ||
255 | { | ||
256 | sb.Append("<real>"); | ||
257 | sb.Append(e.W.ToString(CultureInfo.InvariantCulture)); | ||
258 | sb.Append("</real></map>"); | ||
259 | } | ||
260 | } | ||
261 | |||
155 | public static void AddElem(double e, StringBuilder sb) | 262 | public static void AddElem(double e, StringBuilder sb) |
156 | { | 263 | { |
157 | if(e == 0) | 264 | if(e == 0) |
@@ -312,6 +419,22 @@ namespace OpenSim.Framework | |||
312 | } | 419 | } |
313 | } | 420 | } |
314 | 421 | ||
422 | public static void AddElem(string name, byte[] e, StringBuilder sb) | ||
423 | { | ||
424 | sb.Append("<key>"); | ||
425 | sb.Append(name); | ||
426 | sb.Append("</key>"); | ||
427 | |||
428 | if(e == null || e.Length == 0) | ||
429 | sb.Append("binary />"); | ||
430 | else | ||
431 | { | ||
432 | sb.Append("<binary>"); // encode64 is default | ||
433 | sb.Append(Convert.ToBase64String(e,Base64FormattingOptions.None)); | ||
434 | sb.Append("</binary>"); | ||
435 | } | ||
436 | } | ||
437 | |||
315 | public static void AddElem(string name, int e, StringBuilder sb) | 438 | public static void AddElem(string name, int e, StringBuilder sb) |
316 | { | 439 | { |
317 | sb.Append("<key>"); | 440 | sb.Append("<key>"); |
@@ -344,6 +467,107 @@ namespace OpenSim.Framework | |||
344 | } | 467 | } |
345 | } | 468 | } |
346 | 469 | ||
470 | public static void AddElem(string name, Vector2 e, StringBuilder sb) | ||
471 | { | ||
472 | sb.Append("<key>"); | ||
473 | sb.Append(name); | ||
474 | sb.Append("</key><map><key>x</key>"); | ||
475 | |||
476 | if(e.X == 0) | ||
477 | sb.Append("<real /><key>y</key>"); | ||
478 | else | ||
479 | { | ||
480 | sb.Append("<real>"); | ||
481 | sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); | ||
482 | sb.Append("</real><key>y</key>"); | ||
483 | } | ||
484 | |||
485 | if(e.Y == 0) | ||
486 | sb.Append("<real /></map>"); | ||
487 | else | ||
488 | { | ||
489 | sb.Append("<real>"); | ||
490 | sb.Append(e.Y.ToString(CultureInfo.InvariantCulture)); | ||
491 | sb.Append("</real></map>"); | ||
492 | } | ||
493 | } | ||
494 | |||
495 | public static void AddElem(string name, Vector3 e, StringBuilder sb) | ||
496 | { | ||
497 | sb.Append("<key>"); | ||
498 | sb.Append(name); | ||
499 | sb.Append("</key><map>key>x</key>"); | ||
500 | |||
501 | if(e.X == 0) | ||
502 | sb.Append("<real /><key>y</key>"); | ||
503 | else | ||
504 | { | ||
505 | sb.Append("<real>"); | ||
506 | sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); | ||
507 | sb.Append("</real><key>y</key>"); | ||
508 | } | ||
509 | |||
510 | if(e.Y == 0) | ||
511 | sb.Append("<real /><key>z</key>"); | ||
512 | else | ||
513 | { | ||
514 | sb.Append("<real>"); | ||
515 | sb.Append(e.Y.ToString(CultureInfo.InvariantCulture)); | ||
516 | sb.Append("</real><key>z</key>"); | ||
517 | } | ||
518 | |||
519 | if(e.Z == 0) | ||
520 | sb.Append("<real /></map>"); | ||
521 | else | ||
522 | { | ||
523 | sb.Append("<real>"); | ||
524 | sb.Append(e.Z.ToString(CultureInfo.InvariantCulture)); | ||
525 | sb.Append("</real></map>"); | ||
526 | } | ||
527 | } | ||
528 | |||
529 | public static void AddElem(string name, Quaternion e, StringBuilder sb) | ||
530 | { | ||
531 | sb.Append("<key>"); | ||
532 | sb.Append(name); | ||
533 | sb.Append("</key><map><key>x</key>"); | ||
534 | |||
535 | if(e.X == 0) | ||
536 | sb.Append("<real /><key>y</key>"); | ||
537 | else | ||
538 | { | ||
539 | sb.Append("<real>"); | ||
540 | sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); | ||
541 | sb.Append("</real><key>y</key>"); | ||
542 | } | ||
543 | |||
544 | if(e.Y == 0) | ||
545 | sb.Append("<real /><key>z</key>"); | ||
546 | else | ||
547 | { | ||
548 | sb.Append("<real>"); | ||
549 | sb.Append(e.Y.ToString(CultureInfo.InvariantCulture)); | ||
550 | sb.Append("</real><key>z</key>"); | ||
551 | } | ||
552 | if(e.Z == 0) | ||
553 | sb.Append("<real /><key>w</key>"); | ||
554 | else | ||
555 | { | ||
556 | sb.Append("<real>"); | ||
557 | sb.Append(e.Z.ToString(CultureInfo.InvariantCulture)); | ||
558 | sb.Append("</real><key>w</key>"); | ||
559 | } | ||
560 | |||
561 | if(e.W == 0) | ||
562 | sb.Append("<real /></map>"); | ||
563 | else | ||
564 | { | ||
565 | sb.Append("<real>"); | ||
566 | sb.Append(e.W.ToString(CultureInfo.InvariantCulture)); | ||
567 | sb.Append("</real></map>"); | ||
568 | } | ||
569 | } | ||
570 | |||
347 | public static void AddElem(string name, double e, StringBuilder sb) | 571 | public static void AddElem(string name, double e, StringBuilder sb) |
348 | { | 572 | { |
349 | sb.Append("<key>"); | 573 | sb.Append("<key>"); |