diff options
author | lbsa71 | 2007-10-30 09:05:31 +0000 |
---|---|---|
committer | lbsa71 | 2007-10-30 09:05:31 +0000 |
commit | 67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch) | |
tree | 20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs | |
parent | * Deleted .user file (diff) | |
download | opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2 opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz |
* Optimized usings
* Shortened type references
* Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs index 8a2215f..8252a63 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Capabilities | |||
51 | public static void SerializeLLSDType(XmlTextWriter writer, object obj) | 51 | public 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); |
55 | if (llsdattributes.Length > 0) | 55 | if (llsdattributes.Length > 0) |
56 | { | 56 | { |
57 | switch (llsdattributes[0].ObjectType) | 57 | switch (llsdattributes[0].ObjectType) |
@@ -62,7 +62,8 @@ namespace OpenSim.Region.Capabilities | |||
62 | for (int i = 0; i < fields.Length; i++) | 62 | for (int i = 0; i < fields.Length; i++) |
63 | { | 63 | { |
64 | object fieldValue = fields[i].GetValue(obj); | 64 | object fieldValue = fields[i].GetValue(obj); |
65 | LLSDType[] fieldAttributes = (LLSDType[])fieldValue.GetType().GetCustomAttributes(typeof(LLSDType), false); | 65 | LLSDType[] fieldAttributes = |
66 | (LLSDType[]) fieldValue.GetType().GetCustomAttributes(typeof (LLSDType), false); | ||
66 | if (fieldAttributes.Length > 0) | 67 | if (fieldAttributes.Length > 0) |
67 | { | 68 | { |
68 | writer.WriteStartElement(String.Empty, "key", String.Empty); | 69 | writer.WriteStartElement(String.Empty, "key", String.Empty); |
@@ -83,7 +84,7 @@ namespace OpenSim.Region.Capabilities | |||
83 | case "ARRAY": | 84 | case "ARRAY": |
84 | // LLSDArray arrayObject = obj as LLSDArray; | 85 | // LLSDArray arrayObject = obj as LLSDArray; |
85 | // ArrayList a = arrayObject.Array; | 86 | // ArrayList a = arrayObject.Array; |
86 | ArrayList a = (ArrayList)obj.GetType().GetField("Array").GetValue(obj); | 87 | ArrayList a = (ArrayList) obj.GetType().GetField("Array").GetValue(obj); |
87 | if (a != null) | 88 | if (a != null) |
88 | { | 89 | { |
89 | writer.WriteStartElement(String.Empty, "array", String.Empty); | 90 | writer.WriteStartElement(String.Empty, "array", String.Empty); |
@@ -105,7 +106,7 @@ namespace OpenSim.Region.Capabilities | |||
105 | public static object DeserialiseLLSDMap(Hashtable llsd, object obj) | 106 | public static object DeserialiseLLSDMap(Hashtable llsd, object obj) |
106 | { | 107 | { |
107 | Type myType = obj.GetType(); | 108 | Type myType = obj.GetType(); |
108 | LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); | 109 | LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false); |
109 | if (llsdattributes.Length > 0) | 110 | if (llsdattributes.Length > 0) |
110 | { | 111 | { |
111 | switch (llsdattributes[0].ObjectType) | 112 | switch (llsdattributes[0].ObjectType) |
@@ -114,7 +115,7 @@ namespace OpenSim.Region.Capabilities | |||
114 | IDictionaryEnumerator enumerator = llsd.GetEnumerator(); | 115 | IDictionaryEnumerator enumerator = llsd.GetEnumerator(); |
115 | while (enumerator.MoveNext()) | 116 | while (enumerator.MoveNext()) |
116 | { | 117 | { |
117 | FieldInfo field = myType.GetField((string)enumerator.Key); | 118 | FieldInfo field = myType.GetField((string) enumerator.Key); |
118 | if (field != null) | 119 | if (field != null) |
119 | { | 120 | { |
120 | if (enumerator.Value is Hashtable) | 121 | if (enumerator.Value is Hashtable) |
@@ -142,23 +143,4 @@ namespace OpenSim.Region.Capabilities | |||
142 | return obj; | 143 | return obj; |
143 | } | 144 | } |
144 | } | 145 | } |
145 | 146 | } \ No newline at end of file | |
146 | |||
147 | |||
148 | |||
149 | |||
150 | |||
151 | |||
152 | |||
153 | |||
154 | |||
155 | |||
156 | |||
157 | |||
158 | |||
159 | |||
160 | |||
161 | |||
162 | |||
163 | |||
164 | } | ||