Add DS/3DS to supported file types

This commit is contained in:
Matt Nadareski
2023-01-07 14:47:36 -08:00
parent 761b418d21
commit af0623beea
3 changed files with 59 additions and 3 deletions

View File

@@ -80,11 +80,21 @@
/// </summary>
MSI,
/// <summary>
/// Nintendo 3DS cart image
/// </summary>
N3DS,
/// <summary>
/// Half-Life No Cache File
/// </summary>
NCF,
/// <summary>
/// Nintendo DS/DSi cart image
/// </summary>
Nitro,
/// <summary>
/// Half-Life Package File
/// </summary>

View File

@@ -151,6 +151,12 @@ namespace BurnOutSharp.Tools
#endregion
#region N3DS
// No magic checks for N3DS
#endregion
#region NCF
if (magic.StartsWith(new byte?[] { 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 }))
@@ -158,6 +164,12 @@ namespace BurnOutSharp.Tools
#endregion
#region Nitro
// No magic checks for Nitro
#endregion
#region PAK
if (magic.StartsWith(new byte?[] { 0x50, 0x41, 0x43, 0x4B }))
@@ -199,7 +211,7 @@ namespace BurnOutSharp.Tools
return SupportedFileType.Quantum;
#endregion
#region RAR
// RAR archive version 1.50 onwards
@@ -415,6 +427,18 @@ namespace BurnOutSharp.Tools
#endregion
#region N3DS
// 3DS cart image
if (extension.Equals("3ds", StringComparison.OrdinalIgnoreCase))
return SupportedFileType.N3DS;
// CIA package -- Not currently supported
// else if (extension.Equals(value: "cia", StringComparison.OrdinalIgnoreCase))
// return SupportedFileType.N3DS;
#endregion
#region NCF
if (extension.Equals("ncf", StringComparison.OrdinalIgnoreCase))
@@ -422,6 +446,26 @@ namespace BurnOutSharp.Tools
#endregion
#region Nitro
// DS cart image
if (extension.Equals("nds", StringComparison.OrdinalIgnoreCase))
return SupportedFileType.Nitro;
// DS development cart image
else if (extension.Equals("srl", StringComparison.OrdinalIgnoreCase))
return SupportedFileType.Nitro;
// DSi cart image
else if (extension.Equals("dsi", StringComparison.OrdinalIgnoreCase))
return SupportedFileType.Nitro;
// iQue DS cart image
else if (extension.Equals("ids", StringComparison.OrdinalIgnoreCase))
return SupportedFileType.Nitro;
#endregion
#region PAK
// No extensions registered for PAK
@@ -537,7 +581,7 @@ namespace BurnOutSharp.Tools
// return SupportedFileType.Quantum;
#endregion
#region RAR
if (extension.Equals("rar", StringComparison.OrdinalIgnoreCase))
@@ -714,7 +758,7 @@ namespace BurnOutSharp.Tools
return string.Empty;
}
}
/// <summary>
/// Get the internal version as reported by the resources
/// </summary>

View File

@@ -50,6 +50,8 @@ namespace Test
// Get the file type
SupportedFileType ft = BurnOutSharp.Tools.Utilities.GetFileType(magic);
if (ft == SupportedFileType.UNKNOWN)
ft = BurnOutSharp.Tools.Utilities.GetFileType(Path.GetExtension(file).TrimStart('.'));
// MS-DOS executable and decendents
if (ft == SupportedFileType.Executable)