mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Remove old report submit code.
This commit is contained in:
@@ -38,7 +38,6 @@ using System.Linq;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Xml.Serialization;
|
|
||||||
using DiscImageChef.CommonTypes.Metadata;
|
using DiscImageChef.CommonTypes.Metadata;
|
||||||
using DiscImageChef.Console;
|
using DiscImageChef.Console;
|
||||||
using DiscImageChef.Database;
|
using DiscImageChef.Database;
|
||||||
@@ -60,62 +59,7 @@ namespace DiscImageChef.Core
|
|||||||
/// Submits a device report
|
/// Submits a device report
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="report">Device report</param>
|
/// <param name="report">Device report</param>
|
||||||
public static void SubmitReport(DeviceReport report)
|
public static void SubmitReport(DeviceReportV2 report)
|
||||||
{
|
|
||||||
Thread submitThread = new Thread(() =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
System.Console.WriteLine("Uploading device report");
|
|
||||||
#else
|
|
||||||
DiscImageChef.Console.DicConsole.DebugWriteLine("Submit stats", "Uploading device report");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
MemoryStream xmlStream = new MemoryStream();
|
|
||||||
XmlSerializer xmlSer = new XmlSerializer(typeof(DeviceReport));
|
|
||||||
xmlSer.Serialize(xmlStream, report);
|
|
||||||
xmlStream.Seek(0, SeekOrigin.Begin);
|
|
||||||
WebRequest request = WebRequest.Create("http://discimagechef.claunia.com/api/uploadreport");
|
|
||||||
((HttpWebRequest)request).UserAgent = $"DiscImageChef {typeof(Version).Assembly.GetName().Version}";
|
|
||||||
request.Method = "POST";
|
|
||||||
request.ContentLength = xmlStream.Length;
|
|
||||||
request.ContentType = "application/xml";
|
|
||||||
Stream reqStream = request.GetRequestStream();
|
|
||||||
xmlStream.CopyTo(reqStream);
|
|
||||||
reqStream.Close();
|
|
||||||
WebResponse response = request.GetResponse();
|
|
||||||
|
|
||||||
if(((HttpWebResponse)response).StatusCode != HttpStatusCode.OK) return;
|
|
||||||
|
|
||||||
Stream data = response.GetResponseStream();
|
|
||||||
StreamReader reader = new StreamReader(data ?? throw new InvalidOperationException());
|
|
||||||
|
|
||||||
reader.ReadToEnd();
|
|
||||||
data.Close();
|
|
||||||
response.Close();
|
|
||||||
xmlStream.Close();
|
|
||||||
}
|
|
||||||
catch(WebException)
|
|
||||||
{
|
|
||||||
// Can't connect to the server, do nothing
|
|
||||||
}
|
|
||||||
// ReSharper disable once RedundantCatchClause
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
if(Debugger.IsAttached) throw;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
});
|
|
||||||
submitThread.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Submits a device report
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="report">Device report</param>
|
|
||||||
public static void SubmitReportV2(DeviceReportV2 report)
|
|
||||||
{
|
{
|
||||||
Thread submitThread = new Thread(() =>
|
Thread submitThread = new Thread(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -940,7 +940,7 @@ namespace DiscImageChef.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
if(Settings.Settings.Current.ShareReports) Remote.SubmitReportV2(report);
|
if(Settings.Settings.Current.ShareReports) Remote.SubmitReport(report);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user