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:
Submodule Aaru.CommonTypes updated: 647d3fac26...4c11c82189
@@ -35,7 +35,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
@@ -915,11 +914,7 @@ public partial class Dump
|
||||
JsonSerializer.Serialize(jsonFs, new MetadataJson
|
||||
{
|
||||
AaruMetadata = sidecar
|
||||
}, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
}, typeof(MetadataJson), MetadataJsonContext.Default);
|
||||
|
||||
jsonFs.Close();
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
@@ -150,11 +149,7 @@ partial class Dump
|
||||
JsonSerializer.Serialize(jsonFs, new MetadataJson
|
||||
{
|
||||
AaruMetadata = sidecar
|
||||
}, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
}, typeof(MetadataJson), MetadataJsonContext.Default);
|
||||
|
||||
jsonFs.Close();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
@@ -879,11 +878,7 @@ partial class Dump
|
||||
JsonSerializer.Serialize(jsonFs, new MetadataJson
|
||||
{
|
||||
AaruMetadata = sidecar
|
||||
}, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
}, typeof(MetadataJson), MetadataJsonContext.Default);
|
||||
|
||||
jsonFs.Close();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
@@ -721,11 +720,7 @@ public partial class Dump
|
||||
JsonSerializer.Serialize(jsonFs, new MetadataJson
|
||||
{
|
||||
AaruMetadata = sidecar
|
||||
}, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
}, typeof(MetadataJson), MetadataJsonContext.Default);
|
||||
|
||||
jsonFs.Close();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
@@ -1453,11 +1452,7 @@ partial class Dump
|
||||
JsonSerializer.Serialize(jsonFs, new MetadataJson
|
||||
{
|
||||
AaruMetadata = sidecar
|
||||
}, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
}, typeof(MetadataJson), MetadataJsonContext.Default);
|
||||
|
||||
jsonFs.Close();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
@@ -1308,11 +1307,7 @@ partial class Dump
|
||||
JsonSerializer.Serialize(jsonFs, new MetadataJson
|
||||
{
|
||||
AaruMetadata = sidecar
|
||||
}, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
}, typeof(MetadataJson), MetadataJsonContext.Default);
|
||||
|
||||
jsonFs.Close();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
@@ -985,11 +984,7 @@ public partial class Dump
|
||||
JsonSerializer.Serialize(jsonFs, new MetadataJson
|
||||
{
|
||||
AaruMetadata = sidecar
|
||||
}, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
}, typeof(MetadataJson), MetadataJsonContext.Default);
|
||||
|
||||
jsonFs.Close();
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="7.0.0"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Design" Version="2.0.0-preview1-final"/>
|
||||
<PackageReference Include="System.Text.Json" Version="7.0.0"/>
|
||||
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.3" PrivateAssets="all"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
<PackageReference Include="DotNetZip" Version="1.16.0"/>
|
||||
<PackageReference Include="plist-cil" Version="2.2.0"/>
|
||||
<PackageReference Include="SharpCompress" Version="0.32.2"/>
|
||||
<PackageReference Include="System.Text.Json" Version="7.0.0"/>
|
||||
<PackageReference Include="System.ValueTuple" Version="4.5.0"/>
|
||||
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.3" PrivateAssets="all"/>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -38,7 +38,6 @@ using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using Aaru.Checksums;
|
||||
@@ -936,11 +935,9 @@ public sealed partial class AaruFormat
|
||||
|
||||
try
|
||||
{
|
||||
AaruMetadata = JsonSerializer.Deserialize<MetadataJson>(jsonBytes, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
PropertyNameCaseInsensitive = true
|
||||
})?.AaruMetadata;
|
||||
AaruMetadata =
|
||||
(JsonSerializer.Deserialize(jsonBytes, typeof(MetadataJson), MetadataJsonContext.Default) as
|
||||
MetadataJson)?.AaruMetadata;
|
||||
}
|
||||
catch(JsonException ex)
|
||||
{
|
||||
|
||||
@@ -39,7 +39,6 @@ using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using Aaru.Checksums;
|
||||
@@ -1119,11 +1118,9 @@ public sealed partial class AaruFormat
|
||||
|
||||
try
|
||||
{
|
||||
AaruMetadata = JsonSerializer.Deserialize<MetadataJson>(jsonBytes, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
PropertyNameCaseInsensitive = true
|
||||
})?.AaruMetadata;
|
||||
AaruMetadata =
|
||||
(JsonSerializer.Deserialize(jsonBytes, typeof(MetadataJson),
|
||||
MetadataJsonContext.Default) as MetadataJson)?.AaruMetadata;
|
||||
}
|
||||
catch(JsonException ex)
|
||||
{
|
||||
@@ -2901,11 +2898,7 @@ public sealed partial class AaruFormat
|
||||
JsonSerializer.Serialize(jsonMs, new MetadataJson
|
||||
{
|
||||
AaruMetadata = AaruMetadata
|
||||
}, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
}, typeof(MetadataJson), MetadataJsonContext.Default);
|
||||
|
||||
idxEntry = new IndexEntry
|
||||
{
|
||||
|
||||
@@ -35,7 +35,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
@@ -1135,11 +1134,9 @@ public sealed partial class ZZZRawImage
|
||||
{
|
||||
var fs = new FileStream(basename + ".metadata.json", FileMode.Open);
|
||||
|
||||
AaruMetadata = JsonSerializer.Deserialize<MetadataJson>(fs, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
PropertyNameCaseInsensitive = true
|
||||
})?.AaruMetadata;
|
||||
AaruMetadata =
|
||||
(JsonSerializer.Deserialize(fs, typeof(MetadataJson), MetadataJsonContext.Default) as MetadataJson)?
|
||||
.AaruMetadata;
|
||||
|
||||
fs.Close();
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@
|
||||
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1"/>
|
||||
<PackageReference Include="System.CommandLine.NamingConventionBinder" Version="2.0.0-beta4.22272.1"/>
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0"/>
|
||||
<PackageReference Include="System.Text.Json" Version="7.0.0"/>
|
||||
<PackageReference Include="System.ValueTuple" Version="4.5.0"/>
|
||||
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
||||
@@ -309,11 +309,9 @@ sealed class ConvertImageCommand : Command
|
||||
{
|
||||
var fs = new FileStream(aaruMetadata, 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();
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
@@ -287,11 +286,10 @@ sealed class CreateSidecarCommand : Command
|
||||
FileStream(Path.Combine(Path.GetDirectoryName(imagePath) ?? throw new InvalidOperationException(), Path.GetFileNameWithoutExtension(imagePath) + ".metadata.json"),
|
||||
FileMode.Create);
|
||||
|
||||
JsonSerializer.Serialize(jsonFs, sidecar, new JsonSerializerOptions
|
||||
JsonSerializer.Serialize(jsonFs, new MetadataJson
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
AaruMetadata = sidecar
|
||||
}, typeof(MetadataJson), MetadataJsonContext.Default);
|
||||
|
||||
jsonFs.Close();
|
||||
});
|
||||
@@ -386,11 +384,10 @@ sealed class CreateSidecarCommand : Command
|
||||
FileStream(Path.Combine(Path.GetDirectoryName(imagePath) ?? throw new InvalidOperationException(), Path.GetFileNameWithoutExtension(imagePath) + ".metadata.json"),
|
||||
FileMode.Create);
|
||||
|
||||
JsonSerializer.Serialize(jsonFs, sidecar, new JsonSerializerOptions
|
||||
JsonSerializer.Serialize(jsonFs, new MetadataJson
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
AaruMetadata = sidecar
|
||||
}, typeof(MetadataJson), MetadataJsonContext.Default);
|
||||
|
||||
jsonFs.Close();
|
||||
});
|
||||
|
||||
@@ -536,11 +536,9 @@ sealed class DumpMediaCommand : Command
|
||||
{
|
||||
var fs = new FileStream(aaruMetadata, 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