From 2494b44647874f9cc9e7266703c84255c146af98 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sat, 11 Apr 2026 20:56:46 -0400 Subject: [PATCH] Start scaffolding disc image wrapper helper --- SabreTools.Wrappers/WrapperFactory.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/SabreTools.Wrappers/WrapperFactory.cs b/SabreTools.Wrappers/WrapperFactory.cs index 82e5358a..c45ed7dc 100644 --- a/SabreTools.Wrappers/WrapperFactory.cs +++ b/SabreTools.Wrappers/WrapperFactory.cs @@ -84,6 +84,30 @@ namespace SabreTools.Wrappers }; } + /// + /// Create an instance of a wrapper based on the disc image type + /// + /// Stream data to parse + /// IWrapper representing the disc image, null on error + /// TODO: Hook this up in place of ISO in CreateWrapper + public static IWrapper? CreateDiscImageWrapper(Stream? stream) + { + // If we have no stream + if (stream is null) + return null; + + // Cache the current offset + long initialOffset = stream.Position; + + // Try to get an ISO-9660 wrapper first + var wrapper = ISO9660.Create(stream); + if (wrapper is null || wrapper is not ISO9660 iso) + return null; + + // TODO: Fill in the rest + return wrapper; + } + /// /// Create an instance of a wrapper based on the executable type ///