diff --git a/BurnOutSharp/Enums.cs b/BurnOutSharp/Enums.cs
index d8e0edeb..8731daf7 100644
--- a/BurnOutSharp/Enums.cs
+++ b/BurnOutSharp/Enums.cs
@@ -1,6 +1,9 @@
namespace BurnOutSharp
{
- public enum FileTypes
+ ///
+ /// Subset of file types that are supported by the library
+ ///
+ public enum SupportedFileType
{
///
/// Unknown or unsupported
diff --git a/BurnOutSharp/FileType/PLJ.cs b/BurnOutSharp/FileType/PLJ.cs
index 6be5de0c..e4236043 100644
--- a/BurnOutSharp/FileType/PLJ.cs
+++ b/BurnOutSharp/FileType/PLJ.cs
@@ -32,7 +32,7 @@ namespace BurnOutSharp.FileType
byte[] magic = new byte[16];
stream.Read(magic, 0, 16);
- if (Utilities.GetFileType(magic) == FileTypes.PLJ)
+ if (Utilities.GetFileType(magic) == SupportedFileType.PLJ)
{
Utilities.AppendToDictionary(protections, file, "PlayJ Audio File");
return protections;
diff --git a/BurnOutSharp/Scanner.cs b/BurnOutSharp/Scanner.cs
index db105db3..b367d845 100644
--- a/BurnOutSharp/Scanner.cs
+++ b/BurnOutSharp/Scanner.cs
@@ -310,12 +310,12 @@ namespace BurnOutSharp
}
// Get the file type either from magic number or extension
- FileTypes fileType = Utilities.GetFileType(magic);
- if (fileType == FileTypes.UNKNOWN)
+ SupportedFileType fileType = Utilities.GetFileType(magic);
+ if (fileType == SupportedFileType.UNKNOWN)
fileType = Utilities.GetFileType(extension);
// If we still got unknown, just return null
- if (fileType == FileTypes.UNKNOWN)
+ if (fileType == SupportedFileType.UNKNOWN)
return null;
// Create a scannable for the given file type
diff --git a/BurnOutSharp/Tools/Utilities.cs b/BurnOutSharp/Tools/Utilities.cs
index a8a007fe..a59eec63 100644
--- a/BurnOutSharp/Tools/Utilities.cs
+++ b/BurnOutSharp/Tools/Utilities.cs
@@ -185,23 +185,23 @@ namespace BurnOutSharp.Tools
/// Get the supported file type for a magic string
///
/// Recommend sending in 16 bytes to check
- public static FileTypes GetFileType(byte[] magic)
+ public static SupportedFileType GetFileType(byte[] magic)
{
// If we have an invalid magic byte array
if (magic == null || magic.Length == 0)
- return FileTypes.UNKNOWN;
+ return SupportedFileType.UNKNOWN;
#region BFPK
if (magic.StartsWith(new byte?[] { 0x42, 0x46, 0x50, 0x4b }))
- return FileTypes.BFPK;
+ return SupportedFileType.BFPK;
#endregion
#region BZip2
if (magic.StartsWith(new byte?[] { 0x42, 0x52, 0x68 }))
- return FileTypes.BZip2;
+ return SupportedFileType.BZip2;
#endregion
@@ -209,7 +209,7 @@ namespace BurnOutSharp.Tools
// DOS MZ executable file format (and descendants)
if (magic.StartsWith(new byte?[] { 0x4d, 0x5a }))
- return FileTypes.Executable;
+ return SupportedFileType.Executable;
/*
// None of the following are supported in scans yet
@@ -244,7 +244,7 @@ namespace BurnOutSharp.Tools
#region GZIP
if (magic.StartsWith(new byte?[] { 0x1f, 0x8b }))
- return FileTypes.GZIP;
+ return SupportedFileType.GZIP;
#endregion
@@ -257,35 +257,35 @@ namespace BurnOutSharp.Tools
#region InstallShieldArchiveV3
if (magic.StartsWith(new byte?[] { 0x13, 0x5D, 0x65, 0x8C }))
- return FileTypes.InstallShieldArchiveV3;
+ return SupportedFileType.InstallShieldArchiveV3;
#endregion
#region InstallShieldCAB
if (magic.StartsWith(new byte?[] { 0x49, 0x53, 0x63 }))
- return FileTypes.InstallShieldCAB;
+ return SupportedFileType.InstallShieldCAB;
#endregion
#region MicrosoftCAB
if (magic.StartsWith(new byte?[] { 0x4d, 0x53, 0x43, 0x46 }))
- return FileTypes.MicrosoftCAB;
+ return SupportedFileType.MicrosoftCAB;
#endregion
#region MPQ
if (magic.StartsWith(new byte?[] { 0x4d, 0x50, 0x51, 0x1a }))
- return FileTypes.MPQ;
+ return SupportedFileType.MPQ;
#endregion
#region MSI
if (magic.StartsWith(new byte?[] { 0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1 }))
- return FileTypes.MSI;
+ return SupportedFileType.MSI;
#endregion
@@ -293,19 +293,19 @@ namespace BurnOutSharp.Tools
// PKZIP (Unknown)
if (magic.StartsWith(new byte?[] { 0x50, 0x4b, 0x00, 0x00 }))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// PKZIP
if (magic.StartsWith(new byte?[] { 0x50, 0x4b, 0x03, 0x04 }))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// PKZIP (Empty Archive)
if (magic.StartsWith(new byte?[] { 0x50, 0x4b, 0x05, 0x06 }))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// PKZIP (Spanned Archive)
if (magic.StartsWith(new byte?[] { 0x50, 0x4b, 0x07, 0x08 }))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
#endregion
@@ -313,7 +313,7 @@ namespace BurnOutSharp.Tools
// https://www.iana.org/assignments/media-types/audio/vnd.everad.plj
if (magic.StartsWith(new byte?[] { 0xFF, 0x9D, 0x53, 0x4B }))
- return FileTypes.PLJ;
+ return SupportedFileType.PLJ;
#endregion
@@ -321,28 +321,28 @@ namespace BurnOutSharp.Tools
// RAR archive version 1.50 onwards
if (magic.StartsWith(new byte?[] { 0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00 }))
- return FileTypes.RAR;
+ return SupportedFileType.RAR;
// RAR archive version 5.0 onwards
if (magic.StartsWith(new byte?[] { 0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x01, 0x00 }))
- return FileTypes.RAR;
+ return SupportedFileType.RAR;
#endregion
#region SevenZip
if (magic.StartsWith(new byte?[] { 0x37, 0x7a, 0xbc, 0xaf, 0x27, 0x1c }))
- return FileTypes.SevenZip;
+ return SupportedFileType.SevenZip;
#endregion
#region TapeArchive
if (magic.StartsWith(new byte?[] { 0x75, 0x73, 0x74, 0x61, 0x72, 0x00, 0x30, 0x30 }))
- return FileTypes.TapeArchive;
+ return SupportedFileType.TapeArchive;
if (magic.StartsWith(new byte?[] { 0x75, 0x73, 0x74, 0x61, 0x72, 0x20, 0x20, 0x00 }))
- return FileTypes.TapeArchive;
+ return SupportedFileType.TapeArchive;
#endregion
@@ -352,57 +352,57 @@ namespace BurnOutSharp.Tools
// HTML
if (magic.StartsWith(new byte?[] { 0x3c, 0x68, 0x74, 0x6d, 0x6c }))
- return FileTypes.Textfile;
+ return SupportedFileType.Textfile;
// HTML and XML
if (magic.StartsWith(new byte?[] { 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45 }))
- return FileTypes.Textfile;
+ return SupportedFileType.Textfile;
// InstallShield Compiled Rules
if (magic.StartsWith(new byte?[] { 0x61, 0x4C, 0x75, 0x5A }))
- return FileTypes.Textfile;
+ return SupportedFileType.Textfile;
// Microsoft Office File (old)
if (magic.StartsWith(new byte?[] { 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1 }))
- return FileTypes.Textfile;
+ return SupportedFileType.Textfile;
// Rich Text File
if (magic.StartsWith(new byte?[] { 0x7b, 0x5c, 0x72, 0x74, 0x66, 0x31 }))
- return FileTypes.Textfile;
+ return SupportedFileType.Textfile;
// Windows Help File
if (magic.StartsWith(new byte?[] { 0x3F, 0x5F, 0x03, 0x00 }))
- return FileTypes.Textfile;
+ return SupportedFileType.Textfile;
#endregion
#region Valve
if (HLLib.Packages.Package.GetPackageType(magic) != HLLib.Packages.PackageType.HL_PACKAGE_NONE)
- return FileTypes.Valve;
+ return SupportedFileType.Valve;
#endregion
#region XZ
if (magic.StartsWith(new byte?[] { 0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00 }))
- return FileTypes.XZ;
+ return SupportedFileType.XZ;
#endregion
// We couldn't find a supported match
- return FileTypes.UNKNOWN;
+ return SupportedFileType.UNKNOWN;
}
///
/// Get the supported file type for an extension
///
/// This is less accurate than a magic string match
- public static FileTypes GetFileType(string extension)
+ public static SupportedFileType GetFileType(string extension)
{
// If we have an invalid extension
if (string.IsNullOrWhiteSpace(extension))
- return FileTypes.UNKNOWN;
+ return SupportedFileType.UNKNOWN;
// Normalize the extension
extension = extension.TrimStart('.').Trim();
@@ -416,7 +416,7 @@ namespace BurnOutSharp.Tools
#region BZip2
if (extension.Equals("bz2", StringComparison.OrdinalIgnoreCase))
- return FileTypes.BZip2;
+ return SupportedFileType.BZip2;
#endregion
@@ -424,32 +424,32 @@ namespace BurnOutSharp.Tools
// DOS MZ executable file format (and descendants)
if (extension.Equals("exe", StringComparison.OrdinalIgnoreCase))
- return FileTypes.Executable;
+ return SupportedFileType.Executable;
// DOS MZ library file format (and descendants)
if (extension.Equals("dll", StringComparison.OrdinalIgnoreCase))
- return FileTypes.Executable;
+ return SupportedFileType.Executable;
#endregion
#region GZIP
if (extension.Equals("gz", StringComparison.OrdinalIgnoreCase))
- return FileTypes.GZIP;
+ return SupportedFileType.GZIP;
#endregion
#region IniFile
if (extension.Equals("ini", StringComparison.OrdinalIgnoreCase))
- return FileTypes.IniFile;
+ return SupportedFileType.IniFile;
#endregion
#region InstallShieldArchiveV3
if (extension.Equals("z", StringComparison.OrdinalIgnoreCase))
- return FileTypes.InstallShieldArchiveV3;
+ return SupportedFileType.InstallShieldArchiveV3;
#endregion
@@ -470,14 +470,14 @@ namespace BurnOutSharp.Tools
#region MPQ
if (extension.Equals("mpq", StringComparison.OrdinalIgnoreCase))
- return FileTypes.MPQ;
+ return SupportedFileType.MPQ;
#endregion
#region MSI
if (extension.Equals("msi", StringComparison.OrdinalIgnoreCase))
- return FileTypes.MSI;
+ return SupportedFileType.MSI;
#endregion
@@ -485,87 +485,87 @@ namespace BurnOutSharp.Tools
// PKZIP
if (extension.Equals("zip", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// Android package
if (extension.Equals("apk", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// Java archive
if (extension.Equals("jar", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// Google Earth saved working session file
if (extension.Equals("kmz", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// KWord document
if (extension.Equals("kwd", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// Microsoft Office Open XML Format (OOXML) Document
if (extension.Equals("docx", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// Microsoft Office Open XML Format (OOXML) Presentation
if (extension.Equals("pptx", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// Microsoft Office Open XML Format (OOXML) Spreadsheet
if (extension.Equals("xlsx", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// OpenDocument text document
if (extension.Equals("odt", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// OpenDocument presentation
if (extension.Equals("odp", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// OpenDocument text document template
if (extension.Equals("ott", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// Microsoft Open XML paper specification file
if (extension.Equals("oxps", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// OpenOffice spreadsheet
if (extension.Equals("sxc", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// OpenOffice drawing
if (extension.Equals("sxd", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// OpenOffice presentation
if (extension.Equals("sxi", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// OpenOffice word processing
if (extension.Equals("sxw", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// StarOffice spreadsheet
if (extension.Equals("sxc", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// Windows Media compressed skin file
if (extension.Equals("wmz", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// Mozilla Browser Archive
if (extension.Equals("xpi", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// XML paper specification file
if (extension.Equals("xps", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
// eXact Packager Models
if (extension.Equals("xpt", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PKZIP;
+ return SupportedFileType.PKZIP;
#endregion
@@ -573,28 +573,28 @@ namespace BurnOutSharp.Tools
// https://www.iana.org/assignments/media-types/audio/vnd.everad.plj
if (extension.Equals("plj", StringComparison.OrdinalIgnoreCase))
- return FileTypes.PLJ;
+ return SupportedFileType.PLJ;
#endregion
#region RAR
if (extension.Equals("rar", StringComparison.OrdinalIgnoreCase))
- return FileTypes.RAR;
+ return SupportedFileType.RAR;
#endregion
#region SevenZip
if (extension.Equals("7z", StringComparison.OrdinalIgnoreCase))
- return FileTypes.SevenZip;
+ return SupportedFileType.SevenZip;
#endregion
#region TapeArchive
if (extension.Equals("tar", StringComparison.OrdinalIgnoreCase))
- return FileTypes.SevenZip;
+ return SupportedFileType.SevenZip;
#endregion
@@ -602,41 +602,41 @@ namespace BurnOutSharp.Tools
// "Description in Zip"
if (extension.Equals("diz", StringComparison.OrdinalIgnoreCase))
- return FileTypes.Textfile;
+ return SupportedFileType.Textfile;
// Generic textfile (no header)
if (extension.Equals("txt", StringComparison.OrdinalIgnoreCase))
- return FileTypes.Textfile;
+ return SupportedFileType.Textfile;
// HTML
if (extension.Equals("htm", StringComparison.OrdinalIgnoreCase))
- return FileTypes.Textfile;
+ return SupportedFileType.Textfile;
if (extension.Equals("html", StringComparison.OrdinalIgnoreCase))
- return FileTypes.Textfile;
+ return SupportedFileType.Textfile;
// InstallShield Script
if (extension.Equals("ins", StringComparison.OrdinalIgnoreCase))
- return FileTypes.Textfile;
+ return SupportedFileType.Textfile;
// Microsoft Office File (old)
if (extension.Equals("doc", StringComparison.OrdinalIgnoreCase))
- return FileTypes.Textfile;
+ return SupportedFileType.Textfile;
// Rich Text File
if (extension.Equals("rtf", StringComparison.OrdinalIgnoreCase))
- return FileTypes.Textfile;
+ return SupportedFileType.Textfile;
// Setup information
if (extension.Equals("inf", StringComparison.OrdinalIgnoreCase))
- return FileTypes.Textfile;
+ return SupportedFileType.Textfile;
// Windows Help File
if (extension.Equals("hlp", StringComparison.OrdinalIgnoreCase))
- return FileTypes.Textfile;
+ return SupportedFileType.Textfile;
// XML
if (extension.Equals("xml", StringComparison.OrdinalIgnoreCase))
- return FileTypes.Textfile;
+ return SupportedFileType.Textfile;
#endregion
@@ -649,39 +649,39 @@ namespace BurnOutSharp.Tools
#region XZ
if (extension.Equals("xz", StringComparison.OrdinalIgnoreCase))
- return FileTypes.XZ;
+ return SupportedFileType.XZ;
#endregion
// We couldn't find a supported match
- return FileTypes.UNKNOWN;
+ return SupportedFileType.UNKNOWN;
}
///
/// Create an instance of a scannable based on file type
///
- public static IScannable CreateScannable(FileTypes fileType)
+ public static IScannable CreateScannable(SupportedFileType fileType)
{
switch (fileType)
{
- case FileTypes.BFPK: return new FileType.BFPK();
- case FileTypes.BZip2: return new FileType.BZip2();
- case FileTypes.Executable: return new FileType.Executable();
- case FileTypes.GZIP: return new FileType.GZIP();
+ case SupportedFileType.BFPK: return new FileType.BFPK();
+ case SupportedFileType.BZip2: return new FileType.BZip2();
+ case SupportedFileType.Executable: return new FileType.Executable();
+ case SupportedFileType.GZIP: return new FileType.GZIP();
//case FileTypes.IniFile: return new FileType.IniFile();
- case FileTypes.InstallShieldArchiveV3: return new FileType.InstallShieldArchiveV3();
- case FileTypes.InstallShieldCAB: return new FileType.InstallShieldCAB();
- case FileTypes.MicrosoftCAB: return new FileType.MicrosoftCAB();
- case FileTypes.MPQ: return new FileType.MPQ();
- case FileTypes.MSI: return new FileType.MSI();
- case FileTypes.PKZIP: return new FileType.PKZIP();
- case FileTypes.PLJ: return new FileType.PLJ();
- case FileTypes.RAR: return new FileType.RAR();
- case FileTypes.SevenZip: return new FileType.SevenZip();
- case FileTypes.TapeArchive: return new FileType.TapeArchive();
- case FileTypes.Textfile: return new FileType.Textfile();
- case FileTypes.Valve: return new FileType.Valve();
- case FileTypes.XZ: return new FileType.XZ();
+ case SupportedFileType.InstallShieldArchiveV3: return new FileType.InstallShieldArchiveV3();
+ case SupportedFileType.InstallShieldCAB: return new FileType.InstallShieldCAB();
+ case SupportedFileType.MicrosoftCAB: return new FileType.MicrosoftCAB();
+ case SupportedFileType.MPQ: return new FileType.MPQ();
+ case SupportedFileType.MSI: return new FileType.MSI();
+ case SupportedFileType.PKZIP: return new FileType.PKZIP();
+ case SupportedFileType.PLJ: return new FileType.PLJ();
+ case SupportedFileType.RAR: return new FileType.RAR();
+ case SupportedFileType.SevenZip: return new FileType.SevenZip();
+ case SupportedFileType.TapeArchive: return new FileType.TapeArchive();
+ case SupportedFileType.Textfile: return new FileType.Textfile();
+ case SupportedFileType.Valve: return new FileType.Valve();
+ case SupportedFileType.XZ: return new FileType.XZ();
default: return null;
}
}