mirror of
https://github.com/aaru-dps/Aaru.git
synced 2026-05-20 04:16:25 +00:00
Replace NewtonSoft.Json for System.Text.Json.
This commit is contained in:
Submodule Aaru.CommonTypes updated: c6d2cf38bb...73730c4e0f
@@ -38,6 +38,8 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using Aaru.CommonTypes.Metadata;
|
||||
using Aaru.Console;
|
||||
@@ -45,7 +47,6 @@ using Aaru.Database;
|
||||
using Aaru.Database.Models;
|
||||
using Aaru.Dto;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Spectre.Console;
|
||||
using CdOffset = Aaru.Database.Models.CdOffset;
|
||||
using Version = Aaru.CommonTypes.Metadata.Version;
|
||||
@@ -67,9 +68,10 @@ public static class Remote
|
||||
|
||||
try
|
||||
{
|
||||
string json = JsonConvert.SerializeObject(report, Formatting.Indented, new JsonSerializerSettings
|
||||
string json = JsonSerializer.Serialize(report, new JsonSerializerOptions()
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
|
||||
var httpClient = new HttpClient();
|
||||
@@ -194,7 +196,7 @@ public static class Remote
|
||||
|
||||
Stream data = response.Content.ReadAsStream();
|
||||
var reader = new StreamReader(data);
|
||||
SyncDto sync = JsonConvert.DeserializeObject<SyncDto>(reader.ReadToEnd()) ?? new SyncDto();
|
||||
SyncDto sync = JsonSerializer.Deserialize<SyncDto>(reader.ReadToEnd()) ?? new SyncDto();
|
||||
|
||||
if(create)
|
||||
{
|
||||
|
||||
@@ -37,6 +37,8 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using System.Xml.Serialization;
|
||||
using Aaru.CommonTypes.Interop;
|
||||
@@ -46,7 +48,6 @@ using Aaru.Database;
|
||||
using Aaru.Database.Models;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Device = Aaru.Devices.Device;
|
||||
using MediaType = Aaru.CommonTypes.MediaType;
|
||||
using OperatingSystem = Aaru.Database.Models.OperatingSystem;
|
||||
@@ -793,10 +794,10 @@ public static class Statistics
|
||||
#else
|
||||
Aaru.Console.AaruConsole.DebugWriteLine("Submit stats", Localization.Core.Uploading_statistics);
|
||||
#endif
|
||||
|
||||
string json = JsonConvert.SerializeObject(dto, Formatting.Indented, new JsonSerializerSettings
|
||||
string json = JsonSerializer.Serialize(dto, new JsonSerializerOptions()
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
|
||||
byte[] jsonBytes = Encoding.UTF8.GetBytes(json);
|
||||
|
||||
Submodule Aaru.Decoders updated: a60a431326...cef6aa7f87
@@ -32,5 +32,9 @@ namespace Aaru.Tests;
|
||||
|
||||
static class Consts
|
||||
{
|
||||
public static string TestFilesRoot = OperatingSystem.IsMacOS() ? "/Volumes/AaruTests" : "/mnt/AaruTests";
|
||||
public static string TestFilesRoot = OperatingSystem.IsWindows()
|
||||
? "D:/AaruTests"
|
||||
: OperatingSystem.IsMacOS()
|
||||
? "/Volumes/AaruTests"
|
||||
: "/mnt/AaruTests";
|
||||
}
|
||||
@@ -92,7 +92,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0"/>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1"/>
|
||||
<PackageReference Include="Spectre.Console" Version="0.45.0"/>
|
||||
<PackageReference Include="Spectre.Console.Analyzer" Version="0.45.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
||||
@@ -36,6 +36,8 @@ using System.CommandLine;
|
||||
using System.CommandLine.NamingConventionBinder;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interop;
|
||||
@@ -50,7 +52,6 @@ using Aaru.Decoders.SCSI;
|
||||
using Aaru.Decoders.SCSI.MMC;
|
||||
using Aaru.Helpers;
|
||||
using Aaru.Localization;
|
||||
using Newtonsoft.Json;
|
||||
using Spectre.Console;
|
||||
using Command = System.CommandLine.Command;
|
||||
using Profile = Aaru.Decoders.SCSI.MMC.Profile;
|
||||
@@ -1574,14 +1575,13 @@ sealed class DeviceReportCommand : Command
|
||||
}
|
||||
|
||||
var jsonFs = new FileStream(jsonFile, FileMode.Create);
|
||||
var jsonSw = new StreamWriter(jsonFs);
|
||||
|
||||
jsonSw.Write(JsonConvert.SerializeObject(report, Formatting.Indented, new JsonSerializerSettings
|
||||
JsonSerializer.Serialize(jsonFs, report, new JsonSerializerOptions()
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
}));
|
||||
WriteIndented = true,
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
|
||||
});
|
||||
|
||||
jsonSw.Close();
|
||||
jsonFs.Close();
|
||||
|
||||
using(var ctx = AaruContext.Create(Settings.Settings.LocalDbPath))
|
||||
|
||||
Reference in New Issue
Block a user