mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-04-29 01:50:13 +00:00
25 lines
745 B
C#
25 lines
745 B
C#
using System.IO;
|
|
using SabreTools.Models.BDPlus;
|
|
using SabreTools.Serialization.Interfaces;
|
|
|
|
namespace SabreTools.Serialization.Bytes
|
|
{
|
|
public partial class BDPlus : IByteSerializer<SVM>
|
|
{
|
|
/// <inheritdoc/>
|
|
public SVM? Deserialize(byte[]? data, int offset)
|
|
{
|
|
// If the data is invalid
|
|
if (data == null)
|
|
return null;
|
|
|
|
// If the offset is out of bounds
|
|
if (offset < 0 || offset >= data.Length)
|
|
return null;
|
|
|
|
// Create a memory stream and parse that
|
|
MemoryStream dataStream = new MemoryStream(data, offset, data.Length - offset);
|
|
return new Streams.BDPlus().Deserialize(dataStream);
|
|
}
|
|
}
|
|
} |