switch to usings

This commit is contained in:
Luke Pulverenti 2016-10-27 17:57:00 -04:00
parent b5b3d8a30c
commit 0d5e95222a

View File

@ -55,7 +55,8 @@ namespace XmlRpcHandler
using (var ms = new MemoryStream()) using (var ms = new MemoryStream())
{ {
XmlWriter XMLwrt = XmlWriter.Create(ms, sett); using (XmlWriter XMLwrt = XmlWriter.Create(ms, sett))
{
// Let's write the methods // Let's write the methods
foreach (XmlRpcMethodCall method in methods) foreach (XmlRpcMethodCall method in methods)
{ {
@ -87,10 +88,10 @@ namespace XmlRpcHandler
XMLwrt.WriteEndElement();//methodCall XMLwrt.WriteEndElement();//methodCall
} }
XMLwrt.Flush(); XMLwrt.Flush();
XMLwrt.Close();
return ms.ToArray(); return ms.ToArray();
} }
} }
}
/// <summary> /// <summary>
/// Decode response then return the values /// Decode response then return the values
/// </summary> /// </summary>
@ -107,8 +108,8 @@ namespace XmlRpcHandler
{ {
str = new MemoryStream(Encoding.UTF8.GetBytes(xmlResponse)); str = new MemoryStream(Encoding.UTF8.GetBytes(xmlResponse));
} }
XmlReader XMLread = XmlReader.Create(str, sett); using (XmlReader XMLread = XmlReader.Create(str, sett))
{
XmlRpcMethodCall call = new XmlRpcMethodCall("methodResponse"); XmlRpcMethodCall call = new XmlRpcMethodCall("methodResponse");
// Read parameters // Read parameters
while (XMLread.Read()) while (XMLread.Read())
@ -121,9 +122,9 @@ namespace XmlRpcHandler
} }
} }
methods.Add(call); methods.Add(call);
XMLread.Close();
return methods.ToArray(); return methods.ToArray();
} }
}
private static void WriteBasicValue(XmlWriter XMLwrt, XmlRpcValueBasic val) private static void WriteBasicValue(XmlWriter XMLwrt, XmlRpcValueBasic val)
{ {