Compare commits

...

3 Commits
1.1.0 ... 1.1.1

Author SHA1 Message Date
Matt Nadareski
f2019b7ac4 Bump version 2023-09-11 01:23:34 -04:00
Matt Nadareski
0efb6d08e7 Fix serialization issues 2023-09-11 01:23:29 -04:00
Matt Nadareski
7ed1717f56 Add Nuget link 2023-09-10 23:33:41 -04:00
7 changed files with 53 additions and 16 deletions

View File

@@ -6,14 +6,21 @@ namespace SabreTools.Serialization.Files
{
/// <inheritdoc/>
#if NET48
public MetadataFile Deserialize(string path)
public MetadataFile Deserialize(string path) => Deserialize(path, true);
#else
public MetadataFile? Deserialize(string? path)
public MetadataFile? Deserialize(string? path) => Deserialize(path, true);
#endif
/// <inheritdoc/>
#if NET48
public MetadataFile Deserialize(string path, bool quotes)
#else
public MetadataFile? Deserialize(string? path, bool quotes)
#endif
{
using (var stream = PathProcessor.OpenStream(path))
{
return new Streams.ClrMamePro().Deserialize(stream);
return new Streams.ClrMamePro().Deserialize(stream, quotes);
}
}
}

View File

@@ -4,14 +4,21 @@ namespace SabreTools.Serialization.Files
{
/// <inheritdoc/>
#if NET48
public Models.Hashfile.Hashfile Deserialize(string path)
public Models.Hashfile.Hashfile Deserialize(string path) => Deserialize(path, Hash.CRC);
#else
public Models.Hashfile.Hashfile? Deserialize(string? path)
public Models.Hashfile.Hashfile? Deserialize(string? path) => Deserialize(path, Hash.CRC);
#endif
/// <inheritdoc/>
#if NET48
public Models.Hashfile.Hashfile Deserialize(string path, Hash hash)
#else
public Models.Hashfile.Hashfile? Deserialize(string? path, Hash hash)
#endif
{
using (var stream = PathProcessor.OpenStream(path))
{
return new Streams.Hashfile().Deserialize(stream);
return new Streams.Hashfile().Deserialize(stream, hash);
}
}
}

View File

@@ -4,15 +4,22 @@ namespace SabreTools.Serialization.Files
{
/// <inheritdoc/>
#if NET48
public bool Serialize(Models.Hashfile.Hashfile obj, string path)
public bool Serialize(Models.Hashfile.Hashfile obj, string path) => Serialize(obj, path, Hash.CRC);
#else
public bool Serialize(Models.Hashfile.Hashfile? obj, string? path)
public bool Serialize(Models.Hashfile.Hashfile? obj, string? path) => Serialize(obj, path, Hash.CRC);
#endif
/// <inheritdoc/>
#if NET48
public bool Serialize(Models.Hashfile.Hashfile obj, string path, Hash hash)
#else
public bool Serialize(Models.Hashfile.Hashfile? obj, string? path, Hash hash)
#endif
{
if (string.IsNullOrWhiteSpace(path))
return false;
using (var stream = new Streams.Hashfile().Serialize(obj))
using (var stream = new Streams.Hashfile().Serialize(obj, hash))
{
if (stream == null)
return false;

View File

@@ -6,14 +6,21 @@ namespace SabreTools.Serialization.Files
{
/// <inheritdoc/>
#if NET48
public MetadataFile Deserialize(string path)
public MetadataFile Deserialize(string path) => Deserialize(path, ',');
#else
public MetadataFile? Deserialize(string? path)
public MetadataFile? Deserialize(string? path) => Deserialize(path, ',');
#endif
/// <inheritdoc/>
#if NET48
public MetadataFile Deserialize(string path, char delim)
#else
public MetadataFile? Deserialize(string? path, char delim)
#endif
{
using (var stream = PathProcessor.OpenStream(path))
{
return new Streams.SeparatedValue().Deserialize(stream);
return new Streams.SeparatedValue().Deserialize(stream, delim);
}
}
}

View File

@@ -6,15 +6,22 @@ namespace SabreTools.Serialization.Files
{
/// <inheritdoc/>
#if NET48
public bool Serialize(MetadataFile obj, string path)
public bool Serialize(MetadataFile obj, string path) => Serialize(obj, path, ',');
#else
public bool Serialize(MetadataFile? obj, string? path)
public bool Serialize(MetadataFile? obj, string? path) => Serialize(obj, path, ',');
#endif
/// <inheritdoc/>
#if NET48
public bool Serialize(MetadataFile obj, string path, char delim)
#else
public bool Serialize(MetadataFile? obj, string? path, char delim)
#endif
{
if (string.IsNullOrWhiteSpace(path))
return false;
using (var stream = new Streams.SeparatedValue().Serialize(obj))
using (var stream = new Streams.SeparatedValue().Serialize(obj, delim))
{
if (stream == null)
return false;

View File

@@ -1,3 +1,5 @@
# SabreTools.Serialization
This library comprises of serializers that both read and write from files and streams to the dedicated models as well as convert to and from the common internal models. This library is partially used by the current parsing and writing code but none of the internal model serialization is used.
Find the link to the Nuget package [here](https://www.nuget.org/packages/SabreTools.Serialization).

View File

@@ -4,7 +4,7 @@
<!-- Assembly Properties -->
<TargetFrameworks>net48;net6.0;net7.0;net8.0</TargetFrameworks>
<RuntimeIdentifiers>win-x86;win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
<Version>1.1.0</Version>
<Version>1.1.1</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!-- Package Properties -->