mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-07-09 02:16:55 +00:00
30 lines
916 B
C#
30 lines
916 B
C#
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;
|
|
}
|
|
}
|
|
} |