diff --git a/SabreTools.Serialization/Files/LinearExecutable.Deserializer.cs b/SabreTools.Serialization/Files/LinearExecutable.Deserializer.cs new file mode 100644 index 00000000..a5601d42 --- /dev/null +++ b/SabreTools.Serialization/Files/LinearExecutable.Deserializer.cs @@ -0,0 +1,16 @@ +using SabreTools.Serialization.Interfaces; + +namespace SabreTools.Serialization.Files +{ + public partial class LinearExecutable : IFileSerializer + { + /// + public Models.LinearExecutable.Executable? Deserialize(string? path) + { + using (var stream = PathProcessor.OpenStream(path)) + { + return new Streams.LinearExecutable().Deserialize(stream); + } + } + } +} \ No newline at end of file diff --git a/SabreTools.Serialization/Files/LinearExecutable.Serializer.cs b/SabreTools.Serialization/Files/LinearExecutable.Serializer.cs new file mode 100644 index 00000000..fb0ee581 --- /dev/null +++ b/SabreTools.Serialization/Files/LinearExecutable.Serializer.cs @@ -0,0 +1,22 @@ +using SabreTools.Serialization.Interfaces; + +namespace SabreTools.Serialization.Files +{ + public partial class LinearExecutable : IFileSerializer + { + /// + public bool Serialize(Models.LinearExecutable.Executable? obj, string? path) + { + if (string.IsNullOrEmpty(path)) + return false; + + using var stream = new Streams.LinearExecutable().Serialize(obj); + if (stream == null) + return false; + + using var fs = System.IO.File.OpenWrite(path); + stream.CopyTo(fs); + return true; + } + } +} \ No newline at end of file diff --git a/SabreTools.Serialization/Files/MSDOS.Deserializer.cs b/SabreTools.Serialization/Files/MSDOS.Deserializer.cs new file mode 100644 index 00000000..614a7b69 --- /dev/null +++ b/SabreTools.Serialization/Files/MSDOS.Deserializer.cs @@ -0,0 +1,16 @@ +using SabreTools.Serialization.Interfaces; + +namespace SabreTools.Serialization.Files +{ + public partial class MSDOS : IFileSerializer + { + /// + public Models.MSDOS.Executable? Deserialize(string? path) + { + using (var stream = PathProcessor.OpenStream(path)) + { + return new Streams.MSDOS().Deserialize(stream); + } + } + } +} \ No newline at end of file diff --git a/SabreTools.Serialization/Files/MSDOS.Serializer.cs b/SabreTools.Serialization/Files/MSDOS.Serializer.cs new file mode 100644 index 00000000..699dda5e --- /dev/null +++ b/SabreTools.Serialization/Files/MSDOS.Serializer.cs @@ -0,0 +1,22 @@ +using SabreTools.Serialization.Interfaces; + +namespace SabreTools.Serialization.Files +{ + public partial class MSDOS : IFileSerializer + { + /// + public bool Serialize(Models.MSDOS.Executable? obj, string? path) + { + if (string.IsNullOrEmpty(path)) + return false; + + using var stream = new Streams.MSDOS().Serialize(obj); + if (stream == null) + return false; + + using var fs = System.IO.File.OpenWrite(path); + stream.CopyTo(fs); + return true; + } + } +} \ No newline at end of file diff --git a/SabreTools.Serialization/Files/NewExecutable.Deserializer.cs b/SabreTools.Serialization/Files/NewExecutable.Deserializer.cs new file mode 100644 index 00000000..e8561f9f --- /dev/null +++ b/SabreTools.Serialization/Files/NewExecutable.Deserializer.cs @@ -0,0 +1,16 @@ +using SabreTools.Serialization.Interfaces; + +namespace SabreTools.Serialization.Files +{ + public partial class NewExecutable : IFileSerializer + { + /// + public Models.NewExecutable.Executable? Deserialize(string? path) + { + using (var stream = PathProcessor.OpenStream(path)) + { + return new Streams.NewExecutable().Deserialize(stream); + } + } + } +} \ No newline at end of file diff --git a/SabreTools.Serialization/Files/NewExecutable.Serializer.cs b/SabreTools.Serialization/Files/NewExecutable.Serializer.cs new file mode 100644 index 00000000..a8727245 --- /dev/null +++ b/SabreTools.Serialization/Files/NewExecutable.Serializer.cs @@ -0,0 +1,22 @@ +using SabreTools.Serialization.Interfaces; + +namespace SabreTools.Serialization.Files +{ + public partial class NewExecutable : IFileSerializer + { + /// + public bool Serialize(Models.NewExecutable.Executable? obj, string? path) + { + if (string.IsNullOrEmpty(path)) + return false; + + using var stream = new Streams.NewExecutable().Serialize(obj); + if (stream == null) + return false; + + using var fs = System.IO.File.OpenWrite(path); + stream.CopyTo(fs); + return true; + } + } +} \ No newline at end of file diff --git a/SabreTools.Serialization/Files/PortableExecutable.Deserializer.cs b/SabreTools.Serialization/Files/PortableExecutable.Deserializer.cs new file mode 100644 index 00000000..ba3b2e41 --- /dev/null +++ b/SabreTools.Serialization/Files/PortableExecutable.Deserializer.cs @@ -0,0 +1,16 @@ +using SabreTools.Serialization.Interfaces; + +namespace SabreTools.Serialization.Files +{ + public partial class PortableExecutable : IFileSerializer + { + /// + public Models.PortableExecutable.Executable? Deserialize(string? path) + { + using (var stream = PathProcessor.OpenStream(path)) + { + return new Streams.PortableExecutable().Deserialize(stream); + } + } + } +} \ No newline at end of file diff --git a/SabreTools.Serialization/Files/PortableExecutable.Serializer.cs b/SabreTools.Serialization/Files/PortableExecutable.Serializer.cs new file mode 100644 index 00000000..26f6e42e --- /dev/null +++ b/SabreTools.Serialization/Files/PortableExecutable.Serializer.cs @@ -0,0 +1,22 @@ +using SabreTools.Serialization.Interfaces; + +namespace SabreTools.Serialization.Files +{ + public partial class PortableExecutable : IFileSerializer + { + /// + public bool Serialize(Models.PortableExecutable.Executable? obj, string? path) + { + if (string.IsNullOrEmpty(path)) + return false; + + using var stream = new Streams.PortableExecutable().Serialize(obj); + if (stream == null) + return false; + + using var fs = System.IO.File.OpenWrite(path); + stream.CopyTo(fs); + return true; + } + } +} \ No newline at end of file