aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Capabilities/LLSD.cs
diff options
context:
space:
mode:
authorlbsa712007-12-27 21:41:48 +0000
committerlbsa712007-12-27 21:41:48 +0000
commitefd90b56b761219af6425b1c7a2cdd3b6ffb4de2 (patch)
treebf5b897e1e3c13211e3e2fc61d30508b94c928c0 /OpenSim/Framework/Communications/Capabilities/LLSD.cs
parent* removed always true if (diff)
downloadopensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.zip
opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.gz
opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.bz2
opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.xz
* Optimized usings
* shortened references * Removed redundant 'this' * Normalized EOF
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSD.cs42
1 files changed, 23 insertions, 19 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSD.cs b/OpenSim/Framework/Communications/Capabilities/LLSD.cs
index 987d6e6..dab926c 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSD.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSD.cs
@@ -1,4 +1,4 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
@@ -28,12 +28,12 @@
28 28
29using System; 29using System;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Globalization;
32using System.Xml;
33using System.IO; 32using System.IO;
34using libsecondlife;
35using System.Security.Cryptography; 33using System.Security.Cryptography;
36using System.Text; 34using System.Text;
35using System.Xml;
36using libsecondlife;
37 37
38namespace OpenSim.Region.Capabilities 38namespace OpenSim.Region.Capabilities
39{ 39{
@@ -47,7 +47,9 @@ namespace OpenSim.Region.Capabilities
47 /// </summary> 47 /// </summary>
48 public class LLSDParseException : Exception 48 public class LLSDParseException : Exception
49 { 49 {
50 public LLSDParseException(string message) : base(message) { } 50 public LLSDParseException(string message) : base(message)
51 {
52 }
51 } 53 }
52 54
53 /// <summary> 55 /// <summary>
@@ -55,7 +57,9 @@ namespace OpenSim.Region.Capabilities
55 /// </summary> 57 /// </summary>
56 public class LLSDSerializeException : Exception 58 public class LLSDSerializeException : Exception
57 { 59 {
58 public LLSDSerializeException(string message) : base(message) { } 60 public LLSDSerializeException(string message) : base(message)
61 {
62 }
59 } 63 }
60 64
61 /// <summary> 65 /// <summary>
@@ -129,7 +133,7 @@ namespace OpenSim.Region.Capabilities
129 if (obj is string) 133 if (obj is string)
130 { 134 {
131 writer.WriteStartElement(String.Empty, "string", String.Empty); 135 writer.WriteStartElement(String.Empty, "string", String.Empty);
132 writer.WriteString((string)obj); 136 writer.WriteString((string) obj);
133 writer.WriteEndElement(); 137 writer.WriteEndElement();
134 } 138 }
135 else if (obj is int) 139 else if (obj is int)
@@ -146,7 +150,7 @@ namespace OpenSim.Region.Capabilities
146 } 150 }
147 else if (obj is bool) 151 else if (obj is bool)
148 { 152 {
149 bool b = (bool)obj; 153 bool b = (bool) obj;
150 writer.WriteStartElement(String.Empty, "boolean", String.Empty); 154 writer.WriteStartElement(String.Empty, "boolean", String.Empty);
151 writer.WriteString(b ? "1" : "0"); 155 writer.WriteString(b ? "1" : "0");
152 writer.WriteEndElement(); 156 writer.WriteEndElement();
@@ -157,7 +161,7 @@ namespace OpenSim.Region.Capabilities
157 } 161 }
158 else if (obj is LLUUID) 162 else if (obj is LLUUID)
159 { 163 {
160 LLUUID u = (LLUUID)obj; 164 LLUUID u = (LLUUID) obj;
161 writer.WriteStartElement(String.Empty, "uuid", String.Empty); 165 writer.WriteStartElement(String.Empty, "uuid", String.Empty);
162 writer.WriteString(u.ToString()); 166 writer.WriteString(u.ToString());
163 writer.WriteEndElement(); 167 writer.WriteEndElement();
@@ -463,7 +467,7 @@ namespace OpenSim.Region.Capabilities
463 } 467 }
464 else if (obj is string) 468 else if (obj is string)
465 { 469 {
466 return GetSpaces(indent) + "- string \"" + (string)obj + "\"\n"; 470 return GetSpaces(indent) + "- string \"" + (string) obj + "\"\n";
467 } 471 }
468 else if (obj is int) 472 else if (obj is int)
469 { 473 {
@@ -475,13 +479,13 @@ namespace OpenSim.Region.Capabilities
475 } 479 }
476 else if (obj is LLUUID) 480 else if (obj is LLUUID)
477 { 481 {
478 return GetSpaces(indent) + "- uuid " + ((LLUUID)obj).ToString() + Environment.NewLine; 482 return GetSpaces(indent) + "- uuid " + ((LLUUID) obj).ToString() + Environment.NewLine;
479 } 483 }
480 else if (obj is Hashtable) 484 else if (obj is Hashtable)
481 { 485 {
482 StringBuilder ret = new StringBuilder(); 486 StringBuilder ret = new StringBuilder();
483 ret.Append(GetSpaces(indent) + "- map" + Environment.NewLine); 487 ret.Append(GetSpaces(indent) + "- map" + Environment.NewLine);
484 Hashtable map = (Hashtable)obj; 488 Hashtable map = (Hashtable) obj;
485 489
486 foreach (string key in map.Keys) 490 foreach (string key in map.Keys)
487 { 491 {
@@ -495,7 +499,7 @@ namespace OpenSim.Region.Capabilities
495 { 499 {
496 StringBuilder ret = new StringBuilder(); 500 StringBuilder ret = new StringBuilder();
497 ret.Append(GetSpaces(indent) + "- array\n"); 501 ret.Append(GetSpaces(indent) + "- array\n");
498 ArrayList list = (ArrayList)obj; 502 ArrayList list = (ArrayList) obj;
499 503
500 foreach (object item in list) 504 foreach (object item in list)
501 { 505 {
@@ -506,8 +510,8 @@ namespace OpenSim.Region.Capabilities
506 } 510 }
507 else if (obj is byte[]) 511 else if (obj is byte[])
508 { 512 {
509 return GetSpaces(indent) + "- binary\n" + Helpers.FieldToHexString((byte[])obj, GetSpaces(indent)) + 513 return GetSpaces(indent) + "- binary\n" + Helpers.FieldToHexString((byte[]) obj, GetSpaces(indent)) +
510 Environment.NewLine; 514 Environment.NewLine;
511 } 515 }
512 else 516 else
513 { 517 {
@@ -557,8 +561,8 @@ namespace OpenSim.Region.Capabilities
557 double value; 561 double value;
558 endPos = FindEnd(llsd, 1); 562 endPos = FindEnd(llsd, 1);
559 563
560 if (Double.TryParse(llsd.Substring(1, endPos - 1), System.Globalization.NumberStyles.Float, 564 if (Double.TryParse(llsd.Substring(1, endPos - 1), NumberStyles.Float,
561 Helpers.EnUsCulture.NumberFormat, out value)) 565 Helpers.EnUsCulture.NumberFormat, out value))
562 return value; 566 return value;
563 else 567 else
564 throw new LLSDParseException("Failed to parse double value type"); 568 throw new LLSDParseException("Failed to parse double value type");
@@ -652,7 +656,7 @@ namespace OpenSim.Region.Capabilities
652 656
653 private static int FindEnd(string llsd, int start) 657 private static int FindEnd(string llsd, int start)
654 { 658 {
655 int end = llsd.IndexOfAny(new char[] { ',', ']', '}' }); 659 int end = llsd.IndexOfAny(new char[] {',', ']', '}'});
656 if (end == -1) end = llsd.Length - 1; 660 if (end == -1) end = llsd.Length - 1;
657 return end; 661 return end;
658 } 662 }
@@ -673,4 +677,4 @@ namespace OpenSim.Region.Capabilities
673 } 677 }
674 } 678 }
675 } 679 }
676} 680} \ No newline at end of file