mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-04-27 16:49:56 +00:00
26 lines
789 B
C#
26 lines
789 B
C#
using SabreTools.Models.SeparatedValue;
|
|
using SabreTools.Serialization.Interfaces;
|
|
|
|
namespace SabreTools.Serialization.Files
|
|
{
|
|
public partial class SeparatedValue : IFileSerializer<MetadataFile>
|
|
{
|
|
/// <inheritdoc/>
|
|
public bool Serialize(MetadataFile? obj, string? path) => Serialize(obj, path, ',');
|
|
|
|
/// <inheritdoc/>
|
|
public bool Serialize(MetadataFile? obj, string? path, char delim)
|
|
{
|
|
if (string.IsNullOrEmpty(path))
|
|
return false;
|
|
|
|
using var stream = new Streams.SeparatedValue().Serialize(obj, delim);
|
|
if (stream == null)
|
|
return false;
|
|
|
|
using var fs = System.IO.File.OpenWrite(path);
|
|
stream.CopyTo(fs);
|
|
return true;
|
|
}
|
|
}
|
|
} |