mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Convert V1 device report to V2 and add them to database.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -30,14 +30,12 @@
|
|||||||
// Copyright © 2011-2018 Natalia Portillo
|
// Copyright © 2011-2018 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Hosting;
|
|
||||||
using System.Web.Http;
|
using System.Web.Http;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using DiscImageChef.CommonTypes.Metadata;
|
using DiscImageChef.CommonTypes.Metadata;
|
||||||
@@ -74,18 +72,8 @@ namespace DiscImageChef.Server.Controllers
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
Random rng = new Random();
|
ctx.Reports.Add(new UploadedReport(new DeviceReportV2(newReport)));
|
||||||
string filename = $"NewReport_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml";
|
ctx.SaveChanges();
|
||||||
while(File.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
|
|
||||||
"Upload", filename)))
|
|
||||||
filename = $"NewReport_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml";
|
|
||||||
|
|
||||||
FileStream newFile =
|
|
||||||
new
|
|
||||||
FileStream(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Upload", filename),
|
|
||||||
FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None);
|
|
||||||
xs.Serialize(newFile, newReport);
|
|
||||||
newFile.Close();
|
|
||||||
|
|
||||||
response.Content = new StringContent("ok", Encoding.UTF8, "text/plain");
|
response.Content = new StringContent("ok", Encoding.UTF8, "text/plain");
|
||||||
return response;
|
return response;
|
||||||
|
|||||||
Reference in New Issue
Block a user