aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2018-07-14 14:05:47 +0100
committerUbitUmarov2018-07-14 14:05:47 +0100
commitc7baee16380d67cecf7397258820eb50e2968eca (patch)
tree953049b7ec8bdaf4d6dcfc25dab84a655ca60759 /OpenSim
parentmissed one (diff)
downloadopensim-SC-c7baee16380d67cecf7397258820eb50e2968eca.zip
opensim-SC-c7baee16380d67cecf7397258820eb50e2968eca.tar.gz
opensim-SC-c7baee16380d67cecf7397258820eb50e2968eca.tar.bz2
opensim-SC-c7baee16380d67cecf7397258820eb50e2968eca.tar.xz
add using into a few more places
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Capabilities/LLSD.cs20
-rw-r--r--OpenSim/Capabilities/LLSDHelpers.cs34
2 files changed, 28 insertions, 26 deletions
diff --git a/OpenSim/Capabilities/LLSD.cs b/OpenSim/Capabilities/LLSD.cs
index 76e439f..342164d 100644
--- a/OpenSim/Capabilities/LLSD.cs
+++ b/OpenSim/Capabilities/LLSD.cs
@@ -107,17 +107,17 @@ namespace OpenSim.Framework.Capabilities
107 /// <returns></returns> 107 /// <returns></returns>
108 public static byte[] LLSDSerialize(object obj) 108 public static byte[] LLSDSerialize(object obj)
109 { 109 {
110 StringWriter sw = new StringWriter(); 110 using(StringWriter sw = new StringWriter())
111 XmlTextWriter writer = new XmlTextWriter(sw); 111 using(XmlTextWriter writer = new XmlTextWriter(sw))
112 writer.Formatting = Formatting.None; 112 {
113 113 writer.Formatting = Formatting.None;
114 writer.WriteStartElement(String.Empty, "llsd", String.Empty);
115 LLSDWriteOne(writer, obj);
116 writer.WriteEndElement();
117
118 writer.Close();
119 114
120 return Util.UTF8.GetBytes(sw.ToString()); 115 writer.WriteStartElement(String.Empty, "llsd", String.Empty);
116 LLSDWriteOne(writer, obj);
117 writer.WriteEndElement();
118 writer.Flush();
119 return Util.UTF8.GetBytes(sw.ToString());
120 }
121 } 121 }
122 122
123 /// <summary> 123 /// <summary>
diff --git a/OpenSim/Capabilities/LLSDHelpers.cs b/OpenSim/Capabilities/LLSDHelpers.cs
index 4a7c6a5..e54618d 100644
--- a/OpenSim/Capabilities/LLSDHelpers.cs
+++ b/OpenSim/Capabilities/LLSDHelpers.cs
@@ -41,30 +41,32 @@ namespace OpenSim.Framework.Capabilities
41 41
42 public static string SerialiseLLSDReply(object obj) 42 public static string SerialiseLLSDReply(object obj)
43 { 43 {
44 StringWriter sw = new StringWriter(); 44 using(StringWriter sw = new StringWriter())
45 XmlTextWriter writer = new XmlTextWriter(sw); 45 using(XmlTextWriter writer = new XmlTextWriter(sw))
46 writer.Formatting = Formatting.None; 46 {
47 writer.WriteStartElement(String.Empty, "llsd", String.Empty); 47 writer.Formatting = Formatting.None;
48 SerializeOSDType(writer, obj); 48 writer.WriteStartElement(String.Empty, "llsd", String.Empty);
49 writer.WriteEndElement(); 49 SerializeOSDType(writer, obj);
50 writer.Close(); 50 writer.WriteEndElement();
51 51 writer.Flush();
52 //m_log.DebugFormat("[LLSD Helpers]: Generated serialized LLSD reply {0}", sw.ToString()); 52 //m_log.DebugFormat("[LLSD Helpers]: Generated serialized LLSD reply {0}", sw.ToString());
53 53
54 return sw.ToString(); 54 return sw.ToString();
55 }
55 } 56 }
56 57
57 public static string SerialiseLLSDReplyNoHeader(object obj) 58 public static string SerialiseLLSDReplyNoHeader(object obj)
58 { 59 {
59 StringWriter sw = new StringWriter(); 60 using(StringWriter sw = new StringWriter())
60 XmlTextWriter writer = new XmlTextWriter(sw); 61 using(XmlTextWriter writer = new XmlTextWriter(sw))
61 writer.Formatting = Formatting.None; 62 {
62 SerializeOSDType(writer, obj); 63 writer.Formatting = Formatting.None;
63 writer.Close(); 64 SerializeOSDType(writer, obj);
64 65 writer.Flush();
65 //m_log.DebugFormat("[LLSD Helpers]: Generated serialized LLSD reply {0}", sw.ToString()); 66 //m_log.DebugFormat("[LLSD Helpers]: Generated serialized LLSD reply {0}", sw.ToString());
66 67
67 return sw.ToString(); 68 return sw.ToString();
69 }
68 } 70 }
69 71
70 private static void SerializeOSDType(XmlTextWriter writer, object obj) 72 private static void SerializeOSDType(XmlTextWriter writer, object obj)