Compare commits

...

11 Commits
1.4.2 ... 1.4.3

Author SHA1 Message Date
Matt Nadareski
fc5374108c Bump version 2024-04-02 16:15:29 -04:00
Matt Nadareski
15452ded52 Use new IO extension 2024-04-02 16:12:08 -04:00
Matt Nadareski
49c6c4412b Update SabreTools.IO 2024-04-02 16:10:58 -04:00
Matt Nadareski
cfc53f66a8 Fix cuesheet serialization 2024-04-02 15:30:43 -04:00
Matt Nadareski
ec1fb7247c Add file serializers for all stream variants 2024-04-02 14:28:30 -04:00
Matt Nadareski
54b1eef8ae Better handle version 3 CFB files, probably (fixes #3) 2024-04-02 12:54:54 -04:00
Matt Nadareski
f448314309 Add file serializer for CFB 2024-04-02 12:45:31 -04:00
Matt Nadareski
c4e8debb15 Detect invalid dialog item counts (fixes #5) 2024-04-02 12:35:14 -04:00
Matt Nadareski
822839c813 Add file serializers for executable types 2024-04-02 12:06:56 -04:00
Matt Nadareski
27d36a11ca Add skeleton test executable 2024-04-02 11:56:27 -04:00
Matt Nadareski
92d9ca932d Move library code to subfolder 2024-04-02 11:51:39 -04:00
309 changed files with 1173 additions and 156 deletions

View File

@@ -28,13 +28,13 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: 'Nuget Package'
path: 'bin/Release/*.nupkg'
path: 'SabreTools.Serialization/bin/Release/*.nupkg'
- name: Upload to rolling
uses: ncipollo/release-action@v1.14.0
with:
allowUpdates: True
artifacts: 'bin/Release/*.nupkg'
artifacts: 'SabreTools.Serialization/bin/Release/*.nupkg'
body: 'Last built commit: ${{ github.sha }}'
name: 'Rolling Release'
prerelease: True

View File

@@ -1,17 +0,0 @@
using SabreTools.Models.PIC;
using SabreTools.Serialization.Interfaces;
namespace SabreTools.Serialization.Files
{
public partial class PIC : IFileSerializer<DiscInformation>
{
/// <inheritdoc/>
public DiscInformation? Deserialize(string? path)
{
using (var stream = PathProcessor.OpenStream(path))
{
return new Streams.PIC().Deserialize(stream);
}
}
}
}

View File

@@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SabreTools.Serialization", "SabreTools.Serialization.csproj", "{5B688801-5F36-483E-B2E8-F219BA5923A2}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SabreTools.Serialization", "SabreTools.Serialization\SabreTools.Serialization.csproj", "{5B688801-5F36-483E-B2E8-F219BA5923A2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{F3DEE31A-4726-464C-A90C-C19D78F51898}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -18,5 +20,9 @@ Global
{5B688801-5F36-483E-B2E8-F219BA5923A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5B688801-5F36-483E-B2E8-F219BA5923A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5B688801-5F36-483E-B2E8-F219BA5923A2}.Release|Any CPU.Build.0 = Release|Any CPU
{F3DEE31A-4726-464C-A90C-C19D78F51898}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F3DEE31A-4726-464C-A90C-C19D78F51898}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F3DEE31A-4726-464C-A90C-C19D78F51898}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F3DEE31A-4726-464C-A90C-C19D78F51898}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@@ -561,6 +561,10 @@ namespace SabreTools.Serialization
}
dialogItemExtendedTemplates.Add(dialogItemTemplate);
// If we have an invalid item count
if (offset >= entry.Data.Length)
break;
}
dialogBoxResource.ExtendedDialogItemTemplates = [.. dialogItemExtendedTemplates];
@@ -805,6 +809,10 @@ namespace SabreTools.Serialization
}
dialogItemTemplates.Add(dialogItemTemplate);
// If we have an invalid item count
if (offset >= entry.Data.Length)
break;
}
dialogBoxResource.DialogItemTemplates = [.. dialogItemTemplates];

View File

@@ -0,0 +1,14 @@
using SabreTools.Serialization.Interfaces;
namespace SabreTools.Serialization.Files
{
public partial class AACS : IFileSerializer<Models.AACS.MediaKeyBlock>
{
/// <inheritdoc/>
public Models.AACS.MediaKeyBlock? Deserialize(string? path)
{
using var stream = PathProcessor.OpenStream(path);
return new Streams.AACS().Deserialize(stream);
}
}
}

View File

@@ -0,0 +1,22 @@
using SabreTools.Serialization.Interfaces;
namespace SabreTools.Serialization.Files
{
public partial class AACS : IFileSerializer<Models.AACS.MediaKeyBlock>
{
/// <inheritdoc/>
public bool Serialize(Models.AACS.MediaKeyBlock? obj, string? path)
{
if (string.IsNullOrEmpty(path))
return false;
using var stream = new Streams.AACS().Serialize(obj);
if (stream == null)
return false;
using var fs = System.IO.File.OpenWrite(path);
stream.CopyTo(fs);
return true;
}
}
}

View File

@@ -8,10 +8,8 @@ namespace SabreTools.Serialization.Files
/// <inheritdoc/>
public MetadataFile? Deserialize(string? path)
{
using (var stream = PathProcessor.OpenStream(path))
{
return new Streams.AttractMode().Deserialize(stream);
}
using var stream = PathProcessor.OpenStream(path);
return new Streams.AttractMode().Deserialize(stream);
}
}
}

View File

@@ -0,0 +1,14 @@
using SabreTools.Serialization.Interfaces;
namespace SabreTools.Serialization.Files
{
public partial class BDPlus : IFileSerializer<Models.BDPlus.SVM>
{
/// <inheritdoc/>
public Models.BDPlus.SVM? Deserialize(string? path)
{
using var stream = PathProcessor.OpenStream(path);
return new Streams.BDPlus().Deserialize(stream);
}
}
}

View File

@@ -0,0 +1,22 @@
using SabreTools.Serialization.Interfaces;
namespace SabreTools.Serialization.Files
{
public partial class BDPlus : IFileSerializer<Models.BDPlus.SVM>
{
/// <inheritdoc/>
public bool Serialize(Models.BDPlus.SVM? obj, string? path)
{
if (string.IsNullOrEmpty(path))
return false;
using var stream = new Streams.BDPlus().Serialize(obj);
if (stream == null)
return false;
using var fs = System.IO.File.OpenWrite(path);
stream.CopyTo(fs);
return true;
}
}
}

View File

@@ -0,0 +1,14 @@
using SabreTools.Serialization.Interfaces;
namespace SabreTools.Serialization.Files
{
public partial class BFPK : IFileSerializer<Models.BFPK.Archive>
{
/// <inheritdoc/>
public Models.BFPK.Archive? Deserialize(string? path)
{
using var stream = PathProcessor.OpenStream(path);
return new Streams.BFPK().Deserialize(stream);
}
}
}

View File

@@ -0,0 +1,22 @@
using SabreTools.Serialization.Interfaces;
namespace SabreTools.Serialization.Files
{
public partial class BFPK : IFileSerializer<Models.BFPK.Archive>
{
/// <inheritdoc/>
public bool Serialize(Models.BFPK.Archive? obj, string? path)
{
if (string.IsNullOrEmpty(path))
return false;
using var stream = new Streams.BFPK().Serialize(obj);
if (stream == null)
return false;
using var fs = System.IO.File.OpenWrite(path);
stream.CopyTo(fs);
return true;
}
}
}

View File

@@ -0,0 +1,14 @@
using SabreTools.Serialization.Interfaces;
namespace SabreTools.Serialization.Files
{
public partial class BSP : IFileSerializer<Models.BSP.File>
{
/// <inheritdoc/>
public Models.BSP.File? Deserialize(string? path)
{
using var stream = PathProcessor.OpenStream(path);
return new Streams.BSP().Deserialize(stream);
}
}
}

View File

@@ -0,0 +1,22 @@
using SabreTools.Serialization.Interfaces;
namespace SabreTools.Serialization.Files
{
public partial class BSP : IFileSerializer<Models.BSP.File>
{
/// <inheritdoc/>
public bool Serialize(Models.BSP.File? obj, string? path)
{
if (string.IsNullOrEmpty(path))
return false;
using var stream = new Streams.BSP().Serialize(obj);
if (stream == null)
return false;
using var fs = System.IO.File.OpenWrite(path);
stream.CopyTo(fs);
return true;
}
}
}

View File

@@ -0,0 +1,14 @@
using SabreTools.Serialization.Interfaces;
namespace SabreTools.Serialization.Files
{
public partial class CFB : IFileSerializer<Models.CFB.Binary>
{
/// <inheritdoc/>
public Models.CFB.Binary? Deserialize(string? path)
{
using var stream = PathProcessor.OpenStream(path);
return new Streams.CFB().Deserialize(stream);
}
}
}

View File

@@ -0,0 +1,22 @@
using SabreTools.Serialization.Interfaces;
namespace SabreTools.Serialization.Files
{
public partial class CFB : IFileSerializer<Models.CFB.Binary>
{
/// <inheritdoc/>
public bool Serialize(Models.CFB.Binary? obj, string? path)
{
if (string.IsNullOrEmpty(path))
return false;
using var stream = new Streams.CFB().Serialize(obj);
if (stream == null)
return false;
using var fs = System.IO.File.OpenWrite(path);
stream.CopyTo(fs);
return true;
}
}
}

View File

@@ -0,0 +1,14 @@
using SabreTools.Serialization.Interfaces;
namespace SabreTools.Serialization.Files
{
public partial class CIA : IFileSerializer<Models.N3DS.CIA>
{
/// <inheritdoc/>
public Models.N3DS.CIA? Deserialize(string? path)
{
using var stream = PathProcessor.OpenStream(path);
return new Streams.CIA().Deserialize(stream);
}
}
}

View File

@@ -0,0 +1,22 @@
using SabreTools.Serialization.Interfaces;
namespace SabreTools.Serialization.Files
{
public partial class CIA : IFileSerializer<Models.N3DS.CIA>
{
/// <inheritdoc/>
public bool Serialize(Models.N3DS.CIA? obj, string? path)
{
if (string.IsNullOrEmpty(path))
return false;
using var stream = new Streams.CIA().Serialize(obj);
if (stream == null)
return false;
using var fs = System.IO.File.OpenWrite(path);
stream.CopyTo(fs);
return true;
}
}
}

View File

@@ -11,10 +11,8 @@ namespace SabreTools.Serialization.Files
/// <inheritdoc/>
public MetadataFile? Deserialize(string? path, bool quotes)
{
using (var stream = PathProcessor.OpenStream(path))
{
return new Streams.ClrMamePro().Deserialize(stream, quotes);
}
using var stream = PathProcessor.OpenStream(path);
return new Streams.ClrMamePro().Deserialize(stream, quotes);
}
}
}

View File

@@ -0,0 +1,14 @@
using SabreTools.Serialization.Interfaces;
namespace SabreTools.Serialization.Files
{
public partial class CueSheet : IFileSerializer<Models.CueSheets.CueSheet>
{
/// <inheritdoc/>
public Models.CueSheets.CueSheet? Deserialize(string? path)
{
using var stream = PathProcessor.OpenStream(path);
return new Streams.CueSheet().Deserialize(stream);
}
}
}

View File

@@ -8,10 +8,8 @@ namespace SabreTools.Serialization.Files
/// <inheritdoc/>
public MetadataFile? Deserialize(string? path)
{
using (var stream = PathProcessor.OpenStream(path))
{
return new Streams.DosCenter().Deserialize(stream);
}
using var stream = PathProcessor.OpenStream(path);
return new Streams.DosCenter().Deserialize(stream);
}
}
}

View File

@@ -8,10 +8,8 @@ namespace SabreTools.Serialization.Files
/// <inheritdoc/>
public MetadataFile? Deserialize(string? path)
{
using (var stream = PathProcessor.OpenStream(path))
{
return new Streams.EverdriveSMDB().Deserialize(stream);
}
using var stream = PathProcessor.OpenStream(path);
return new Streams.EverdriveSMDB().Deserialize(stream);
}
}
}

View File

@@ -0,0 +1,14 @@
using SabreTools.Serialization.Interfaces;
namespace SabreTools.Serialization.Files
{
public partial class GCF : IFileSerializer<Models.GCF.File>
{
/// <inheritdoc/>
public Models.GCF.File? Deserialize(string? path)
{
using var stream = PathProcessor.OpenStream(path);
return new Streams.GCF().Deserialize(stream);
}
}
}

View File

@@ -0,0 +1,22 @@
using SabreTools.Serialization.Interfaces;
namespace SabreTools.Serialization.Files
{
public partial class GCF : IFileSerializer<Models.GCF.File>
{
/// <inheritdoc/>
public bool Serialize(Models.GCF.File? obj, string? path)
{
if (string.IsNullOrEmpty(path))
return false;
using var stream = new Streams.GCF().Serialize(obj);
if (stream == null)
return false;
using var fs = System.IO.File.OpenWrite(path);
stream.CopyTo(fs);
return true;
}
}
}

View File

@@ -10,10 +10,8 @@ namespace SabreTools.Serialization.Files
/// <inheritdoc/>
public Models.Hashfile.Hashfile? Deserialize(string? path, Hash hash)
{
using (var stream = PathProcessor.OpenStream(path))
{
return new Streams.Hashfile().Deserialize(stream, hash);
}
using var stream = PathProcessor.OpenStream(path);
return new Streams.Hashfile().Deserialize(stream, hash);
}
}
}

View File

@@ -7,10 +7,8 @@ namespace SabreTools.Serialization.Files
/// <inheritdoc/>
public Models.IRD.File? Deserialize(string? path)
{
using (var stream = PathProcessor.OpenStream(path))
{
return new Streams.IRD().Deserialize(stream);
}
using var stream = PathProcessor.OpenStream(path);
return new Streams.IRD().Deserialize(stream);
}
}
}

View File

@@ -0,0 +1,14 @@
using SabreTools.Serialization.Interfaces;
namespace SabreTools.Serialization.Files
{
public partial class InstallShieldCabinet : IFileSerializer<Models.InstallShieldCabinet.Cabinet>
{
/// <inheritdoc/>
public Models.InstallShieldCabinet.Cabinet? Deserialize(string? path)
{
using var stream = PathProcessor.OpenStream(path);
return new Streams.InstallShieldCabinet().Deserialize(stream);
}
}
}

View File

@@ -0,0 +1,22 @@
using SabreTools.Serialization.Interfaces;
namespace SabreTools.Serialization.Files
{
public partial class InstallShieldCabinet : IFileSerializer<Models.InstallShieldCabinet.Cabinet>
{
/// <inheritdoc/>
public bool Serialize(Models.InstallShieldCabinet.Cabinet? obj, string? path)
{
if (string.IsNullOrEmpty(path))
return false;
using var stream = new Streams.InstallShieldCabinet().Serialize(obj);
if (stream == null)
return false;
using var fs = System.IO.File.OpenWrite(path);
stream.CopyTo(fs);
return true;
}
}
}

View File

@@ -22,10 +22,8 @@ namespace SabreTools.Serialization.Files
/// <returns>Filled object on success, null on error</returns>
public T? Deserialize(string? path, Encoding encoding)
{
using (var data = PathProcessor.OpenStream(path))
{
return new Streams.JsonFile<T>().Deserialize(data, encoding);
}
using var data = PathProcessor.OpenStream(path);
return new Streams.JsonFile<T>().Deserialize(data, encoding);
}
}
}

Some files were not shown because too many files have changed in this diff Show More