mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-09-21 22:35:06 +00:00
Move serializers to new organization
This commit is contained in:
10
README.MD
10
README.MD
@@ -8,20 +8,14 @@ Find the link to the Nuget package [here](https://www.nuget.org/packages/SabreTo
|
||||
| --- | --- | --- |
|
||||
| `IByteDeserializer` | `byte[]?` | Model |
|
||||
| `IFileDeserializer` | `string?` Path | Model |
|
||||
| `IFileSerializer` | Model | `string?` Path |
|
||||
| `IStreamDeserializer` | `Stream?` | Model |
|
||||
| `IStreamSerializer` | Model | `Stream?` |
|
||||
|
||||
## `SabreTools.Serialization.CrossModel`
|
||||
|
||||
This namespace comprises of serializers and deserializers that convert models to other common ones. This is mainly used for metadata files converting to and from a common, `Dictionary`-based model.
|
||||
|
||||
## `SabreTools.Serialization.Files`
|
||||
|
||||
This namespace comprises of serializers and deserializers that can convert to and from files on disk. Most of the serializers are symmetric, but this is not guaranteed. Unimplemented methods will throw `NotImplementedException`.
|
||||
|
||||
## `SabreTools.Serialization.Streams`
|
||||
|
||||
This namespace comprises of serializers and deserializers that can convert to and from any type of stream. Most of the serializers are symmetric, but this is not guaranteed. Unimplemented methods will throw `NotImplementedException`.
|
||||
|
||||
## `SabreTools.Serialization.Strings`
|
||||
|
||||
This namespace comprises of serializers and deserializers that can convert to and from strings. Most of the serializers are symmetric, but this is not guaranteed. Unimplemented methods will throw `NotImplementedException`.
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class AACS : IFileSerializer<Models.AACS.MediaKeyBlock>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.AACS.MediaKeyBlock? obj, string? path)
|
||||
{
|
||||
var serializer = new AACS();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.AACS.MediaKeyBlock? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.AACS.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class ArchiveDotOrg : XmlFile<Models.ArchiveDotOrg.Files>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.ArchiveDotOrg.Files? obj, string? path)
|
||||
{
|
||||
var serializer = new ArchiveDotOrg();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using System.IO;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class AttractMode : IFileSerializer<Models.AttractMode.MetadataFile>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.AttractMode.MetadataFile? obj, string? path)
|
||||
{
|
||||
var serializer = new AttractMode();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.AttractMode.MetadataFile? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.AttractMode.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class BDPlus : IFileSerializer<Models.BDPlus.SVM>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.BDPlus.SVM? obj, string? path)
|
||||
{
|
||||
var serializer = new BDPlus();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.BDPlus.SVM? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.BDPlus.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class BFPK : IFileSerializer<Models.BFPK.Archive>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.BFPK.Archive? obj, string? path)
|
||||
{
|
||||
var serializer = new BFPK();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.BFPK.Archive? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.BFPK.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class BSP : IFileSerializer<Models.BSP.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.BSP.File? obj, string? path)
|
||||
{
|
||||
var serializer = new BSP();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.BSP.File? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.BSP.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class CFB : IFileSerializer<Models.CFB.Binary>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.CFB.Binary? obj, string? path)
|
||||
{
|
||||
var serializer = new CFB();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.CFB.Binary? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.CFB.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class CIA : IFileSerializer<Models.N3DS.CIA>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.N3DS.CIA? obj, string? path)
|
||||
{
|
||||
var serializer = new CIA();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.N3DS.CIA? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.CIA.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System.Text;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class Catalog : JsonFile<Models.Xbox.Catalog>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.Xbox.Catalog? obj, string? path)
|
||||
{
|
||||
var serializer = new Catalog();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
// Catalog.js file is a UTF-16 LE JSON
|
||||
public override bool Serialize(Models.Xbox.Catalog? obj, string? path)
|
||||
=> Serialize(obj, path, new UnicodeEncoding());
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
using System.IO;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class ClrMamePro : IFileSerializer<Models.ClrMamePro.MetadataFile>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.ClrMamePro.MetadataFile? obj, string? path)
|
||||
{
|
||||
var serializer = new ClrMamePro();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.ClrMamePro.MetadataFile? obj, string? path, bool quotes)
|
||||
{
|
||||
var serializer = new ClrMamePro();
|
||||
return serializer.Serialize(obj, path, quotes);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.ClrMamePro.MetadataFile? obj, string? path)
|
||||
=> Serialize(obj, path, true);
|
||||
|
||||
/// <inheritdoc cref="Serialize(Models.ClrMamePro.MetadataFile, string)"/>
|
||||
public bool Serialize(Models.ClrMamePro.MetadataFile? obj, string? path, bool quotes)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.ClrMamePro.SerializeStream(obj, quotes);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using System.IO;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class CueSheet : IFileSerializer<Models.CueSheets.CueSheet>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.CueSheets.CueSheet? obj, string? path)
|
||||
{
|
||||
var serializer = new CueSheet();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.CueSheets.CueSheet? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.CueSheet.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class DosCenter : IFileSerializer<Models.DosCenter.MetadataFile>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.DosCenter.MetadataFile? obj, string? path)
|
||||
{
|
||||
var serializer = new DosCenter();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.DosCenter.MetadataFile? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.DosCenter.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class EverdriveSMDB : IFileSerializer<Models.EverdriveSMDB.MetadataFile>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.EverdriveSMDB.MetadataFile? obj, string? path)
|
||||
{
|
||||
var serializer = new EverdriveSMDB();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.EverdriveSMDB.MetadataFile? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.EverdriveSMDB.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class GCF : IFileSerializer<Models.GCF.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.GCF.File? obj, string? path)
|
||||
{
|
||||
var serializer = new GCF();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.GCF.File? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.GCF.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class Hashfile : IFileSerializer<Models.Hashfile.Hashfile>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.Hashfile.Hashfile? obj, string? path)
|
||||
{
|
||||
var serializer = new Hashfile();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.Hashfile.Hashfile? obj, string? path, Hash hash)
|
||||
{
|
||||
var serializer = new Hashfile();
|
||||
return serializer.Serialize(obj, path, hash);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.Hashfile.Hashfile? obj, string? path)
|
||||
=> Serialize(obj, path, Hash.CRC);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.Hashfile.Hashfile? obj, string? path, Hash hash)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.Hashfile.SerializeStream(obj, hash);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class IRD : IFileSerializer<Models.IRD.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.IRD.File? obj, string? path)
|
||||
{
|
||||
var serializer = new IRD();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.IRD.File? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.IRD.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class InstallShieldCabinet : IFileSerializer<Models.InstallShieldCabinet.Cabinet>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.InstallShieldCabinet.Cabinet? obj, string? path)
|
||||
{
|
||||
var serializer = new InstallShieldCabinet();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.InstallShieldCabinet.Cabinet? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.InstallShieldCabinet.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for other JSON serializers
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public partial class JsonFile<T> : IFileSerializer<T>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public virtual bool Serialize(T? obj, string? path)
|
||||
=> Serialize(obj, path, new UTF8Encoding(false));
|
||||
|
||||
/// <summary>
|
||||
/// Serialize a <typeparamref name="T"/> into a file
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object to serialize from</typeparam>
|
||||
/// <param name="obj">Data to serialize</param>
|
||||
/// <param name="path">Path to the file to serialize to</param>
|
||||
/// <param name="encoding">Encoding to parse text as</param>
|
||||
/// <returns>True on successful serialization, false otherwise</returns>
|
||||
public bool Serialize(T? obj, string? path, Encoding encoding)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = new Streams.JsonFile<T>().Serialize(obj, encoding);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class LinearExecutable : IFileSerializer<Models.LinearExecutable.Executable>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.LinearExecutable.Executable? obj, string? path)
|
||||
{
|
||||
var serializer = new LinearExecutable();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.LinearExecutable.Executable? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.LinearExecutable.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class Listrom : IFileSerializer<Models.Listrom.MetadataFile>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.Listrom.MetadataFile? obj, string? path)
|
||||
{
|
||||
var serializer = new Listrom();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.Listrom.MetadataFile? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.Listrom.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class Listxml : XmlFile<Models.Listxml.Mame>
|
||||
{
|
||||
/// <inheritdoc cref="Interfaces.IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.Listxml.Mame? obj, string? path)
|
||||
{
|
||||
var serializer = new Listxml();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class Logiqx : XmlFile<Models.Logiqx.Datafile>
|
||||
{
|
||||
/// <inheritdoc cref="Interfaces.IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.Logiqx.Datafile? obj, string? path)
|
||||
{
|
||||
var serializer = new Logiqx();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="XmlFile.Serialize(T?, string?, string?, string?, string?, string?)" />
|
||||
public override bool Serialize(Models.Logiqx.Datafile? obj, string? path)
|
||||
=> Serialize(obj, path, Serialization.Logiqx.DocTypeName, Serialization.Logiqx.DocTypePubId, Serialization.Logiqx.DocTypeSysId, Serialization.Logiqx.DocTypeSysId);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class M1 : XmlFile<Models.Listxml.M1>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.Listxml.M1? obj, string? path)
|
||||
{
|
||||
var serializer = new M1();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class MSDOS : IFileSerializer<Models.MSDOS.Executable>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.MSDOS.Executable? obj, string? path)
|
||||
{
|
||||
var serializer = new MSDOS();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.MSDOS.Executable? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.MSDOS.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class MicrosoftCabinet : IFileSerializer<Models.MicrosoftCabinet.Cabinet>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.MicrosoftCabinet.Cabinet? obj, string? path)
|
||||
{
|
||||
var serializer = new MicrosoftCabinet();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.MicrosoftCabinet.Cabinet? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.MicrosoftCabinet.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class MoPaQ : IFileSerializer<Models.MoPaQ.Archive>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.MoPaQ.Archive? obj, string? path)
|
||||
{
|
||||
var serializer = new MoPaQ();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.MoPaQ.Archive? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.MoPaQ.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class N3DS : IFileSerializer<Models.N3DS.Cart>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.N3DS.Cart? obj, string? path)
|
||||
{
|
||||
var serializer = new N3DS();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.N3DS.Cart? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.N3DS.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class NCF : IFileSerializer<Models.NCF.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.NCF.File? obj, string? path)
|
||||
{
|
||||
var serializer = new NCF();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.NCF.File? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.NCF.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class NewExecutable : IFileSerializer<Models.NewExecutable.Executable>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.NewExecutable.Executable? obj, string? path)
|
||||
{
|
||||
var serializer = new NewExecutable();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.NewExecutable.Executable? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.NewExecutable.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class Nitro : IFileSerializer<Models.Nitro.Cart>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.Nitro.Cart? obj, string? path)
|
||||
{
|
||||
var serializer = new Nitro();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.Nitro.Cart? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.Nitro.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class OfflineList : XmlFile<Models.OfflineList.Dat>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.OfflineList.Dat? obj, string? path)
|
||||
{
|
||||
var serializer = new OfflineList();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class OpenMSX : XmlFile<Models.OpenMSX.SoftwareDb>
|
||||
{
|
||||
/// <inheritdoc cref="Interfaces.IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.OpenMSX.SoftwareDb? obj, string? path)
|
||||
{
|
||||
var serializer = new OpenMSX();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="XmlFile.Serialize(T?, string?, string?, string?, string?, string?)" />
|
||||
public override bool Serialize(Models.OpenMSX.SoftwareDb? obj, string? path)
|
||||
=> Serialize(obj, path, Serialization.OpenMSX.DocTypeName, Serialization.OpenMSX.DocTypePubId, Serialization.OpenMSX.DocTypeSysId, Serialization.OpenMSX.DocTypeSysId);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class PAK : IFileSerializer<Models.PAK.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.PAK.File? obj, string? path)
|
||||
{
|
||||
var serializer = new PAK();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.PAK.File? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.PAK.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class PFF : IFileSerializer<Models.PFF.Archive>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.PFF.Archive? obj, string? path)
|
||||
{
|
||||
var serializer = new PFF();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.PFF.Archive? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.PFF.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class PIC : IFileSerializer<Models.PIC.DiscInformation>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.PIC.DiscInformation? obj, string? path)
|
||||
{
|
||||
var serializer = new PIC();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.PIC.DiscInformation? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.PIC.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class PlayJAudio : IFileSerializer<Models.PlayJ.AudioFile>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.PlayJ.AudioFile? obj, string? path)
|
||||
{
|
||||
var serializer = new PlayJAudio();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.PlayJ.AudioFile? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.PlayJAudio.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class PlayJPlaylist : IFileSerializer<Models.PlayJ.Playlist>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.PlayJ.Playlist? obj, string? path)
|
||||
{
|
||||
var serializer = new PlayJPlaylist();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.PlayJ.Playlist? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.PlayJPlaylist.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class PortableExecutable : IFileSerializer<Models.PortableExecutable.Executable>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.PortableExecutable.Executable? obj, string? path)
|
||||
{
|
||||
var serializer = new PortableExecutable();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.PortableExecutable.Executable? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.PortableExecutable.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class Quantum : IFileSerializer<Models.Quantum.Archive>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.Quantum.Archive? obj, string? path)
|
||||
{
|
||||
var serializer = new Quantum();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.Quantum.Archive? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.Quantum.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class RomCenter : IFileSerializer<Models.RomCenter.MetadataFile>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.RomCenter.MetadataFile? obj, string? path)
|
||||
{
|
||||
var serializer = new RomCenter();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.RomCenter.MetadataFile? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.RomCenter.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class SGA : IFileSerializer<Models.SGA.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.SGA.File? obj, string? path)
|
||||
{
|
||||
var serializer = new SGA();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.SGA.File? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.SGA.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class SeparatedValue : IFileSerializer<Models.SeparatedValue.MetadataFile>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.SeparatedValue.MetadataFile? obj, string? path)
|
||||
{
|
||||
var serializer = new SeparatedValue();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.SeparatedValue.MetadataFile? obj, string? path, char delim)
|
||||
{
|
||||
var serializer = new SeparatedValue();
|
||||
return serializer.Serialize(obj, path, delim);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.SeparatedValue.MetadataFile? obj, string? path)
|
||||
=> Serialize(obj, path, ',');
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.SeparatedValue.MetadataFile? obj, string? path, char delim)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.SeparatedValue.SerializeStream(obj, delim);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class SoftwareList : XmlFile<Models.SoftwareList.SoftwareList>
|
||||
{
|
||||
/// <inheritdoc cref="Interfaces.IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.SoftwareList.SoftwareList? obj, string? path)
|
||||
{
|
||||
var serializer = new SoftwareList();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="XmlFile.Serialize(T?, string?, string?, string?, string?, string?)" />
|
||||
public override bool Serialize(Models.SoftwareList.SoftwareList? obj, string? path)
|
||||
=> Serialize(obj, path, SoftawreList.DocTypeName, SoftawreList.DocTypePubId, SoftawreList.DocTypeSysId, SoftawreList.DocTypeSysId);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class VBSP : IFileSerializer<Models.VBSP.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.VBSP.File? obj, string? path)
|
||||
{
|
||||
var serializer = new VBSP();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.VBSP.File? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.VBSP.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class VPK : IFileSerializer<Models.VPK.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.VPK.File? obj, string? path)
|
||||
{
|
||||
var serializer = new VPK();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.VPK.File? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.VPK.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class WAD : IFileSerializer<Models.WAD.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.WAD.File? obj, string? path)
|
||||
{
|
||||
var serializer = new WAD();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.WAD.File? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.WAD.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class XZP : IFileSerializer<Models.XZP.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.XZP.File? obj, string? path)
|
||||
{
|
||||
var serializer = new XZP();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.XZP.File? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Streams.XZP.SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
using System.IO;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for other XML serializers
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public partial class XmlFile<T> : IFileSerializer<T>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public virtual bool Serialize(T? obj, string? path)
|
||||
=> Serialize(obj, path, null, null, null, null);
|
||||
|
||||
/// <summary>
|
||||
/// Serializes the defined type to an XML file
|
||||
/// </summary>
|
||||
/// <param name="obj">Data to serialize</param>
|
||||
/// <param name="path">Path to the file to serialize to</param>
|
||||
/// <param name="name">Optional DOCTYPE name</param>
|
||||
/// <param name="pubid">Optional DOCTYPE pubid</param>
|
||||
/// <param name="sysid">Optional DOCTYPE sysid</param>
|
||||
/// <param name="subset">Optional DOCTYPE name</param>
|
||||
/// <returns>True on successful serialization, false otherwise</returns>
|
||||
public bool Serialize(T? obj, string? path, string? name = null, string? pubid = null, string? sysid = null, string? subset = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = new Streams.XmlFile<T>().Serialize(obj, name, pubid, sysid, subset);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
namespace SabreTools.Serialization
|
||||
{
|
||||
/// <summary>
|
||||
/// XML deserializer for Logiqx-derived metadata files
|
||||
/// </summary>
|
||||
public static class Logiqx
|
||||
{
|
||||
/// <summary>
|
||||
/// name field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string DocTypeName = "datafile";
|
||||
|
||||
/// <summary>
|
||||
/// pubid field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string DocTypePubId = "-//Logiqx//DTD ROM Management Datafile//EN";
|
||||
|
||||
/// <summary>
|
||||
/// sysid field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string DocTypeSysId = "http://www.logiqx.com/Dats/datafile.dtd";
|
||||
|
||||
/// <summary>
|
||||
/// subset field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string? DocTypeSubset = null;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
namespace SabreTools.Serialization
|
||||
{
|
||||
/// <summary>
|
||||
/// XML deserializer for OpenMSX software database files
|
||||
/// </summary>
|
||||
public static class OpenMSX
|
||||
{
|
||||
/// <summary>
|
||||
/// name field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string DocTypeName = "softwaredb";
|
||||
|
||||
/// <summary>
|
||||
/// pubid field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string? DocTypePubId = null;
|
||||
|
||||
/// <summary>
|
||||
/// sysid field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string DocTypeSysId = "softwaredb1.dtd";
|
||||
|
||||
/// <summary>
|
||||
/// subset field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string? DocTypeSubset = null;
|
||||
}
|
||||
}
|
||||
27
SabreTools.Serialization/Serializers/ArchiveDotOrg.cs
Normal file
27
SabreTools.Serialization/Serializers/ArchiveDotOrg.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
public class ArchiveDotOrg : XmlFile<Models.ArchiveDotOrg.Files>
|
||||
{
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.ArchiveDotOrg.Files? obj, string? path)
|
||||
{
|
||||
var serializer = new ArchiveDotOrg();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IStreamSerializer.Serialize(T?)"/>
|
||||
public static System.IO.Stream? SerializeStream(Models.ArchiveDotOrg.Files? obj)
|
||||
{
|
||||
var serializer = new ArchiveDotOrg();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -5,17 +5,47 @@ using SabreTools.IO.Writers;
|
||||
using SabreTools.Models.AttractMode;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
public partial class AttractMode : IStreamSerializer<MetadataFile>
|
||||
public class AttractMode :
|
||||
IFileSerializer<MetadataFile>,
|
||||
IStreamSerializer<MetadataFile>
|
||||
{
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(MetadataFile? obj, string? path)
|
||||
{
|
||||
var serializer = new AttractMode();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(MetadataFile? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(MetadataFile? obj)
|
||||
{
|
||||
var serializer = new AttractMode();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(MetadataFile? obj)
|
||||
{
|
||||
@@ -87,5 +117,7 @@ namespace SabreTools.Serialization.Streams
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
39
SabreTools.Serialization/Serializers/Catalog.cs
Normal file
39
SabreTools.Serialization/Serializers/Catalog.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
public class Catalog :
|
||||
JsonFile<Models.Xbox.Catalog>
|
||||
{
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.Xbox.Catalog? obj, string? path)
|
||||
{
|
||||
var serializer = new Catalog();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <remarks>Catalog.js file is encoded as UTF-16 LE</remarks>
|
||||
public override bool Serialize(Models.Xbox.Catalog? obj, string? path)
|
||||
=> Serialize(obj, path, new UnicodeEncoding());
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Models.Xbox.Catalog? obj)
|
||||
{
|
||||
var serializer = new Catalog();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <remarks>Catalog.js file is encoded as UTF-16 LE</remarks>
|
||||
public override Stream? Serialize(Models.Xbox.Catalog? obj)
|
||||
=> Serialize(obj, new UnicodeEncoding());
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -5,19 +5,46 @@ using SabreTools.IO.Writers;
|
||||
using SabreTools.Models.ClrMamePro;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
public partial class ClrMamePro : IStreamSerializer<MetadataFile>
|
||||
public class ClrMamePro :
|
||||
IFileSerializer<MetadataFile>,
|
||||
IStreamSerializer<MetadataFile>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(MetadataFile? obj)
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(MetadataFile? obj, string? path, bool quotes = true)
|
||||
{
|
||||
var serializer = new ClrMamePro();
|
||||
return serializer.Serialize(obj);
|
||||
return serializer.Serialize(obj, path, quotes);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(MetadataFile? obj, string? path)
|
||||
=> Serialize(obj, path, true);
|
||||
|
||||
/// <inheritdoc cref="Serialize(MetadataFile, string)"/>
|
||||
public bool Serialize(MetadataFile? obj, string? path, bool quotes)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = SerializeStream(obj, quotes);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(MetadataFile? obj, bool quotes)
|
||||
public static Stream? SerializeStream(MetadataFile? obj, bool quotes = true)
|
||||
{
|
||||
var serializer = new ClrMamePro();
|
||||
return serializer.Serialize(obj, quotes);
|
||||
@@ -454,5 +481,7 @@ namespace SabreTools.Serialization.Streams
|
||||
writer.WriteOptionalAttributeString("blit", driver.Blit);
|
||||
writer.WriteEndElement(); // driver
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,40 @@ using System.Text;
|
||||
using SabreTools.Models.CueSheets;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
public partial class CueSheet : IStreamSerializer<Models.CueSheets.CueSheet>
|
||||
public class CueSheet :
|
||||
IFileSerializer<Models.CueSheets.CueSheet>,
|
||||
IStreamSerializer<Models.CueSheets.CueSheet>
|
||||
{
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.CueSheets.CueSheet? obj, string? path)
|
||||
{
|
||||
var serializer = new CueSheet();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.CueSheets.CueSheet? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Models.CueSheets.CueSheet? obj)
|
||||
{
|
||||
@@ -263,5 +293,7 @@ namespace SabreTools.Serialization.Streams
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,40 @@ using SabreTools.IO.Writers;
|
||||
using SabreTools.Models.DosCenter;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
public partial class DosCenter : IStreamSerializer<MetadataFile>
|
||||
public class DosCenter :
|
||||
IFileSerializer<MetadataFile>,
|
||||
IStreamSerializer<MetadataFile>
|
||||
{
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(MetadataFile? obj, string? path)
|
||||
{
|
||||
var serializer = new DosCenter();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(MetadataFile? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(MetadataFile? obj)
|
||||
{
|
||||
@@ -130,5 +160,7 @@ namespace SabreTools.Serialization.Streams
|
||||
writer.WriteEndElement(); // file
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,40 @@ using SabreTools.IO.Writers;
|
||||
using SabreTools.Models.EverdriveSMDB;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
public partial class EverdriveSMDB : IStreamSerializer<MetadataFile>
|
||||
public class EverdriveSMDB :
|
||||
IFileSerializer<MetadataFile>,
|
||||
IStreamSerializer<MetadataFile>
|
||||
{
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(MetadataFile? obj, string? path)
|
||||
{
|
||||
var serializer = new EverdriveSMDB();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(MetadataFile? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(MetadataFile? obj)
|
||||
{
|
||||
@@ -69,5 +99,7 @@ namespace SabreTools.Serialization.Streams
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -6,19 +6,47 @@ using SabreTools.IO.Writers;
|
||||
using SabreTools.Models.Hashfile;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
// TODO: Replace use of Serialization.Hash with Hashing.HashType
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
public partial class Hashfile : IStreamSerializer<Models.Hashfile.Hashfile>
|
||||
public class Hashfile :
|
||||
IFileSerializer<Models.Hashfile.Hashfile>,
|
||||
IStreamSerializer<Models.Hashfile.Hashfile>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Models.Hashfile.Hashfile? obj)
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.Hashfile.Hashfile? obj, string? path, Hash hash = Hash.CRC)
|
||||
{
|
||||
var serializer = new Hashfile();
|
||||
return serializer.Serialize(obj);
|
||||
return serializer.Serialize(obj, path, hash);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.Hashfile.Hashfile? obj, string? path)
|
||||
=> Serialize(obj, path, Hash.CRC);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.Hashfile.Hashfile? obj, string? path, Hash hash)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = SerializeStream(obj, hash);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Models.Hashfile.Hashfile? obj, Hash hash)
|
||||
public static Stream? SerializeStream(Models.Hashfile.Hashfile? obj, Hash hash = Hash.CRC)
|
||||
{
|
||||
var serializer = new Hashfile();
|
||||
return serializer.Serialize(obj, hash);
|
||||
@@ -244,5 +272,7 @@ namespace SabreTools.Serialization.Streams
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,40 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
public partial class IRD : IStreamSerializer<Models.IRD.File>
|
||||
public class IRD :
|
||||
IFileSerializer<Models.IRD.File>,
|
||||
IStreamSerializer<Models.IRD.File>
|
||||
{
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.IRD.File? obj, string? path)
|
||||
{
|
||||
var serializer = new IRD();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(Models.IRD.File? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = System.IO.File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Models.IRD.File? obj)
|
||||
{
|
||||
@@ -135,5 +165,7 @@ namespace SabreTools.Serialization.Streams
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -3,14 +3,49 @@ using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for other JSON serializers
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public partial class JsonFile<T> : IStreamSerializer<T>
|
||||
public class JsonFile<T> :
|
||||
IFileSerializer<T>,
|
||||
IStreamSerializer<T>
|
||||
{
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc/>
|
||||
public virtual bool Serialize(T? obj, string? path)
|
||||
=> Serialize(obj, path, new UTF8Encoding(false));
|
||||
|
||||
/// <summary>
|
||||
/// Serialize a <typeparamref name="T"/> into a file
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object to serialize from</typeparam>
|
||||
/// <param name="obj">Data to serialize</param>
|
||||
/// <param name="path">Path to the file to serialize to</param>
|
||||
/// <param name="encoding">Encoding to parse text as</param>
|
||||
/// <returns>True on successful serialization, false otherwise</returns>
|
||||
public bool Serialize(T? obj, string? path, Encoding encoding)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Serialize(obj, encoding);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <inheritdoc/>
|
||||
public virtual Stream? Serialize(T? obj)
|
||||
=> Serialize(obj, new UTF8Encoding(false));
|
||||
@@ -39,5 +74,7 @@ namespace SabreTools.Serialization.Streams
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,40 @@ using System.Text;
|
||||
using SabreTools.Models.Listrom;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
public partial class Listrom : IStreamSerializer<MetadataFile>
|
||||
public class Listrom :
|
||||
IFileSerializer<MetadataFile>,
|
||||
IStreamSerializer<MetadataFile>
|
||||
{
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(MetadataFile? obj, string? path)
|
||||
{
|
||||
var serializer = new Listrom();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(MetadataFile? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(MetadataFile? obj)
|
||||
{
|
||||
@@ -162,5 +192,7 @@ namespace SabreTools.Serialization.Streams
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
28
SabreTools.Serialization/Serializers/Listxml.cs
Normal file
28
SabreTools.Serialization/Serializers/Listxml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
public class Listxml :
|
||||
XmlFile<Models.Listxml.Mame>
|
||||
{
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.Listxml.Mame? obj, string? path)
|
||||
{
|
||||
var serializer = new Listxml();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IStreamSerializer.Serialize(T?)"/>
|
||||
public static System.IO.Stream? SerializeStream(Models.Listxml.Mame? obj)
|
||||
{
|
||||
var serializer = new Listxml();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
63
SabreTools.Serialization/Serializers/Logiqx.cs
Normal file
63
SabreTools.Serialization/Serializers/Logiqx.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System.IO;
|
||||
using SabreTools.Models.Logiqx;
|
||||
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
public class Logiqx :
|
||||
XmlFile<Datafile>
|
||||
{
|
||||
#region Constants
|
||||
|
||||
/// <summary>
|
||||
/// name field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string DocTypeName = "datafile";
|
||||
|
||||
/// <summary>
|
||||
/// pubid field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string DocTypePubId = "-//Logiqx//DTD ROM Management Datafile//EN";
|
||||
|
||||
/// <summary>
|
||||
/// sysid field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string DocTypeSysId = "http://www.logiqx.com/Dats/datafile.dtd";
|
||||
|
||||
/// <summary>
|
||||
/// subset field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string? DocTypeSubset = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Datafile? obj, string? path)
|
||||
{
|
||||
var serializer = new Logiqx();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="XmlFile.Serialize(T?, string?, string?, string?, string?, string?)" />
|
||||
public override bool Serialize(Datafile? obj, string? path)
|
||||
=> Serialize(obj, path, DocTypeName, DocTypePubId, DocTypeSysId, DocTypeSysId);
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Datafile? obj)
|
||||
{
|
||||
var serializer = new Logiqx();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="XmlFile.Serialize(T?, string?, string?, string?, string?)" />
|
||||
public override Stream? Serialize(Datafile? obj)
|
||||
=> Serialize(obj, DocTypeName, DocTypePubId, DocTypeSysId, DocTypeSysId);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
28
SabreTools.Serialization/Serializers/M1.cs
Normal file
28
SabreTools.Serialization/Serializers/M1.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
public class M1 :
|
||||
XmlFile<Models.Listxml.M1>
|
||||
{
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.Listxml.M1? obj, string? path)
|
||||
{
|
||||
var serializer = new M1();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IStreamSerializer.Serialize(T?)"/>
|
||||
public static System.IO.Stream? SerializeStream(Models.Listxml.M1? obj)
|
||||
{
|
||||
var serializer = new M1();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
28
SabreTools.Serialization/Serializers/OfflineList.cs
Normal file
28
SabreTools.Serialization/Serializers/OfflineList.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
public class OfflineList :
|
||||
XmlFile<Models.OfflineList.Dat>
|
||||
{
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.OfflineList.Dat? obj, string? path)
|
||||
{
|
||||
var serializer = new OfflineList();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IStreamSerializer.Serialize(T?)"/>
|
||||
public static System.IO.Stream? SerializeStream(Models.OfflineList.Dat? obj)
|
||||
{
|
||||
var serializer = new OfflineList();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
63
SabreTools.Serialization/Serializers/OpenMSX.cs
Normal file
63
SabreTools.Serialization/Serializers/OpenMSX.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System.IO;
|
||||
using SabreTools.Models.OpenMSX;
|
||||
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
public class OpenMSX :
|
||||
XmlFile<SoftwareDb>
|
||||
{
|
||||
#region Constants
|
||||
|
||||
/// <summary>
|
||||
/// name field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string DocTypeName = "softwaredb";
|
||||
|
||||
/// <summary>
|
||||
/// pubid field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string? DocTypePubId = null;
|
||||
|
||||
/// <summary>
|
||||
/// sysid field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string DocTypeSysId = "softwaredb1.dtd";
|
||||
|
||||
/// <summary>
|
||||
/// subset field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string? DocTypeSubset = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(SoftwareDb? obj, string? path)
|
||||
{
|
||||
var serializer = new OpenMSX();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="XmlFile.Serialize(T?, string?, string?, string?, string?, string?)" />
|
||||
public override bool Serialize(SoftwareDb? obj, string? path)
|
||||
=> Serialize(obj, path, DocTypeName, DocTypePubId, DocTypeSysId, DocTypeSysId);
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(SoftwareDb? obj)
|
||||
{
|
||||
var serializer = new OpenMSX();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="XmlFile.Serialize(T?, string?, string?, string?, string?)" />
|
||||
public override Stream? Serialize(SoftwareDb? obj)
|
||||
=> Serialize(obj, DocTypeName, DocTypePubId, DocTypeSysId, DocTypeSysId);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,40 @@ using SabreTools.IO.Writers;
|
||||
using SabreTools.Models.RomCenter;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
public partial class RomCenter : IStreamSerializer<MetadataFile>
|
||||
public class RomCenter :
|
||||
IFileSerializer<MetadataFile>,
|
||||
IStreamSerializer<MetadataFile>
|
||||
{
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(MetadataFile? obj, string? path)
|
||||
{
|
||||
var serializer = new RomCenter();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(MetadataFile? obj, string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = SerializeStream(obj);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(MetadataFile? obj)
|
||||
{
|
||||
@@ -169,5 +199,7 @@ namespace SabreTools.Serialization.Streams
|
||||
writer.WriteLine();
|
||||
writer.Flush();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,44 @@ using SabreTools.IO.Writers;
|
||||
using SabreTools.Models.SeparatedValue;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
public partial class SeparatedValue : IStreamSerializer<MetadataFile>
|
||||
public class SeparatedValue :
|
||||
IFileSerializer<MetadataFile>,
|
||||
IStreamSerializer<MetadataFile>
|
||||
{
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(MetadataFile? obj, string? path, char delim = ',')
|
||||
{
|
||||
var serializer = new SeparatedValue();
|
||||
return serializer.Serialize(obj, path, delim);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(MetadataFile? obj, string? path)
|
||||
=> Serialize(obj, path, ',');
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Serialize(MetadataFile? obj, string? path, char delim)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = SerializeStream(obj, delim);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(MetadataFile? obj)
|
||||
{
|
||||
@@ -120,5 +154,7 @@ namespace SabreTools.Serialization.Streams
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
62
SabreTools.Serialization/Serializers/SoftwareList.cs
Normal file
62
SabreTools.Serialization/Serializers/SoftwareList.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using System.IO;
|
||||
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
public class SoftwareList :
|
||||
XmlFile<Models.SoftwareList.SoftwareList>
|
||||
{
|
||||
#region Constants
|
||||
|
||||
/// <summary>
|
||||
/// name field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string DocTypeName = "softwarelist";
|
||||
|
||||
/// <summary>
|
||||
/// pubid field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string? DocTypePubId = null;
|
||||
|
||||
/// <summary>
|
||||
/// sysid field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string DocTypeSysId = "softwarelist.dtd";
|
||||
|
||||
/// <summary>
|
||||
/// subset field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string? DocTypeSubset = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IFileSerializer.Serialize(T?, string?)"/>
|
||||
public static bool SerializeFile(Models.SoftwareList.SoftwareList? obj, string? path)
|
||||
{
|
||||
var serializer = new SoftwareList();
|
||||
return serializer.Serialize(obj, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="XmlFile.Serialize(T?, string?, string?, string?, string?, string?)" />
|
||||
public override bool Serialize(Models.SoftwareList.SoftwareList? obj, string? path)
|
||||
=> Serialize(obj, path, DocTypeName, DocTypePubId, DocTypeSysId, DocTypeSysId);
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Models.SoftwareList.SoftwareList? obj)
|
||||
{
|
||||
var serializer = new SoftwareList();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="XmlFile.Serialize(T?, string?, string?, string?, string?)" />
|
||||
public override Stream? Serialize(Models.SoftwareList.SoftwareList? obj)
|
||||
=> Serialize(obj, DocTypeName, DocTypePubId, DocTypeSysId, DocTypeSysId);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,51 @@ using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
namespace SabreTools.Serialization.Serializers
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for other XML serializers
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public partial class XmlFile<T> : IStreamSerializer<T>
|
||||
public class XmlFile<T> :
|
||||
IFileSerializer<T>,
|
||||
IStreamSerializer<T>
|
||||
{
|
||||
#region IFileSerializer
|
||||
|
||||
/// <inheritdoc/>
|
||||
public virtual bool Serialize(T? obj, string? path)
|
||||
=> Serialize(obj, path, null, null, null, null);
|
||||
|
||||
/// <summary>
|
||||
/// Serializes the defined type to an XML file
|
||||
/// </summary>
|
||||
/// <param name="obj">Data to serialize</param>
|
||||
/// <param name="path">Path to the file to serialize to</param>
|
||||
/// <param name="name">Optional DOCTYPE name</param>
|
||||
/// <param name="pubid">Optional DOCTYPE pubid</param>
|
||||
/// <param name="sysid">Optional DOCTYPE sysid</param>
|
||||
/// <param name="subset">Optional DOCTYPE name</param>
|
||||
/// <returns>True on successful serialization, false otherwise</returns>
|
||||
public bool Serialize(T? obj, string? path, string? name = null, string? pubid = null, string? sysid = null, string? subset = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
using var stream = Serialize(obj, name, pubid, sysid, subset);
|
||||
if (stream == null)
|
||||
return false;
|
||||
|
||||
using var fs = File.OpenWrite(path);
|
||||
stream.CopyTo(fs);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStreamSerializer
|
||||
|
||||
/// <summary>
|
||||
/// Serializes the defined type to a stream
|
||||
/// </summary>
|
||||
@@ -58,5 +95,7 @@ namespace SabreTools.Serialization.Streams
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
namespace SabreTools.Serialization
|
||||
{
|
||||
/// <summary>
|
||||
/// XML deserializer for MAME softwarelist files
|
||||
/// </summary>
|
||||
public static class SoftawreList
|
||||
{
|
||||
/// <summary>
|
||||
/// name field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string DocTypeName = "softwarelist";
|
||||
|
||||
/// <summary>
|
||||
/// pubid field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string? DocTypePubId = null;
|
||||
|
||||
/// <summary>
|
||||
/// sysid field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string DocTypeSysId = "softwarelist.dtd";
|
||||
|
||||
/// <summary>
|
||||
/// subset field for DOCTYPE
|
||||
/// </summary>
|
||||
public const string? DocTypeSubset = null;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Models.AACS;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class AACS : IStreamSerializer<MediaKeyBlock>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(MediaKeyBlock? obj)
|
||||
{
|
||||
var serializer = new AACS();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(MediaKeyBlock? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class ArchiveDotOrg : XmlFile<Models.ArchiveDotOrg.Files>
|
||||
{
|
||||
/// <inheritdoc cref="Interfaces.IStreamSerializer.Serialize(T?)"/>
|
||||
public static System.IO.Stream? SerializeStream(Models.ArchiveDotOrg.Files? obj)
|
||||
{
|
||||
var serializer = new ArchiveDotOrg();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Models.BDPlus;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class BDPlus : IStreamSerializer<SVM>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(SVM? obj)
|
||||
{
|
||||
var serializer = new BDPlus();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(SVM? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Models.BFPK;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class BFPK : IStreamSerializer<Archive>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Archive? obj)
|
||||
{
|
||||
var serializer = new BFPK();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(Archive? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class BSP : IStreamSerializer<Models.BSP.File>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Models.BSP.File? obj)
|
||||
{
|
||||
var serializer = new BSP();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(Models.BSP.File? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Models.CFB;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class CFB : IStreamSerializer<Binary>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Binary? obj)
|
||||
{
|
||||
var serializer = new CFB();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(Binary? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class CIA : IStreamSerializer<Models.N3DS.CIA>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Models.N3DS.CIA? obj)
|
||||
{
|
||||
var serializer = new CIA();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(Models.N3DS.CIA? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class Catalog : JsonFile<Models.Xbox.Catalog>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Models.Xbox.Catalog? obj)
|
||||
{
|
||||
var serializer = new Catalog();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
// Catalog JSON is encoded as UTF-16 LE
|
||||
public override Stream? Serialize(Models.Xbox.Catalog? obj)
|
||||
=> Serialize(obj, new UnicodeEncoding());
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class GCF : IStreamSerializer<Models.GCF.File>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Models.GCF.File? obj)
|
||||
{
|
||||
var serializer = new GCF();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(Models.GCF.File? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Models.InstallShieldCabinet;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class InstallShieldCabinet : IStreamSerializer<Cabinet>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Cabinet? obj)
|
||||
{
|
||||
var serializer = new InstallShieldCabinet();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(Cabinet? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Models.LinearExecutable;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class LinearExecutable : IStreamSerializer<Executable>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Executable? obj)
|
||||
{
|
||||
var serializer = new LinearExecutable();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(Executable? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class Listxml : XmlFile<Models.Listxml.Mame>
|
||||
{
|
||||
/// <inheritdoc cref="Interfaces.IStreamSerializer.Serialize(T?)"/>
|
||||
public static System.IO.Stream? SerializeStream(Models.Listxml.Mame? obj)
|
||||
{
|
||||
var serializer = new Listxml();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System.IO;
|
||||
using SabreTools.Models.Logiqx;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class Logiqx : XmlFile<Datafile>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Datafile? obj)
|
||||
{
|
||||
var serializer = new Logiqx();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="XmlFile.Serialize(T?, string?, string?, string?, string?)" />
|
||||
public override Stream? Serialize(Datafile? obj)
|
||||
=> Serialize(obj, Serialization.Logiqx.DocTypeName, Serialization.Logiqx.DocTypePubId, Serialization.Logiqx.DocTypeSysId, Serialization.Logiqx.DocTypeSysId);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class M1 : XmlFile<Models.Listxml.M1>
|
||||
{
|
||||
/// <inheritdoc cref="Interfaces.IStreamSerializer.Serialize(T?)"/>
|
||||
public static System.IO.Stream? SerializeStream(Models.Listxml.M1? obj)
|
||||
{
|
||||
var serializer = new M1();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Models.MSDOS;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class MSDOS : IStreamSerializer<Executable>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Executable? obj)
|
||||
{
|
||||
var serializer = new MSDOS();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(Executable? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Models.MicrosoftCabinet;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class MicrosoftCabinet : IStreamSerializer<Cabinet>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Cabinet? obj)
|
||||
{
|
||||
var serializer = new MicrosoftCabinet();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(Cabinet? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Models.MoPaQ;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class MoPaQ : IStreamSerializer<Archive>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Archive? obj)
|
||||
{
|
||||
var serializer = new MoPaQ();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(Archive? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Models.N3DS;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class N3DS : IStreamSerializer<Cart>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Cart? obj)
|
||||
{
|
||||
var serializer = new N3DS();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(Cart? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class NCF : IStreamSerializer<Models.NCF.File>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Models.NCF.File? obj)
|
||||
{
|
||||
var serializer = new NCF();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(Models.NCF.File? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Models.NewExecutable;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class NewExecutable : IStreamSerializer<Executable>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Executable? obj)
|
||||
{
|
||||
var serializer = new NewExecutable();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(Executable? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Models.Nitro;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class Nitro : IStreamSerializer<Cart>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Cart? obj)
|
||||
{
|
||||
var serializer = new Nitro();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(Cart? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class OfflineList : XmlFile<Models.OfflineList.Dat>
|
||||
{
|
||||
/// <inheritdoc cref="Interfaces.IStreamSerializer.Serialize(T?)"/>
|
||||
public static System.IO.Stream? SerializeStream(Models.OfflineList.Dat? obj)
|
||||
{
|
||||
var serializer = new OfflineList();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System.IO;
|
||||
using SabreTools.Models.OpenMSX;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class OpenMSX : XmlFile<SoftwareDb>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(SoftwareDb? obj)
|
||||
{
|
||||
var serializer = new OpenMSX();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="XmlFile.Serialize(T?, string?, string?, string?, string?)" />
|
||||
public override Stream? Serialize(SoftwareDb? obj)
|
||||
=> Serialize(obj, Serialization.OpenMSX.DocTypeName, Serialization.OpenMSX.DocTypePubId, Serialization.OpenMSX.DocTypeSysId, Serialization.OpenMSX.DocTypeSysId);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class PAK : IStreamSerializer<Models.PAK.File>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Models.PAK.File? obj)
|
||||
{
|
||||
var serializer = new PAK();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(Models.PAK.File? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Models.PFF;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class PFF : IStreamSerializer<Archive>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Archive? obj)
|
||||
{
|
||||
var serializer = new PFF();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(Archive? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Models.PIC;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class PIC : IStreamSerializer<DiscInformation>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(DiscInformation? obj)
|
||||
{
|
||||
var serializer = new PIC();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(DiscInformation? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Models.PlayJ;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class PlayJAudio : IStreamSerializer<AudioFile>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(AudioFile? obj)
|
||||
{
|
||||
var serializer = new PlayJAudio();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(AudioFile? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Models.PlayJ;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Streams
|
||||
{
|
||||
public partial class PlayJPlaylist : IStreamSerializer<Playlist>
|
||||
{
|
||||
/// <inheritdoc cref="IStreamSerializer.Serialize(T?)"/>
|
||||
public static Stream? SerializeStream(Playlist? obj)
|
||||
{
|
||||
var serializer = new PlayJPlaylist();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Stream? Serialize(Playlist? obj) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user