mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Ensure metadata enums get serialized as strings.
This commit is contained in:
@@ -39,7 +39,6 @@ using System.Linq;
|
||||
using System.Reactive;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
@@ -2035,11 +2034,9 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
{
|
||||
var fs = new FileStream(result[0], FileMode.Open);
|
||||
|
||||
_aaruMetadata = JsonSerializer.Deserialize<MetadataJson>(fs, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
PropertyNameCaseInsensitive = true
|
||||
})?.AaruMetadata;
|
||||
_aaruMetadata =
|
||||
(await JsonSerializer.DeserializeAsync(fs, typeof(MetadataJson), MetadataJsonContext.Default) as
|
||||
MetadataJson)?.AaruMetadata;
|
||||
|
||||
fs.Close();
|
||||
MetadataJsonText = result[0];
|
||||
|
||||
@@ -37,7 +37,6 @@ using System.IO;
|
||||
using System.Reactive;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
@@ -257,11 +256,10 @@ public sealed class ImageSidecarViewModel : ViewModelBase
|
||||
|
||||
var jsonFs = new FileStream(DestinationText, FileMode.Create);
|
||||
|
||||
await JsonSerializer.SerializeAsync(jsonFs, sidecar, new JsonSerializerOptions
|
||||
await JsonSerializer.SerializeAsync(jsonFs, new MetadataJson
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
AaruMetadata = sidecar
|
||||
}, typeof(MetadataJson), MetadataJsonContext.Default);
|
||||
|
||||
jsonFs.Close();
|
||||
|
||||
|
||||
@@ -531,11 +531,9 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
{
|
||||
var fs = new FileStream(result[0], FileMode.Open);
|
||||
|
||||
_sidecar = JsonSerializer.Deserialize<MetadataJson>(fs, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
PropertyNameCaseInsensitive = true
|
||||
})?.AaruMetadata;
|
||||
_sidecar =
|
||||
(JsonSerializer.Deserialize(fs, typeof(MetadataJson), MetadataJsonContext.Default) as MetadataJson)?
|
||||
.AaruMetadata;
|
||||
|
||||
fs.Close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user