Variable rename.

This commit is contained in:
2018-12-20 00:18:20 +00:00
parent 478a334892
commit 119f274b5a

View File

@@ -118,8 +118,8 @@ namespace DiscImageChef.Core
DiscImageChef.Console.DicConsole.DebugWriteLine("Submit stats", "Uploading device report"); DiscImageChef.Console.DicConsole.DebugWriteLine("Submit stats", "Uploading device report");
#endif #endif
MemoryStream xmlStream = new MemoryStream(); MemoryStream jsonStream = new MemoryStream();
StreamWriter jsonSw = new StreamWriter(xmlStream); StreamWriter jsonSw = new StreamWriter(jsonStream);
jsonSw.Write(JsonConvert.SerializeObject(report, Formatting.Indented, jsonSw.Write(JsonConvert.SerializeObject(report, Formatting.Indented,
new JsonSerializerSettings new JsonSerializerSettings
@@ -127,14 +127,14 @@ namespace DiscImageChef.Core
NullValueHandling = NullValueHandling.Ignore NullValueHandling = NullValueHandling.Ignore
})); }));
jsonSw.Close(); jsonSw.Close();
xmlStream.Seek(0, SeekOrigin.Begin); jsonStream.Seek(0, SeekOrigin.Begin);
WebRequest request = WebRequest.Create("http://discimagechef.claunia.com/api/uploadreportv2"); WebRequest request = WebRequest.Create("http://discimagechef.claunia.com/api/uploadreportv2");
((HttpWebRequest)request).UserAgent = $"DiscImageChef {typeof(Version).Assembly.GetName().Version}"; ((HttpWebRequest)request).UserAgent = $"DiscImageChef {typeof(Version).Assembly.GetName().Version}";
request.Method = "POST"; request.Method = "POST";
request.ContentLength = xmlStream.Length; request.ContentLength = jsonStream.Length;
request.ContentType = "application/json"; request.ContentType = "application/json";
Stream reqStream = request.GetRequestStream(); Stream reqStream = request.GetRequestStream();
xmlStream.CopyTo(reqStream); jsonStream.CopyTo(reqStream);
reqStream.Close(); reqStream.Close();
WebResponse response = request.GetResponse(); WebResponse response = request.GetResponse();
@@ -146,7 +146,7 @@ namespace DiscImageChef.Core
reader.ReadToEnd(); reader.ReadToEnd();
data.Close(); data.Close();
response.Close(); response.Close();
xmlStream.Close(); jsonStream.Close();
} }
catch(WebException) catch(WebException)
{ {