mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-07-13 12:26:59 +00:00
Add static deserializers for IFileSerializer
This commit is contained in:
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class AACS : IFileSerializer<Models.AACS.MediaKeyBlock>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.AACS.MediaKeyBlock? Deserialize(string? path)
|
||||
{
|
||||
var obj = new AACS();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.AACS.MediaKeyBlock? Deserialize(string? path)
|
||||
public Models.AACS.MediaKeyBlock? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.AACS().Deserialize(stream);
|
||||
|
||||
@@ -2,6 +2,11 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class ArchiveDotOrg : XmlFile<Models.ArchiveDotOrg.Files>
|
||||
{
|
||||
// All serialization logic is in the base class
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.ArchiveDotOrg.Files? Deserialize(string? path)
|
||||
{
|
||||
var obj = new ArchiveDotOrg();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,18 @@
|
||||
using SabreTools.Models.AttractMode;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class AttractMode : IFileSerializer<MetadataFile>
|
||||
public partial class AttractMode : IFileSerializer<Models.AttractMode.MetadataFile>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.AttractMode.MetadataFile? Deserialize(string? path)
|
||||
{
|
||||
var obj = new AttractMode();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public MetadataFile? Deserialize(string? path)
|
||||
public Models.AttractMode.MetadataFile? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.AttractMode().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class BDPlus : IFileSerializer<Models.BDPlus.SVM>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.BDPlus.SVM? Deserialize(string? path)
|
||||
{
|
||||
var obj = new BDPlus();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.BDPlus.SVM? Deserialize(string? path)
|
||||
public Models.BDPlus.SVM? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.BDPlus().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class BFPK : IFileSerializer<Models.BFPK.Archive>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.BFPK.Archive? Deserialize(string? path)
|
||||
{
|
||||
var obj = new BFPK();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.BFPK.Archive? Deserialize(string? path)
|
||||
public Models.BFPK.Archive? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.BFPK().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class BSP : IFileSerializer<Models.BSP.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.BSP.File? Deserialize(string? path)
|
||||
{
|
||||
var obj = new BSP();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.BSP.File? Deserialize(string? path)
|
||||
public Models.BSP.File? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.BSP().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class CFB : IFileSerializer<Models.CFB.Binary>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.CFB.Binary? Deserialize(string? path)
|
||||
{
|
||||
var obj = new CFB();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.CFB.Binary? Deserialize(string? path)
|
||||
public Models.CFB.Binary? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.CFB().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class CIA : IFileSerializer<Models.N3DS.CIA>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.N3DS.CIA? Deserialize(string? path)
|
||||
{
|
||||
var obj = new CIA();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.N3DS.CIA? Deserialize(string? path)
|
||||
public Models.N3DS.CIA? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.CIA().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class Catalog : JsonFile<Models.Xbox.Catalog>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.Xbox.Catalog? Deserialize(string? path)
|
||||
{
|
||||
var obj = new Catalog();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
// Catalog.js file is a UTF-16 LE JSON
|
||||
public new Models.Xbox.Catalog? Deserialize(string? path)
|
||||
=> Deserialize(path, new UnicodeEncoding());
|
||||
public new Models.Xbox.Catalog? DeserializeImpl(string? path)
|
||||
=> DeserializeImpl(path, new UnicodeEncoding());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,29 @@
|
||||
using SabreTools.Models.ClrMamePro;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class ClrMamePro : IFileSerializer<MetadataFile>
|
||||
public partial class ClrMamePro : IFileSerializer<Models.ClrMamePro.MetadataFile>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public MetadataFile? Deserialize(string? path) => Deserialize(path, true);
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.ClrMamePro.MetadataFile? Deserialize(string? path)
|
||||
{
|
||||
var obj = new ClrMamePro();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.ClrMamePro.MetadataFile? Deserialize(string? path, bool quotes)
|
||||
{
|
||||
var obj = new ClrMamePro();
|
||||
return obj.DeserializeImpl(path, quotes);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public MetadataFile? Deserialize(string? path, bool quotes)
|
||||
public Models.ClrMamePro.MetadataFile? DeserializeImpl(string? path)
|
||||
=> DeserializeImpl(path, true);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.ClrMamePro.MetadataFile? DeserializeImpl(string? path, bool quotes)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.ClrMamePro().Deserialize(stream, quotes);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class CueSheet : IFileSerializer<Models.CueSheets.CueSheet>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.CueSheets.CueSheet? Deserialize(string? path)
|
||||
{
|
||||
var obj = new CueSheet();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.CueSheets.CueSheet? Deserialize(string? path)
|
||||
public Models.CueSheets.CueSheet? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.CueSheet().Deserialize(stream);
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
using SabreTools.Models.DosCenter;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class DosCenter : IFileSerializer<MetadataFile>
|
||||
public partial class DosCenter : IFileSerializer<Models.DosCenter.MetadataFile>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.DosCenter.MetadataFile? Deserialize(string? path)
|
||||
{
|
||||
var obj = new DosCenter();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public MetadataFile? Deserialize(string? path)
|
||||
public Models.DosCenter.MetadataFile? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.DosCenter().Deserialize(stream);
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
using SabreTools.Models.EverdriveSMDB;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class EverdriveSMDB : IFileSerializer<MetadataFile>
|
||||
public partial class EverdriveSMDB : IFileSerializer<Models.EverdriveSMDB.MetadataFile>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.EverdriveSMDB.MetadataFile? Deserialize(string? path)
|
||||
{
|
||||
var obj = new EverdriveSMDB();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public MetadataFile? Deserialize(string? path)
|
||||
public Models.EverdriveSMDB.MetadataFile? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.EverdriveSMDB().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class GCF : IFileSerializer<Models.GCF.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.GCF.File? Deserialize(string? path)
|
||||
{
|
||||
var obj = new GCF();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.GCF.File? Deserialize(string? path)
|
||||
public Models.GCF.File? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.GCF().Deserialize(stream);
|
||||
|
||||
@@ -4,11 +4,26 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class Hashfile : IFileSerializer<Models.Hashfile.Hashfile>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public Models.Hashfile.Hashfile? Deserialize(string? path) => Deserialize(path, Hash.CRC);
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.Hashfile.Hashfile? Deserialize(string? path)
|
||||
{
|
||||
var obj = new Hashfile();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.Hashfile.Hashfile? Deserialize(string? path, Hash hash)
|
||||
{
|
||||
var obj = new Hashfile();
|
||||
return obj.DeserializeImpl(path, hash);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.Hashfile.Hashfile? Deserialize(string? path, Hash hash)
|
||||
public Models.Hashfile.Hashfile? DeserializeImpl(string? path)
|
||||
=> DeserializeImpl(path, Hash.CRC);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.Hashfile.Hashfile? DeserializeImpl(string? path, Hash hash)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.Hashfile().Deserialize(stream, hash);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class IRD : IFileSerializer<Models.IRD.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.IRD.File? Deserialize(string? path)
|
||||
{
|
||||
var obj = new IRD();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.IRD.File? Deserialize(string? path)
|
||||
public Models.IRD.File? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.IRD().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class InstallShieldCabinet : IFileSerializer<Models.InstallShieldCabinet.Cabinet>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.InstallShieldCabinet.Cabinet? Deserialize(string? path)
|
||||
{
|
||||
var obj = new InstallShieldCabinet();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.InstallShieldCabinet.Cabinet? Deserialize(string? path)
|
||||
public Models.InstallShieldCabinet.Cabinet? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.InstallShieldCabinet().Deserialize(stream);
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace SabreTools.Serialization.Files
|
||||
public partial class JsonFile<T> : IFileSerializer<T>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public T? Deserialize(string? path)
|
||||
=> Deserialize(path, new UTF8Encoding(false));
|
||||
public T? DeserializeImpl(string? path)
|
||||
=> DeserializeImpl(path, new UTF8Encoding(false));
|
||||
|
||||
/// <summary>
|
||||
/// Deserialize a file into <typeparamref name="T"/>
|
||||
@@ -20,7 +20,7 @@ namespace SabreTools.Serialization.Files
|
||||
/// <param name="path">Path to deserialize from</param>
|
||||
/// <param name="encoding">Encoding to parse text as</param>
|
||||
/// <returns>Filled object on success, null on error</returns>
|
||||
public T? Deserialize(string? path, Encoding encoding)
|
||||
public T? DeserializeImpl(string? path, Encoding encoding)
|
||||
{
|
||||
using var data = PathProcessor.OpenStream(path);
|
||||
return new Streams.JsonFile<T>().Deserialize(data, encoding);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class LinearExecutable : IFileSerializer<Models.LinearExecutable.Executable>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.LinearExecutable.Executable? Deserialize(string? path)
|
||||
{
|
||||
var obj = new LinearExecutable();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.LinearExecutable.Executable? Deserialize(string? path)
|
||||
public Models.LinearExecutable.Executable? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.LinearExecutable().Deserialize(stream);
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
using SabreTools.Models.Listrom;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class Listrom : IFileSerializer<MetadataFile>
|
||||
public partial class Listrom : IFileSerializer<Models.Listrom.MetadataFile>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.Listrom.MetadataFile? Deserialize(string? path)
|
||||
{
|
||||
var obj = new Listrom();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public MetadataFile? Deserialize(string? path)
|
||||
public Models.Listrom.MetadataFile? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.Listrom().Deserialize(stream);
|
||||
|
||||
@@ -2,6 +2,11 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class Listxml : XmlFile<Models.Listxml.Mame>
|
||||
{
|
||||
// All serialization logic is in the base class
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.Listxml.Mame? Deserialize(string? path)
|
||||
{
|
||||
var obj = new Listxml();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,11 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class Logiqx : XmlFile<Models.Logiqx.Datafile>
|
||||
{
|
||||
// All serialization logic is in the base class
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.Logiqx.Datafile? Deserialize(string? path)
|
||||
{
|
||||
var obj = new Logiqx();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,11 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class M1 : XmlFile<Models.Listxml.M1>
|
||||
{
|
||||
// All serialization logic is in the base class
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.Listxml.M1? Deserialize(string? path)
|
||||
{
|
||||
var obj = new M1();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class MSDOS : IFileSerializer<Models.MSDOS.Executable>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.MSDOS.Executable? Deserialize(string? path)
|
||||
{
|
||||
var obj = new MSDOS();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.MSDOS.Executable? Deserialize(string? path)
|
||||
public Models.MSDOS.Executable? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.MSDOS().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class MicrosoftCabinet : IFileSerializer<Models.MicrosoftCabinet.Cabinet>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.MicrosoftCabinet.Cabinet? Deserialize(string? path)
|
||||
{
|
||||
var obj = new MicrosoftCabinet();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.MicrosoftCabinet.Cabinet? Deserialize(string? path)
|
||||
public Models.MicrosoftCabinet.Cabinet? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.MicrosoftCabinet().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class MoPaQ : IFileSerializer<Models.MoPaQ.Archive>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.MoPaQ.Archive? Deserialize(string? path)
|
||||
{
|
||||
var obj = new MoPaQ();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.MoPaQ.Archive? Deserialize(string? path)
|
||||
public Models.MoPaQ.Archive? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.MoPaQ().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class N3DS : IFileSerializer<Models.N3DS.Cart>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.N3DS.Cart? Deserialize(string? path)
|
||||
{
|
||||
var obj = new N3DS();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.N3DS.Cart? Deserialize(string? path)
|
||||
public Models.N3DS.Cart? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.N3DS().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class NCF : IFileSerializer<Models.NCF.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.NCF.File? Deserialize(string? path)
|
||||
{
|
||||
var obj = new NCF();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.NCF.File? Deserialize(string? path)
|
||||
public Models.NCF.File? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.NCF().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class NewExecutable : IFileSerializer<Models.NewExecutable.Executable>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.NewExecutable.Executable? Deserialize(string? path)
|
||||
{
|
||||
var obj = new NewExecutable();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.NewExecutable.Executable? Deserialize(string? path)
|
||||
public Models.NewExecutable.Executable? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.NewExecutable().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class Nitro : IFileSerializer<Models.Nitro.Cart>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.Nitro.Cart? Deserialize(string? path)
|
||||
{
|
||||
var obj = new Nitro();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.Nitro.Cart? Deserialize(string? path)
|
||||
public Models.Nitro.Cart? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.Nitro().Deserialize(stream);
|
||||
|
||||
@@ -2,6 +2,11 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class OfflineList : XmlFile<Models.OfflineList.Dat>
|
||||
{
|
||||
// All serialization logic is in the base class
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.OfflineList.Dat? Deserialize(string? path)
|
||||
{
|
||||
var obj = new OfflineList();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,11 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class OpenMSX : XmlFile<Models.OpenMSX.SoftwareDb>
|
||||
{
|
||||
// All serialization logic is in the base class
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.OpenMSX.SoftwareDb? Deserialize(string? path)
|
||||
{
|
||||
var obj = new OpenMSX();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class PAK : IFileSerializer<Models.PAK.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.PAK.File? Deserialize(string? path)
|
||||
{
|
||||
var obj = new PAK();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.PAK.File? Deserialize(string? path)
|
||||
public Models.PAK.File? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.PAK().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class PFF : IFileSerializer<Models.PFF.Archive>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.PFF.Archive? Deserialize(string? path)
|
||||
{
|
||||
var obj = new PFF();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.PFF.Archive? Deserialize(string? path)
|
||||
public Models.PFF.Archive? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.PFF().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class PIC : IFileSerializer<Models.PIC.DiscInformation>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.PIC.DiscInformation? Deserialize(string? path)
|
||||
{
|
||||
var obj = new PIC();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.PIC.DiscInformation? Deserialize(string? path)
|
||||
public Models.PIC.DiscInformation? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.PIC().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class PlayJAudio : IFileSerializer<Models.PlayJ.AudioFile>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.PlayJ.AudioFile? Deserialize(string? path)
|
||||
{
|
||||
var obj = new PlayJAudio();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.PlayJ.AudioFile? Deserialize(string? path)
|
||||
public Models.PlayJ.AudioFile? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.PlayJAudio().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class PlayJPlaylist : IFileSerializer<Models.PlayJ.Playlist>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.PlayJ.Playlist? Deserialize(string? path)
|
||||
{
|
||||
var obj = new PlayJPlaylist();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.PlayJ.Playlist? Deserialize(string? path)
|
||||
public Models.PlayJ.Playlist? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.PlayJPlaylist().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class PortableExecutable : IFileSerializer<Models.PortableExecutable.Executable>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.PortableExecutable.Executable? Deserialize(string? path)
|
||||
{
|
||||
var obj = new PortableExecutable();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.PortableExecutable.Executable? Deserialize(string? path)
|
||||
public Models.PortableExecutable.Executable? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.PortableExecutable().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class Quantum : IFileSerializer<Models.Quantum.Archive>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.Quantum.Archive? Deserialize(string? path)
|
||||
{
|
||||
var obj = new Quantum();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.Quantum.Archive? Deserialize(string? path)
|
||||
public Models.Quantum.Archive? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.Quantum().Deserialize(stream);
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
using SabreTools.Models.RomCenter;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class RomCenter : IFileSerializer<MetadataFile>
|
||||
public partial class RomCenter : IFileSerializer<Models.RomCenter.MetadataFile>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.RomCenter.MetadataFile? Deserialize(string? path)
|
||||
{
|
||||
var obj = new RomCenter();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public MetadataFile? Deserialize(string? path)
|
||||
public Models.RomCenter.MetadataFile? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.RomCenter().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class SGA : IFileSerializer<Models.SGA.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.SGA.File? Deserialize(string? path)
|
||||
{
|
||||
var obj = new SGA();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.SGA.File? Deserialize(string? path)
|
||||
public Models.SGA.File? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.SGA().Deserialize(stream);
|
||||
|
||||
@@ -1,15 +1,29 @@
|
||||
using SabreTools.Models.SeparatedValue;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class SeparatedValue : IFileSerializer<MetadataFile>
|
||||
public partial class SeparatedValue : IFileSerializer<Models.SeparatedValue.MetadataFile>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public MetadataFile? Deserialize(string? path) => Deserialize(path, ',');
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.SeparatedValue.MetadataFile? Deserialize(string? path)
|
||||
{
|
||||
var obj = new SeparatedValue();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.SeparatedValue.MetadataFile? Deserialize(string? path, char delim)
|
||||
{
|
||||
var obj = new SeparatedValue();
|
||||
return obj.DeserializeImpl(path, delim);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public MetadataFile? Deserialize(string? path, char delim)
|
||||
public Models.SeparatedValue.MetadataFile? DeserializeImpl(string? path)
|
||||
=> DeserializeImpl(path, ',');
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.SeparatedValue.MetadataFile? DeserializeImpl(string? path, char delim)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.SeparatedValue().Deserialize(stream, delim);
|
||||
|
||||
@@ -2,6 +2,11 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class SoftwareList : XmlFile<Models.SoftwareList.SoftwareList>
|
||||
{
|
||||
// All serialization logic is in the base class
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.SoftwareList.SoftwareList? Deserialize(string? path)
|
||||
{
|
||||
var obj = new SoftwareList();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class VBSP : IFileSerializer<Models.VBSP.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.VBSP.File? Deserialize(string? path)
|
||||
{
|
||||
var obj = new VBSP();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.VBSP.File? Deserialize(string? path)
|
||||
public Models.VBSP.File? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.VBSP().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class VPK : IFileSerializer<Models.VPK.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.VPK.File? Deserialize(string? path)
|
||||
{
|
||||
var obj = new VPK();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.VPK.File? Deserialize(string? path)
|
||||
public Models.VPK.File? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.VPK().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class WAD : IFileSerializer<Models.WAD.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.WAD.File? Deserialize(string? path)
|
||||
{
|
||||
var obj = new WAD();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.WAD.File? Deserialize(string? path)
|
||||
public Models.WAD.File? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.WAD().Deserialize(stream);
|
||||
|
||||
@@ -4,8 +4,15 @@ namespace SabreTools.Serialization.Files
|
||||
{
|
||||
public partial class XZP : IFileSerializer<Models.XZP.File>
|
||||
{
|
||||
/// <inheritdoc cref="IFileSerializer.Deserialize(string?)"/>
|
||||
public static Models.XZP.File? Deserialize(string? path)
|
||||
{
|
||||
var obj = new XZP();
|
||||
return obj.DeserializeImpl(path);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Models.XZP.File? Deserialize(string? path)
|
||||
public Models.XZP.File? DeserializeImpl(string? path)
|
||||
{
|
||||
using var stream = PathProcessor.OpenStream(path);
|
||||
return new Streams.XZP().Deserialize(stream);
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace SabreTools.Serialization.Files
|
||||
public partial class XmlFile<T> : IFileSerializer<T>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public T? Deserialize(string? path)
|
||||
public T? DeserializeImpl(string? path)
|
||||
{
|
||||
using var data = PathProcessor.OpenStream(path);
|
||||
return new Streams.XmlFile<T>().Deserialize(data);
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace SabreTools.Serialization.Interfaces
|
||||
/// <typeparam name="T">Type of object to deserialize to</typeparam>
|
||||
/// <param name="path">Path to deserialize from</param>
|
||||
/// <returns>Filled object on success, null on error</returns>
|
||||
T? Deserialize(string? path);
|
||||
T? DeserializeImpl(string? path);
|
||||
|
||||
/// <summary>
|
||||
/// Serialize a <typeparamref name="T"/> into a file
|
||||
|
||||
Reference in New Issue
Block a user