mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-07-09 02:16:55 +00:00
29 lines
864 B
C#
29 lines
864 B
C#
using SabreTools.Serialization.Interfaces;
|
|
|
|
namespace SabreTools.Serialization.Files
|
|
{
|
|
public partial class IRD : IFileSerializer<Models.IRD.File>
|
|
{
|
|
/// <inheritdoc cref="IFileSerializer.Serialize(T?, string?)"/>
|
|
public static bool SerializeFile(Models.IRD.File? obj, string? path)
|
|
{
|
|
var serializer = new IRD();
|
|
return serializer.Serialize(obj, path);
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public bool Serialize(Models.IRD.File? obj, string? path)
|
|
{
|
|
if (string.IsNullOrEmpty(path))
|
|
return false;
|
|
|
|
using var stream = Streams.IRD.SerializeStream(obj);
|
|
if (stream == null)
|
|
return false;
|
|
|
|
using var fs = System.IO.File.OpenWrite(path);
|
|
stream.CopyTo(fs);
|
|
return true;
|
|
}
|
|
}
|
|
} |