remove temp file from open subtitles

pull/1154/head
Luke Pulverenti 9 years ago
parent d328ae208a
commit 9b5f7f2495

@ -51,47 +51,45 @@ namespace XmlRpcHandler
XmlWriterSettings sett = new XmlWriterSettings(); XmlWriterSettings sett = new XmlWriterSettings();
sett.Indent = true; sett.Indent = true;
var requestXmlPath = Path.Combine(Path.GetTempPath(), "request.xml");
sett.Encoding = Encoding.UTF8; sett.Encoding = Encoding.UTF8;
FileStream str = new FileStream(requestXmlPath, FileMode.Create, FileAccess.Write);
XmlWriter XMLwrt = XmlWriter.Create(str, sett); using (var ms = new MemoryStream())
// Let's write the methods
foreach (XmlRpcMethodCall method in methods)
{ {
XMLwrt.WriteStartElement("methodCall");//methodCall XmlWriter XMLwrt = XmlWriter.Create(ms, sett);
XMLwrt.WriteStartElement("methodName");//methodName // Let's write the methods
XMLwrt.WriteString(method.Name); foreach (XmlRpcMethodCall method in methods)
XMLwrt.WriteEndElement();//methodName
XMLwrt.WriteStartElement("params");//params
// Write values
foreach (IXmlRpcValue p in method.Parameters)
{ {
XMLwrt.WriteStartElement("param");//param XMLwrt.WriteStartElement("methodCall");//methodCall
if (p is XmlRpcValueBasic) XMLwrt.WriteStartElement("methodName");//methodName
{ XMLwrt.WriteString(method.Name);
WriteBasicValue(XMLwrt, (XmlRpcValueBasic)p); XMLwrt.WriteEndElement();//methodName
} XMLwrt.WriteStartElement("params");//params
else if (p is XmlRpcValueStruct) // Write values
foreach (IXmlRpcValue p in method.Parameters)
{ {
WriteStructValue(XMLwrt, (XmlRpcValueStruct)p); XMLwrt.WriteStartElement("param");//param
} if (p is XmlRpcValueBasic)
else if (p is XmlRpcValueArray) {
{ WriteBasicValue(XMLwrt, (XmlRpcValueBasic)p);
WriteArrayValue(XMLwrt, (XmlRpcValueArray)p); }
else if (p is XmlRpcValueStruct)
{
WriteStructValue(XMLwrt, (XmlRpcValueStruct)p);
}
else if (p is XmlRpcValueArray)
{
WriteArrayValue(XMLwrt, (XmlRpcValueArray)p);
}
XMLwrt.WriteEndElement();//param
} }
XMLwrt.WriteEndElement();//param
}
XMLwrt.WriteEndElement();//params XMLwrt.WriteEndElement();//params
XMLwrt.WriteEndElement();//methodCall XMLwrt.WriteEndElement();//methodCall
}
XMLwrt.Flush();
XMLwrt.Close();
return ms.ToArray();
} }
XMLwrt.Flush();
XMLwrt.Close();
str.Close();
string requestContent = File.ReadAllText(requestXmlPath);
return Encoding.UTF8.GetBytes(requestContent);
} }
/// <summary> /// <summary>
/// Decode response then return the values /// Decode response then return the values

Loading…
Cancel
Save