Files
SabreTools.Serialization/Files/RomCenter.Serializer.cs
2023-11-07 23:30:26 -05:00

27 lines
734 B
C#

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