@@ -303,7 +303,7 @@ private ProtectionDictionary GetInternalProtections(string fileName, Stream stre
303303 #region Non-Archive File Types
304304
305305 // Create a detectable for the given file type
306- var detectable = Factory . CreateDetectable ( fileType , wrapper ) ;
306+ var detectable = CreateDetectable ( fileType , wrapper ) ;
307307
308308 // If we're scanning file contents
309309 if ( detectable != null && _scanContents )
@@ -433,5 +433,42 @@ private static List<string> PerformPathCheck(IPathCheck impl, string? path, List
433433 }
434434
435435 #endregion
436+
437+ #region Helpers
438+
439+ /// <summary>
440+ /// Create an instance of a detectable based on file type
441+ /// </summary>
442+ private static IDetectable ? CreateDetectable ( WrapperType fileType , IWrapper ? wrapper )
443+ {
444+ // Use the wrapper before the type
445+ switch ( wrapper )
446+ {
447+ case AACSMediaKeyBlock obj : return new FileType . AACSMediaKeyBlock ( obj ) ;
448+ case BDPlusSVM obj : return new FileType . BDPlusSVM ( obj ) ;
449+ // case CIA obj => new FileType.CIA(obj),
450+ case LinearExecutable obj : return new FileType . LinearExecutable ( obj ) ;
451+ case MSDOS obj : return new FileType . MSDOS ( obj ) ;
452+ // case N3DS obj: return new FileType.N3DS(obj);
453+ case NewExecutable obj : return new FileType . NewExecutable ( obj ) ;
454+ case PlayJAudioFile obj : return new FileType . PLJ ( obj ) ;
455+ case PortableExecutable obj : return new FileType . PortableExecutable ( obj ) ;
456+ }
457+
458+ // Fall back on the file type for types not implemented in Serialization
459+ return fileType switch
460+ {
461+ // WrapperType.CIA => new FileType.CIA(),
462+ WrapperType . LDSCRYPT => new FileType . LDSCRYPT ( ) ,
463+ // WrapperType.N3DS => new FileType.N3DS(),
464+ WrapperType . RealArcadeInstaller => new FileType . RealArcadeInstaller ( ) ,
465+ WrapperType . RealArcadeMezzanine => new FileType . RealArcadeMezzanine ( ) ,
466+ WrapperType . SFFS => new FileType . SFFS ( ) ,
467+ WrapperType . Textfile => new FileType . Textfile ( ) ,
468+ _ => null ,
469+ } ;
470+ }
471+
472+ #endregion
436473 }
437474}
0 commit comments