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 ///