mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-09-21 22:35:06 +00:00
Support ancient .NET
This commit is contained in:
@@ -3,10 +3,10 @@ using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Bytes
|
||||
{
|
||||
public partial class IRD : IByteSerializer<Models.IRD.IRD>
|
||||
public partial class IRD : IByteSerializer<Models.IRD.File>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public Models.IRD.IRD? Deserialize(byte[]? data, int offset)
|
||||
public Models.IRD.File? Deserialize(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
|
||||
@@ -34,7 +34,11 @@ namespace SabreTools.Serialization.CrossModel
|
||||
{
|
||||
var roms = item.Read<Models.Metadata.Rom[]>(Models.Metadata.Machine.RomKey);
|
||||
if (roms == null)
|
||||
#if NET40 || NET452
|
||||
return [];
|
||||
#else
|
||||
return Array.Empty<File>();
|
||||
#endif
|
||||
|
||||
return roms
|
||||
.Where(r => r != null)
|
||||
|
||||
@@ -47,7 +47,11 @@ namespace SabreTools.Serialization.CrossModel
|
||||
{
|
||||
var roms = item.Read<Models.Metadata.Rom[]>(Models.Metadata.Machine.RomKey);
|
||||
if (roms == null || !roms.Any())
|
||||
#if NET40 || NET452
|
||||
return [];
|
||||
#else
|
||||
return Array.Empty<Row>();
|
||||
#endif
|
||||
|
||||
return roms
|
||||
.Where(r => r != null)
|
||||
|
||||
@@ -34,7 +34,11 @@ namespace SabreTools.Serialization.CrossModel
|
||||
{
|
||||
var roms = item.Read<Models.Metadata.Rom[]>(Models.Metadata.Machine.RomKey);
|
||||
if (roms == null || !roms.Any())
|
||||
#if NET40 || NET452
|
||||
return [];
|
||||
#else
|
||||
return Array.Empty<Row>();
|
||||
#endif
|
||||
|
||||
return roms
|
||||
.Where(r => r != null)
|
||||
|
||||
@@ -104,7 +104,11 @@ namespace SabreTools.Serialization.CrossModel
|
||||
private static Models.Metadata.Machine[] ConvertDirToInternalModel(Dir item)
|
||||
{
|
||||
if (item.Game == null || !item.Game.Any())
|
||||
#if NET40 || NET452
|
||||
return [];
|
||||
#else
|
||||
return Array.Empty<Models.Metadata.Machine>();
|
||||
#endif
|
||||
|
||||
return item.Game
|
||||
.Where(g => g != null)
|
||||
|
||||
@@ -91,7 +91,11 @@ namespace SabreTools.Serialization.CrossModel
|
||||
{
|
||||
var roms = item.Read<Models.Metadata.Rom[]>(Models.Metadata.Machine.RomKey);
|
||||
if (roms == null)
|
||||
#if NET40 || NET452
|
||||
return [];
|
||||
#else
|
||||
return Array.Empty<Rom>();
|
||||
#endif
|
||||
|
||||
return roms
|
||||
.Where(r => r != null)
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace SabreTools.Serialization
|
||||
// Distinguish between v1 and v2
|
||||
int bytesToRead = 112; // v2
|
||||
if (string.IsNullOrWhiteSpace(addD.Version)
|
||||
|| addD.Version.StartsWith("3")
|
||||
|| addD.Version!.StartsWith("3")
|
||||
|| addD.Version.StartsWith("4.47"))
|
||||
{
|
||||
bytesToRead = 44;
|
||||
|
||||
@@ -2,10 +2,10 @@ using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class IRD : IFileSerializer<Models.IRD.IRD>
|
||||
public partial class IRD : IFileSerializer<Models.IRD.File>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public Models.IRD.IRD? Deserialize(string? path)
|
||||
public Models.IRD.File? Deserialize(string? path)
|
||||
{
|
||||
using (var stream = PathProcessor.OpenStream(path))
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@ using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class IRD : IFileSerializer<Models.IRD.IRD>
|
||||
public partial class IRD : IFileSerializer<Models.IRD.File>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.IRD.IRD? obj, string? path)
|
||||
public bool Serialize(Models.IRD.File? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
return false;
|
||||
|
||||
@@ -79,7 +79,11 @@ namespace SabreTools.Serialization
|
||||
{
|
||||
var roms = item.Read<Rom[]>(DataArea.RomKey);
|
||||
if (roms == null || !roms.Any())
|
||||
#if NET40 || NET452
|
||||
return [];
|
||||
#else
|
||||
return Array.Empty<Rom>();
|
||||
#endif
|
||||
|
||||
return roms.ToArray();
|
||||
}
|
||||
@@ -91,7 +95,11 @@ namespace SabreTools.Serialization
|
||||
{
|
||||
var roms = item.Read<Disk[]>(DiskArea.DiskKey);
|
||||
if (roms == null || !roms.Any())
|
||||
#if NET40 || NET452
|
||||
return [];
|
||||
#else
|
||||
return Array.Empty<Disk>();
|
||||
#endif
|
||||
|
||||
return roms.ToArray();
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Assembly Properties -->
|
||||
<TargetFrameworks>net48;net6.0;net7.0;net8.0</TargetFrameworks>
|
||||
<TargetFrameworks>net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Version>1.1.7</Version>
|
||||
<Version>1.2.0</Version>
|
||||
|
||||
<!-- Package Properties -->
|
||||
<Authors>Matt Nadareski</Authors>
|
||||
@@ -27,8 +27,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SabreTools.IO" Version="1.1.1" />
|
||||
<PackageReference Include="SabreTools.Models" Version="1.1.5" />
|
||||
<PackageReference Include="SabreTools.IO" Version="1.2.0" />
|
||||
<PackageReference Include="SabreTools.Models" Version="1.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -241,7 +241,11 @@ namespace SabreTools.Serialization.Streams
|
||||
var sample = new Sample
|
||||
{
|
||||
Name = reader.Standalone?.Value ?? string.Empty,
|
||||
#if NET40 || NET452
|
||||
ADDITIONAL_ELEMENTS = []
|
||||
#else
|
||||
ADDITIONAL_ELEMENTS = Array.Empty<string>()
|
||||
#endif
|
||||
};
|
||||
samples.Add(sample);
|
||||
break;
|
||||
|
||||
@@ -412,7 +412,11 @@ namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
writer.WriteStartElement("dipswitch");
|
||||
writer.WriteRequiredAttributeString("name", dipswitch.Name, throwOnError: true);
|
||||
#if NET40 || NET452
|
||||
foreach (var entry in dipswitch.Entry ?? [])
|
||||
#else
|
||||
foreach (var entry in dipswitch.Entry ?? Array.Empty<string>())
|
||||
#endif
|
||||
{
|
||||
writer.WriteRequiredAttributeString("entry", entry);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,11 @@ namespace SabreTools.Serialization.Streams
|
||||
|
||||
// Setup the writer and output
|
||||
var stream = new MemoryStream();
|
||||
#if NET40
|
||||
var writer = new StreamWriter(stream, Encoding.ASCII, 1024);
|
||||
#else
|
||||
var writer = new StreamWriter(stream, Encoding.ASCII, 1024, true);
|
||||
#endif
|
||||
|
||||
// Write the file
|
||||
WriteCueSheet(obj, writer);
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
// Read and split the line
|
||||
string? line = reader.ReadLine();
|
||||
#if NETFRAMEWORK
|
||||
#if NETFRAMEWORK || NETCOREAPP3_1
|
||||
string[]? lineParts = line?.Split(new char[] { ' ' } , StringSplitOptions.RemoveEmptyEntries);
|
||||
#else
|
||||
string[]? lineParts = line?.Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace SabreTools.Serialization.Streams
|
||||
if (string.IsNullOrWhiteSpace(sfv.File) || string.IsNullOrWhiteSpace(sfv.Hash))
|
||||
continue;
|
||||
|
||||
writer.WriteValues(new string[] { sfv.File, sfv.Hash });
|
||||
writer.WriteValues(new string[] { sfv.File!, sfv.Hash! });
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ namespace SabreTools.Serialization.Streams
|
||||
if (string.IsNullOrWhiteSpace(md5.Hash) || string.IsNullOrWhiteSpace(md5.File))
|
||||
continue;
|
||||
|
||||
writer.WriteValues(new string[] { md5.Hash, md5.File });
|
||||
writer.WriteValues(new string[] { md5.Hash!, md5.File! });
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,7 @@ namespace SabreTools.Serialization.Streams
|
||||
if (string.IsNullOrWhiteSpace(sha1.Hash) || string.IsNullOrWhiteSpace(sha1.File))
|
||||
continue;
|
||||
|
||||
writer.WriteValues(new string[] { sha1.Hash, sha1.File });
|
||||
writer.WriteValues(new string[] { sha1.Hash!, sha1.File! });
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,7 @@ namespace SabreTools.Serialization.Streams
|
||||
if (string.IsNullOrWhiteSpace(sha256.Hash) || string.IsNullOrWhiteSpace(sha256.File))
|
||||
continue;
|
||||
|
||||
writer.WriteValues(new string[] { sha256.Hash, sha256.File });
|
||||
writer.WriteValues(new string[] { sha256.Hash!, sha256.File! });
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,7 @@ namespace SabreTools.Serialization.Streams
|
||||
if (string.IsNullOrWhiteSpace(sha384.Hash) || string.IsNullOrWhiteSpace(sha384.File))
|
||||
continue;
|
||||
|
||||
writer.WriteValues(new string[] { sha384.Hash, sha384.File });
|
||||
writer.WriteValues(new string[] { sha384.Hash!, sha384.File! });
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
@@ -201,7 +201,7 @@ namespace SabreTools.Serialization.Streams
|
||||
if (string.IsNullOrWhiteSpace(sha512.Hash) || string.IsNullOrWhiteSpace(sha512.File))
|
||||
continue;
|
||||
|
||||
writer.WriteValues(new string[] { sha512.Hash, sha512.File });
|
||||
writer.WriteValues(new string[] { sha512.Hash!, sha512.File! });
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
@@ -225,7 +225,7 @@ namespace SabreTools.Serialization.Streams
|
||||
if (string.IsNullOrWhiteSpace(spamsum.Hash) || string.IsNullOrWhiteSpace(spamsum.File))
|
||||
continue;
|
||||
|
||||
writer.WriteValues(new string[] { spamsum.Hash, spamsum.File });
|
||||
writer.WriteValues(new string[] { spamsum.Hash!, spamsum.File! });
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class IRD : IStreamSerializer<Models.IRD.IRD>
|
||||
public partial class IRD : IStreamSerializer<Models.IRD.File>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public Models.IRD.IRD? Deserialize(Stream? data)
|
||||
public Models.IRD.File? Deserialize(Stream? data)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null || data.Length == 0 || !data.CanSeek || !data.CanRead)
|
||||
@@ -23,7 +23,7 @@ namespace SabreTools.Serialization.Streams
|
||||
int initialOffset = (int)data.Position;
|
||||
|
||||
// Create a new media key block to fill
|
||||
var ird = new Models.IRD.IRD();
|
||||
var ird = new Models.IRD.File();
|
||||
|
||||
ird.Magic = data.ReadBytes(4);
|
||||
if (ird.Magic == null)
|
||||
@@ -80,7 +80,11 @@ namespace SabreTools.Serialization.Streams
|
||||
ird.RegionHashes = new byte[ird.RegionCount][];
|
||||
for (int i = 0; i < ird.RegionCount; i++)
|
||||
{
|
||||
#if NET40 || NET452
|
||||
ird.RegionHashes[i] = data.ReadBytes(16) ?? [];
|
||||
#else
|
||||
ird.RegionHashes[i] = data.ReadBytes(16) ?? Array.Empty<byte>();
|
||||
#endif
|
||||
}
|
||||
|
||||
ird.FileCount = data.ReadByteValue();
|
||||
@@ -89,7 +93,11 @@ namespace SabreTools.Serialization.Streams
|
||||
for (int i = 0; i < ird.FileCount; i++)
|
||||
{
|
||||
ird.FileKeys[i] = data.ReadUInt64();
|
||||
#if NET40 || NET452
|
||||
ird.FileHashes[i] = data.ReadBytes(16) ?? [];
|
||||
#else
|
||||
ird.FileHashes[i] = data.ReadBytes(16) ?? Array.Empty<byte>();
|
||||
#endif
|
||||
}
|
||||
|
||||
ird.ExtraConfig = data.ReadUInt16();
|
||||
|
||||
@@ -6,10 +6,10 @@ using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class IRD : IStreamSerializer<Models.IRD.IRD>
|
||||
public partial class IRD : IStreamSerializer<Models.IRD.File>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(Models.IRD.IRD? obj)
|
||||
public Stream? Serialize(Models.IRD.File? obj)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (obj?.Magic == null)
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace SabreTools.Serialization.Streams
|
||||
}
|
||||
|
||||
// Split the line for the name iteratively
|
||||
#if NETFRAMEWORK
|
||||
#if NETFRAMEWORK || NETCOREAPP3_1
|
||||
string[] lineParts = line.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (lineParts.Length == 1)
|
||||
lineParts = line.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
|
||||
@@ -119,7 +119,7 @@ namespace SabreTools.Serialization.Streams
|
||||
if (trimmedLine == null)
|
||||
continue;
|
||||
|
||||
#if NETFRAMEWORK
|
||||
#if NETFRAMEWORK || NETCOREAPP3_1
|
||||
lineParts = trimmedLine.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
#else
|
||||
lineParts = trimmedLine.Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace SabreTools.Serialization.Streams
|
||||
var rowBuilder = new StringBuilder();
|
||||
|
||||
int padding = 40 - (row.Size?.Length ?? 0);
|
||||
if (padding < row.Name.Length)
|
||||
if (padding < row.Name!.Length)
|
||||
padding = row.Name.Length + 2;
|
||||
|
||||
rowBuilder.Append($"{row.Name.PadRight(padding, ' ')}");
|
||||
|
||||
@@ -643,7 +643,11 @@ namespace SabreTools.Serialization.Streams
|
||||
exeFSHeader.FileHashes = new byte[10][];
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
#if NET40 || NET452
|
||||
exeFSHeader.FileHashes[i] = data.ReadBytes(0x20) ?? [];
|
||||
#else
|
||||
exeFSHeader.FileHashes[i] = data.ReadBytes(0x20) ?? Array.Empty<byte>();
|
||||
#endif
|
||||
}
|
||||
|
||||
return exeFSHeader;
|
||||
|
||||
@@ -327,7 +327,11 @@ namespace SabreTools.Serialization.Streams
|
||||
.Select(rt => rt!.TypeID)
|
||||
.Union(resourceTable.ResourceTypes
|
||||
.Where(rt => rt != null)
|
||||
#if NET40 || NET452
|
||||
.SelectMany(rt => rt!.Resources ?? [])
|
||||
#else
|
||||
.SelectMany(rt => rt!.Resources ?? System.Array.Empty<ResourceTypeResourceEntry>())
|
||||
#endif
|
||||
.Where(r => r!.IsIntegerType() == false)
|
||||
.Select(r => r!.ResourceID))
|
||||
.Distinct()
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace SabreTools.Serialization.Streams
|
||||
// Sanitize the extension
|
||||
for (int i = 0; i < 0x20; i++)
|
||||
{
|
||||
extensionString = extensionString.Replace($"{(char)i}", string.Empty);
|
||||
extensionString = extensionString!.Replace($"{(char)i}", string.Empty);
|
||||
}
|
||||
|
||||
while (true)
|
||||
@@ -180,7 +180,7 @@ namespace SabreTools.Serialization.Streams
|
||||
// Sanitize the path
|
||||
for (int i = 0; i < 0x20; i++)
|
||||
{
|
||||
pathString = pathString.Replace($"{(char)i}", string.Empty);
|
||||
pathString = pathString!.Replace($"{(char)i}", string.Empty);
|
||||
}
|
||||
|
||||
while (true)
|
||||
@@ -193,11 +193,11 @@ namespace SabreTools.Serialization.Streams
|
||||
// Sanitize the name
|
||||
for (int i = 0; i < 0x20; i++)
|
||||
{
|
||||
nameString = nameString.Replace($"{(char)i}", string.Empty);
|
||||
nameString = nameString!.Replace($"{(char)i}", string.Empty);
|
||||
}
|
||||
|
||||
// Get the directory item
|
||||
var directoryItem = ParseDirectoryItem(data, extensionString, pathString, nameString);
|
||||
var directoryItem = ParseDirectoryItem(data, extensionString!, pathString!, nameString!);
|
||||
|
||||
// Add the directory item
|
||||
directoryItems.Add(directoryItem);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#if !NETFRAMEWORK
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
@@ -22,8 +23,13 @@ namespace SabreTools.Serialization.Wrappers
|
||||
throw new NotImplementedException(string.Format("Concrete class {0} is not supported", typeof(TAbstract)));
|
||||
}
|
||||
|
||||
#if NETCOREAPP3_1
|
||||
public override TAbstract Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) =>
|
||||
throw new NotImplementedException();
|
||||
#else
|
||||
public override TAbstract? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) =>
|
||||
throw new NotImplementedException();
|
||||
#endif
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, TAbstract value, JsonSerializerOptions options) =>
|
||||
JsonSerializer.Serialize<object>(writer, value!, options);
|
||||
@@ -54,8 +60,13 @@ namespace SabreTools.Serialization.Wrappers
|
||||
throw new NotImplementedException(string.Format("Concrete class {0} is not supported", typeof(TInterface)));
|
||||
}
|
||||
|
||||
#if NETCOREAPP3_1
|
||||
public override TInterface Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) =>
|
||||
throw new NotImplementedException();
|
||||
#else
|
||||
public override TInterface? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) =>
|
||||
throw new NotImplementedException();
|
||||
#endif
|
||||
|
||||
public override void Write(System.Text.Json.Utf8JsonWriter writer, TInterface value, JsonSerializerOptions options) =>
|
||||
JsonSerializer.Serialize<object>(writer, value!, options);
|
||||
@@ -79,4 +90,5 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static T ThrowOnNull<T>(this T? value) where T : class => value ?? throw new ArgumentNullException();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -2,7 +2,7 @@ using System.IO;
|
||||
|
||||
namespace SabreTools.Serialization.Wrappers
|
||||
{
|
||||
public class IRD : WrapperBase<Models.IRD.IRD>
|
||||
public class IRD : WrapperBase<Models.IRD.File>
|
||||
{
|
||||
#region Descriptive Properties
|
||||
|
||||
@@ -14,14 +14,14 @@ namespace SabreTools.Serialization.Wrappers
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IRD(Models.IRD.IRD? model, byte[]? data, int offset)
|
||||
public IRD(Models.IRD.File? model, byte[]? data, int offset)
|
||||
: base(model, data, offset)
|
||||
{
|
||||
// All logic is handled by the base class
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IRD(Models.IRD.IRD? model, Stream? data)
|
||||
public IRD(Models.IRD.File? model, Stream? data)
|
||||
: base(model, data)
|
||||
{
|
||||
// All logic is handled by the base class
|
||||
|
||||
@@ -826,7 +826,11 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
// Try to find a key that matches
|
||||
var match = stringTable
|
||||
#if NET40 || NET452
|
||||
.SelectMany(st => st?.Children ?? [])
|
||||
#else
|
||||
.SelectMany(st => st?.Children ?? Array.Empty<Models.PortableExecutable.StringData>())
|
||||
#endif
|
||||
.FirstOrDefault(sd => sd != null && key.Equals(sd.Key, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
// Return either the match or null
|
||||
|
||||
@@ -65,7 +65,11 @@ namespace SabreTools.Serialization.Wrappers
|
||||
{
|
||||
get
|
||||
{
|
||||
#if NETCOREAPP3_1
|
||||
var serializer = new System.Text.Json.JsonSerializerOptions { WriteIndented = true };
|
||||
#else
|
||||
var serializer = new System.Text.Json.JsonSerializerOptions { IncludeFields = true, WriteIndented = true };
|
||||
#endif
|
||||
serializer.Converters.Add(new ConcreteAbstractSerializer());
|
||||
serializer.Converters.Add(new ConcreteInterfaceSerializer());
|
||||
serializer.Converters.Add(new System.Text.Json.Serialization.JsonStringEnumConverter());
|
||||
|
||||
@@ -26,8 +26,8 @@ namespace SabreTools.Serialization.Wrappers
|
||||
if (string.IsNullOrWhiteSpace(publisherIdentifier))
|
||||
return "Unknown";
|
||||
|
||||
if (Publishers.ContainsKey(publisherIdentifier))
|
||||
return Publishers[publisherIdentifier];
|
||||
if (Publishers.ContainsKey(publisherIdentifier!))
|
||||
return Publishers[publisherIdentifier!];
|
||||
|
||||
return $"Unknown ({publisherIdentifier})";
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ namespace SabreTools.Serialization.Wrappers
|
||||
if (string.IsNullOrWhiteSpace(publisherIdentifier))
|
||||
return "Unknown";
|
||||
|
||||
if (Publishers.ContainsKey(publisherIdentifier))
|
||||
return Publishers[publisherIdentifier];
|
||||
if (Publishers.ContainsKey(publisherIdentifier!))
|
||||
return Publishers[publisherIdentifier!];
|
||||
|
||||
return $"Unknown ({publisherIdentifier})";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user