mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
use HasExtension method instead of string.EndsWith.
This commit is contained in:
@@ -43,7 +43,7 @@ namespace GameRes.Formats.Silky
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
// enforce extension to avoid false positives
|
||||
if (!file.Name.EndsWith (".awf", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".awf"))
|
||||
return null;
|
||||
int count = file.View.ReadInt32 (0);
|
||||
if (!IsSaneCount (count))
|
||||
@@ -74,7 +74,7 @@ namespace GameRes.Formats.Silky
|
||||
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
if (entry.Name.EndsWith (".mp3", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (entry.Name.HasExtension (".mp3"))
|
||||
return base.OpenEntry (arc, entry);
|
||||
// prepend WAV header
|
||||
var header = new byte[0x2C];
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace GameRes.Formats.Silky
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".arc", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".arc"))
|
||||
return null;
|
||||
uint index_size = file.View.ReadUInt32 (0);
|
||||
if (index_size < 10 || index_size >= file.MaxOffset-4)
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace GameRes.Formats.Silky
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
if (entry.Size <= 8
|
||||
|| !entry.Name.EndsWith (".snc", StringComparison.InvariantCultureIgnoreCase)
|
||||
|| !entry.Name.HasExtension (".snc")
|
||||
|| !arc.File.View.AsciiEqual (entry.Offset, "CMP_"))
|
||||
return arc.File.CreateStream (entry.Offset, entry.Size);
|
||||
int unpacked_size = arc.File.View.ReadInt32 (entry.Offset+4);
|
||||
|
||||
Reference in New Issue
Block a user