mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-09-26 19:29:07 +00:00
Add PNG file type
This commit is contained in:
parent
b10f17a57c
commit
322c043a51
2 changed files with 5 additions and 2 deletions
|
@ -27,6 +27,7 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
|||
LbpFileType.Voice => true,
|
||||
LbpFileType.Plan => true,
|
||||
LbpFileType.Jpeg => true,
|
||||
LbpFileType.Png => true,
|
||||
#if DEBUG
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(file), $"Unhandled file type ({file.FileType}) in FileHelper.IsFileSafe()"),
|
||||
#else
|
||||
|
@ -66,10 +67,11 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
|||
{
|
||||
reader.BaseStream.Position = 0;
|
||||
|
||||
// Determine if file is JPEG
|
||||
// Determine if file is JPEG/PNG
|
||||
byte[] header = reader.ReadBytes(9);
|
||||
|
||||
if (header[0] == 0xFF && header[1] == 0xD8 && header[2] == 0xFF && header[3] == 0xE0) return LbpFileType.Jpeg;
|
||||
if (header[0] == 0x89 && header[1] == 0x50 && header[2] == 0x4E && header[3] == 0x47) return LbpFileType.Png;
|
||||
|
||||
return LbpFileType.Unknown; // Still unknown.
|
||||
}
|
||||
|
|
|
@ -9,7 +9,8 @@ namespace LBPUnion.ProjectLighthouse.Types.Files
|
|||
Plan, // PLN, uploaded with levels
|
||||
Voice, // VOP, voice data
|
||||
Painting, // PTG, paintings
|
||||
Jpeg, // JFIF / FIF, used in sticker switches
|
||||
Jpeg, // JFIF / FIF, used in sticker switches,
|
||||
Png, // used in LBP Vita
|
||||
Unknown,
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue