mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-23 11:24:14 +08:00
use HasExtension method instead of string.EndsWith.
This commit is contained in:
parent
e0a5e95081
commit
31a01f2e5d
@ -109,7 +109,7 @@ namespace GameRes.Formats.AZSys
|
||||
if (entry.CheckPlacement (file.MaxOffset))
|
||||
{
|
||||
dir.Add (entry);
|
||||
contains_scripts = contains_scripts || name.EndsWith (".asb", StringComparison.InvariantCultureIgnoreCase);
|
||||
contains_scripts = contains_scripts || name.HasExtension (".asb");
|
||||
}
|
||||
}
|
||||
index_offset += 0x40;
|
||||
|
@ -72,7 +72,7 @@ namespace GameRes.Formats.Abel
|
||||
return null;
|
||||
var name = Binary.GetCString (name_buffer, 0, name_buffer.Length);
|
||||
var entry = FormatCatalog.Instance.Create<Entry> (name);
|
||||
if (name.EndsWith (".acd", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (name.HasExtension (".acd"))
|
||||
entry.Type = "script";
|
||||
entry.Offset = index.ReadUInt32() + base_offset;
|
||||
entry.Size = index.ReadUInt32();
|
||||
@ -86,10 +86,10 @@ namespace GameRes.Formats.Abel
|
||||
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
if (entry.Size > 12 && entry.Name.EndsWith (".cmp", StringComparison.InvariantCultureIgnoreCase)
|
||||
if (entry.Size > 12 && entry.Name.HasExtension (".cmp")
|
||||
&& arc.File.View.AsciiEqual (entry.Offset, "CMP\0"))
|
||||
return OpenCmpEntry (arc, entry);
|
||||
if (entry.Size > 8 && entry.Name.EndsWith (".acd", StringComparison.InvariantCultureIgnoreCase)
|
||||
if (entry.Size > 8 && entry.Name.HasExtension (".acd")
|
||||
&& arc.File.View.AsciiEqual (entry.Offset, "ACD\0"))
|
||||
return OpenAcdEntry (arc, entry);
|
||||
return base.OpenEntry (arc, entry);
|
||||
|
@ -115,7 +115,7 @@ namespace GameRes.Formats.Actgs
|
||||
var actarc = arc as ActressArchive;
|
||||
if (null == actarc || null == actarc.Key)
|
||||
return base.OpenEntry (arc, entry);
|
||||
if (entry.Name.EndsWith (".scr", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (entry.Name.HasExtension (".scr"))
|
||||
{
|
||||
if ('X' != arc.File.View.ReadByte (entry.Offset))
|
||||
return base.OpenEntry (arc, entry);
|
||||
|
@ -47,7 +47,7 @@ namespace GameRes.Formats.AdvSys
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".dat", StringComparison.InvariantCultureIgnoreCase)
|
||||
if (!file.Name.HasExtension (".dat")
|
||||
|| !Path.GetFileName (file.Name).StartsWith ("arc", StringComparison.InvariantCultureIgnoreCase))
|
||||
return null;
|
||||
long current_offset = 0;
|
||||
|
@ -237,7 +237,7 @@ namespace GameRes.Formats.Amaterasu
|
||||
int update_count = 0;
|
||||
foreach (var entry in list)
|
||||
{
|
||||
if (entry.Type != "image" && !entry.Name.EndsWith (".scr", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (entry.Type != "image" && !entry.Name.HasExtension (".scr"))
|
||||
continue;
|
||||
uint id;
|
||||
if (!uint.TryParse (Path.GetFileNameWithoutExtension (entry.Name), NumberStyles.HexNumber,
|
||||
|
@ -49,7 +49,7 @@ namespace GameRes.Formats.Ags
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".ani", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".ani"))
|
||||
return null;
|
||||
uint first_offset = file.View.ReadUInt32 (0);
|
||||
if (first_offset < 4 || file.MaxOffset > int.MaxValue || first_offset >= file.MaxOffset || 0 != (first_offset & 3))
|
||||
|
@ -148,8 +148,7 @@ namespace GameRes.Formats.Neko
|
||||
{
|
||||
foreach (var entry in dir.Where (e => string.IsNullOrEmpty (e.Type)))
|
||||
{
|
||||
if (entry.Name.EndsWith (".txt", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
entry.Name.EndsWith (".nut", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (entry.Name.HasAnyOfExtensions ("txt", "nut"))
|
||||
{
|
||||
entry.Type = "script";
|
||||
continue;
|
||||
|
@ -84,7 +84,7 @@ namespace GameRes.Formats.SPack
|
||||
};
|
||||
if (!entry.CheckPlacement (file.MaxOffset))
|
||||
return null;
|
||||
if (name.EndsWith (".dat", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (name.HasExtension (".dat"))
|
||||
entry.Type = "audio";
|
||||
else
|
||||
entry.Type = FormatCatalog.Instance.GetTypeFromName (name);
|
||||
|
@ -78,7 +78,7 @@ namespace GameRes.Formats.Banana // namespace is arbitrary, actual format source
|
||||
index_offset += 8;
|
||||
if (entry.Offset < index_offset || !entry.CheckPlacement (file.MaxOffset))
|
||||
return null;
|
||||
if (name.EndsWith (".scr", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (name.HasExtension (".scr"))
|
||||
entry.IsPacked = true;
|
||||
dir.Add (entry);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace GameRes.Formats.BlackCyc
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".gpk", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".gpk"))
|
||||
return null;
|
||||
var gtb_name = Path.ChangeExtension (file.Name, "gtb");
|
||||
if (!VFS.FileExists (gtb_name))
|
||||
|
@ -42,7 +42,7 @@ namespace GameRes.Formats.BlackCyc
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".vpk", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".vpk"))
|
||||
return null;
|
||||
var vtb_name = Path.ChangeExtension (file.Name, "vtb");
|
||||
if (!VFS.FileExists (vtb_name))
|
||||
|
@ -63,7 +63,7 @@ namespace GameRes.Formats.BlackRainbow
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".ads", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".ads"))
|
||||
return null;
|
||||
var arc_name = Path.GetFileNameWithoutExtension (file.Name);
|
||||
foreach (var key in KnownKeys.Values)
|
||||
|
@ -60,7 +60,7 @@ namespace GameRes.Formats.BlackRainbow
|
||||
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
if (!entry.Name.EndsWith (".hse", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!entry.Name.HasExtension (".hse"))
|
||||
return base.OpenEntry (arc, entry);
|
||||
var data = arc.File.View.ReadBytes (entry.Offset, entry.Size);
|
||||
for (int i = 0; i < data.Length; ++i)
|
||||
@ -114,7 +114,7 @@ namespace GameRes.Formats.BlackRainbow
|
||||
entry.Size = m_index.ReadUInt32();
|
||||
if (!entry.CheckPlacement (m_max_offset))
|
||||
return false;
|
||||
if (name.EndsWith (".hse", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (name.HasExtension (".hse"))
|
||||
entry.Type = "image";
|
||||
m_dir.Add (entry);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ namespace GameRes.Formats.BlueGale
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".snn", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".snn"))
|
||||
return null;
|
||||
var inx_name = Path.ChangeExtension (file.Name, "Inx");
|
||||
if (!VFS.FileExists (inx_name))
|
||||
|
@ -68,7 +68,7 @@ namespace GameRes.Formats.Cadath
|
||||
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
if (!entry.Name.EndsWith (".snr", System.StringComparison.InvariantCultureIgnoreCase)
|
||||
if (!entry.Name.HasExtension (".snr")
|
||||
|| !arc.File.View.AsciiEqual (entry.Offset, "SNR\x1A"))
|
||||
return base.OpenEntry (arc, entry);
|
||||
try
|
||||
|
@ -69,7 +69,7 @@ namespace GameRes.Formats.Cadath
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
var input = arc.File.CreateStream (entry.Offset, entry.Size);
|
||||
if (!entry.Name.EndsWith (".ns6", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!entry.Name.HasExtension (".ns6"))
|
||||
return input;
|
||||
byte key = (byte)(entry.Size / 7);
|
||||
return new XoredStream (input, key);
|
||||
|
@ -91,7 +91,7 @@ namespace GameRes.Formats.Circus
|
||||
entry.Size = LittleEndian.ToUInt32 (index, index_pos+8);
|
||||
if (!entry.CheckPlacement (file.MaxOffset))
|
||||
return null;
|
||||
if (name.EndsWith (".cps", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (name.HasExtension (".cps"))
|
||||
entry.Type = "image";
|
||||
dir.Add (entry);
|
||||
index_pos += 0x10;
|
||||
@ -108,12 +108,12 @@ namespace GameRes.Formats.Circus
|
||||
var data = vcarc.File.View.ReadBytes (entry.Offset, entry.Size);
|
||||
for (int i = 0; i < data.Length; ++i)
|
||||
data[i] ^= vcarc.Key;
|
||||
if (entry.Name.EndsWith (".cs", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (entry.Name.HasExtension (".cs"))
|
||||
{
|
||||
for (int i = 0; i < data.Length; ++i)
|
||||
--data[i];
|
||||
}
|
||||
else if (entry.Name.EndsWith (".cps", StringComparison.InvariantCultureIgnoreCase))
|
||||
else if (entry.Name.HasExtension (".cps"))
|
||||
{
|
||||
data = UnpackCps (data);
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ namespace GameRes.Formats.Pvns
|
||||
return base.OpenEntry (arc, entry);
|
||||
var data = arc.File.View.ReadBytes (entry.Offset, entry.Size);
|
||||
Decrypt (data, parc.ArcKey);
|
||||
if (entry.Name.EndsWith (".scr", StringComparison.InvariantCultureIgnoreCase)
|
||||
if (entry.Name.HasExtension (".scr")
|
||||
&& Binary.AsciiEqual (data, "PSRA") && data.Length > 20)
|
||||
{
|
||||
data = DecryptScript (data, parc.ScriptKey);
|
||||
|
@ -47,7 +47,7 @@ namespace GameRes.Formats.Cri
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".spc", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".spc"))
|
||||
return null;
|
||||
uint unpacked_size = file.View.ReadUInt32 (0);
|
||||
if (unpacked_size <= 0x20 || unpacked_size > 0x5000000)
|
||||
|
@ -54,9 +54,10 @@ namespace GameRes.Formats.Eagls
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (file.Name.HasExtension (".idx"))
|
||||
return null;
|
||||
string idx_name = Path.ChangeExtension (file.Name, ".idx");
|
||||
if (file.Name.Equals (idx_name, StringComparison.InvariantCultureIgnoreCase)
|
||||
|| !VFS.FileExists (idx_name))
|
||||
if (!VFS.FileExists (idx_name))
|
||||
return null;
|
||||
var idx_entry = VFS.FindFile (idx_name);
|
||||
if (idx_entry.Size > 0xfffff || idx_entry.Size < 10000)
|
||||
@ -81,7 +82,7 @@ namespace GameRes.Formats.Eagls
|
||||
var name = Binary.GetCString (index, index_offset, name_size);
|
||||
index_offset += name_size;
|
||||
var entry = FormatCatalog.Instance.Create<Entry> (name);
|
||||
if (name.EndsWith (".dat", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (name.HasExtension ("dat"))
|
||||
{
|
||||
entry.Type = "script";
|
||||
has_scripts = true;
|
||||
@ -104,7 +105,7 @@ namespace GameRes.Formats.Eagls
|
||||
}
|
||||
if (0 == dir.Count)
|
||||
return null;
|
||||
if (dir[0].Name.EndsWith (".gr", StringComparison.InvariantCultureIgnoreCase)) // CG archive
|
||||
if (dir[0].Name.HasExtension ("gr")) // CG archive
|
||||
{
|
||||
var rng = DetectEncryptionScheme (file, dir[0]);
|
||||
return new EaglsArchive (file, this, dir, new CgEncryption (rng));
|
||||
@ -121,9 +122,7 @@ namespace GameRes.Formats.Eagls
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
var earc = arc as EaglsArchive;
|
||||
if (null == earc
|
||||
|| !(entry.Name.EndsWith (".dat", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
entry.Name.EndsWith (".gr", StringComparison.InvariantCultureIgnoreCase)))
|
||||
if (null == earc || !entry.Name.HasAnyOfExtensions ("dat", "gr"))
|
||||
return arc.File.CreateStream (entry.Offset, entry.Size);
|
||||
|
||||
return earc.DecryptEntry (entry);
|
||||
|
@ -46,7 +46,7 @@ namespace GameRes.Formats.Entis
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".pac", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".pac"))
|
||||
return null;
|
||||
uint index_offset = 0;
|
||||
var name_buf = new byte[0x18];
|
||||
|
@ -79,8 +79,7 @@ namespace GameRes.Formats.Ffa
|
||||
var input = arc.File.CreateStream (entry.Offset, entry.Size);
|
||||
if (entry.Size <= 8)
|
||||
return input;
|
||||
if (!entry.Name.EndsWith (".so4", StringComparison.InvariantCultureIgnoreCase) &&
|
||||
!entry.Name.EndsWith (".so5", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!entry.Name.HasAnyOfExtensions ("so4", "so5"))
|
||||
return input;
|
||||
int packed = input.ReadInt32();
|
||||
int unpacked = input.ReadInt32();
|
||||
|
@ -76,7 +76,7 @@ namespace GameRes.Formats.Fs
|
||||
entry.Size = file.View.ReadUInt32 (cur_offset+0x88);
|
||||
if (!entry.CheckPlacement (file.MaxOffset))
|
||||
return null;
|
||||
if (name.EndsWith (".dsf", System.StringComparison.InvariantCultureIgnoreCase))
|
||||
if (name.HasExtension (".dsf"))
|
||||
entry.Type = "script";
|
||||
dir.Add (entry);
|
||||
cur_offset += 0x90;
|
||||
@ -305,8 +305,7 @@ namespace GameRes.Formats.Fs
|
||||
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
if (!entry.Name.EndsWith (".def", StringComparison.InvariantCultureIgnoreCase) &&
|
||||
!entry.Name.EndsWith (".dsf", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!entry.Name.HasAnyOfExtensions (".def", ".dsf"))
|
||||
return base.OpenEntry (arc, entry);
|
||||
var data = arc.File.View.ReadBytes (entry.Offset, entry.Size);
|
||||
for (int i = 0; i < data.Length; ++i)
|
||||
|
@ -44,7 +44,7 @@ namespace GameRes.Formats.GameSystem
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".CHR", StringComparison.InvariantCultureIgnoreCase)
|
||||
if (!file.Name.HasExtension (".CHR")
|
||||
|| file.View.ReadUInt32 (0) != file.MaxOffset)
|
||||
return null;
|
||||
using (var input = file.CreateStream())
|
||||
|
@ -72,10 +72,7 @@ namespace GameRes.Formats.GameSystem
|
||||
entry.UnpackedSize = index.ReadUInt32();
|
||||
if (!entry.CheckPlacement (file.MaxOffset))
|
||||
return null;
|
||||
if (entry.Name.EndsWith (".CRGB", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
entry.Name.EndsWith (".CHAR", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
entry.Name.EndsWith (".rol", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
entry.Name.EndsWith (".edg", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (entry.Name.HasAnyOfExtensions ("CRGB", "CHAR", "rol", "edg"))
|
||||
entry.Type = "image";
|
||||
entry.IsPacked = (flags & 0xFF0000) != 0;
|
||||
entry.StoredSize = (flags & 0x2000000) != 0;
|
||||
@ -146,20 +143,19 @@ namespace GameRes.Formats.GameSystem
|
||||
|
||||
public override IImageDecoder OpenImage (ArcFile arc, Entry entry)
|
||||
{
|
||||
if (entry.Name.EndsWith (".BGD", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
entry.Name.EndsWith (".CRGB", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (entry.Name.HasAnyOfExtensions (".BGD", ".CRGB"))
|
||||
{
|
||||
var input = OpenEntry (arc, entry);
|
||||
var info = new ImageMetaData { Width = 800, Height = 600, BPP = 24 };
|
||||
return new CgdReader (BinaryStream.FromStream (input, entry.Name), info);
|
||||
}
|
||||
else if (entry.Name.EndsWith (".edg", StringComparison.InvariantCultureIgnoreCase))
|
||||
else if (entry.Name.HasExtension (".edg"))
|
||||
{
|
||||
var input = OpenEntry (arc, entry);
|
||||
var info = new ImageMetaData { Width = 460, Height = 345, BPP = 24 };
|
||||
return new ImgReader (BinaryStream.FromStream (input, entry.Name), info);
|
||||
}
|
||||
else if (entry.Name.EndsWith (".rol", StringComparison.InvariantCultureIgnoreCase))
|
||||
else if (entry.Name.HasExtension (".rol"))
|
||||
{
|
||||
var input = OpenEntry (arc, entry);
|
||||
uint width = 202;
|
||||
@ -167,7 +163,7 @@ namespace GameRes.Formats.GameSystem
|
||||
var info = new ImageMetaData { Width = width, Height = height, BPP = 24 };
|
||||
return new ImgReader (BinaryStream.FromStream (input, entry.Name), info);
|
||||
}
|
||||
else if (entry.Name.EndsWith (".CHAR", StringComparison.InvariantCultureIgnoreCase))
|
||||
else if (entry.Name.HasExtension (".CHAR"))
|
||||
{
|
||||
var input = OpenEntry (arc, entry);
|
||||
var info = new ChrMetaData {
|
||||
|
@ -47,8 +47,8 @@ namespace GameRes.Formats.GameSystem
|
||||
|
||||
public override SoundInput TryOpen (IBinaryStream file)
|
||||
{
|
||||
bool is_adp4 = file.Name.EndsWith (".adp4", StringComparison.InvariantCultureIgnoreCase);
|
||||
bool is_adps = !is_adp4 && file.Name.EndsWith (".adps", StringComparison.InvariantCultureIgnoreCase);
|
||||
bool is_adp4 = file.Name.HasExtension (".adp4");
|
||||
bool is_adps = !is_adp4 && file.Name.HasExtension (".adps");
|
||||
if (!(is_adp4 || is_adps) || file.Length <= 4)
|
||||
return null;
|
||||
var decoder = new AdpDecoder (file);
|
||||
|
@ -39,7 +39,7 @@ namespace GameRes.Formats.GameSystem
|
||||
|
||||
public override ImageMetaData ReadMetaData (IBinaryStream file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".alp", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".alp"))
|
||||
return null;
|
||||
var header = file.ReadHeader (8);
|
||||
uint width = header.ToUInt32 (0);
|
||||
|
@ -39,7 +39,7 @@ namespace GameRes.Formats.GameSystem
|
||||
|
||||
public override ImageMetaData ReadMetaData (IBinaryStream file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".texb", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".texb"))
|
||||
return null;
|
||||
var header = file.ReadHeader (8);
|
||||
uint width = header.ToUInt32 (0);
|
||||
|
@ -46,7 +46,7 @@ namespace GameRes.Formats.Irrlicht
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".pack", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".pack"))
|
||||
return null;
|
||||
long offset = 0;
|
||||
var dir = new List<Entry>();
|
||||
|
@ -92,7 +92,7 @@ namespace GameRes.Formats.Ivory
|
||||
{
|
||||
var name = Binary.GetCString (cnam, entry.NameOffset);
|
||||
entry.Name = name;
|
||||
if (name.EndsWith (".px", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (name.HasExtension (".px"))
|
||||
entry.Type = "audio";
|
||||
else
|
||||
entry.Type = FormatCatalog.Instance.GetTypeFromName (name);
|
||||
|
@ -40,7 +40,7 @@ namespace GameRes.Formats.KAAS
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".pb", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".pb"))
|
||||
return null;
|
||||
int count = file.View.ReadInt32 (0);
|
||||
if (count <= 0 || count > 0xfff)
|
||||
|
@ -740,7 +740,7 @@ NextEntry:
|
||||
{
|
||||
if ("image" == entry.Type || "archive" == entry.Type)
|
||||
return false;
|
||||
if (entry.Name.EndsWith (".ogg", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (entry.Name.HasExtension (".ogg"))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ namespace GameRes.Formats.Kiss
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".arc", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".arc"))
|
||||
return null;
|
||||
int count = file.View.ReadInt32 (0);
|
||||
if (!IsSaneCount (count))
|
||||
|
@ -88,7 +88,7 @@ namespace GameRes.Formats.Lilim
|
||||
entry.Offset += current_offset;
|
||||
if (!entry.CheckPlacement (file.MaxOffset))
|
||||
return null;
|
||||
if (name.EndsWith (".scr", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (name.HasExtension (".scr"))
|
||||
entry.IsCompressed = true;
|
||||
dir.Add (entry);
|
||||
}
|
||||
@ -153,9 +153,9 @@ namespace GameRes.Formats.Lilim
|
||||
entry.Size = file.View.ReadUInt32 (index_offset+0x24);
|
||||
if (!entry.CheckPlacement (file.MaxOffset))
|
||||
return null;
|
||||
if (name.EndsWith (".scr", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (name.HasExtension (".scr"))
|
||||
entry.IsCompressed = true;
|
||||
else if (name.EndsWith (".cmp", StringComparison.InvariantCultureIgnoreCase))
|
||||
else if (name.HasExtension (".cmp"))
|
||||
{
|
||||
entry.IsCompressed = true;
|
||||
entry.Name = Path.ChangeExtension (entry.Name, ".abm");
|
||||
|
@ -60,13 +60,13 @@ namespace GameRes.Formats.LiveMaker
|
||||
// game.ext -- [optional] separate index (could be included into the main body)
|
||||
|
||||
uint signature = index_file.View.ReadUInt32 (0);
|
||||
if (file.Name.EndsWith (".exe", StringComparison.InvariantCultureIgnoreCase)
|
||||
if (file.Name.HasExtension (".exe")
|
||||
&& (0x5A4D == (signature & 0xFFFF))) // 'MZ'
|
||||
{
|
||||
base_offset = SkipExeData (index_file);
|
||||
signature = index_file.View.ReadUInt32 (base_offset);
|
||||
}
|
||||
else if (!file.Name.EndsWith (".dat", StringComparison.InvariantCultureIgnoreCase))
|
||||
else if (!file.Name.HasExtension (".dat"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -87,9 +87,7 @@ namespace GameRes.Formats.Mg
|
||||
entry.Size = file.View.ReadUInt32 (cur_offset+0x24);
|
||||
if (!entry.CheckPlacement (file.MaxOffset))
|
||||
return null;
|
||||
has_encrypted = has_encrypted
|
||||
|| name.EndsWith (".png", StringComparison.InvariantCultureIgnoreCase)
|
||||
|| name.EndsWith (".txt", StringComparison.InvariantCultureIgnoreCase);
|
||||
has_encrypted = has_encrypted || name.HasAnyOfExtensions ("png", "txt");
|
||||
dir.Add (entry);
|
||||
cur_offset += 0x30;
|
||||
}
|
||||
@ -113,7 +111,7 @@ namespace GameRes.Formats.Mg
|
||||
byte[] data = new byte[entry.Size];
|
||||
input.Read (data, 0, data.Length);
|
||||
data = DecryptBlock (data, mgarc.Key);
|
||||
if (entry.Name.EndsWith (".txt", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (entry.Name.HasExtension ("txt"))
|
||||
return DecompressStream (data);
|
||||
return new BinMemoryStream (data, entry.Name);
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ namespace GameRes.Formats.Mixwill
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
uint encrypted_size = entry.Size;
|
||||
if (!entry.Name.EndsWith (".txt", StringComparison.InvariantCultureIgnoreCase)
|
||||
if (!entry.Name.HasExtension (".txt")
|
||||
&& encrypted_size > 0x100)
|
||||
encrypted_size = 0x100;
|
||||
var prefix = arc.File.View.ReadBytes (entry.Offset, encrypted_size);
|
||||
|
@ -92,7 +92,7 @@ namespace GameRes.Formats.MoonhirGames
|
||||
entry.Size = file.View.ReadUInt32 (index_offset+8);
|
||||
if (!entry.CheckPlacement (file.MaxOffset))
|
||||
return null;
|
||||
if (name.EndsWith (".fbx", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (name.HasExtension (".fbx"))
|
||||
entry.Type = "image";
|
||||
has_encrypted = has_encrypted || entry.IsEncrypted;
|
||||
dir.Add (entry);
|
||||
|
@ -169,7 +169,7 @@ namespace GameRes.Formats.Musica
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".paz", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".paz"))
|
||||
return null;
|
||||
uint signature = file.View.ReadUInt32 (0);
|
||||
// XXX encryption is queried for every .paz file
|
||||
|
@ -68,7 +68,7 @@ namespace GameRes.Formats.NScripter
|
||||
}
|
||||
catch { /* ignore parse errors */ }
|
||||
}
|
||||
if (!file.Name.EndsWith (".ns2", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".ns2"))
|
||||
return null;
|
||||
|
||||
var password = QueryPassword();
|
||||
|
@ -105,7 +105,7 @@ namespace GameRes.Formats.NScripter
|
||||
}
|
||||
}
|
||||
catch { /* ignore parse errors */ }
|
||||
if (zero_signature || !file.Name.EndsWith (".nsa", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (zero_signature || !file.Name.HasExtension (".nsa"))
|
||||
return null;
|
||||
|
||||
var password = QueryPassword();
|
||||
@ -251,7 +251,7 @@ namespace GameRes.Formats.NScripter
|
||||
var header_entry = new NsaEntry { Name = entry.Name };
|
||||
if (Compression.None != ons_options.CompressionType)
|
||||
{
|
||||
if (entry.Name.EndsWith (".bmp", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (entry.Name.HasExtension (".bmp"))
|
||||
header_entry.CompressionType = ons_options.CompressionType;
|
||||
}
|
||||
index_size += 13;
|
||||
|
@ -83,7 +83,7 @@ namespace GameRes.Formats.NSystem
|
||||
entry.Offset = file.View.ReadInt64 (index_offset+8);
|
||||
if (!entry.CheckPlacement (file.MaxOffset))
|
||||
return null;
|
||||
has_scripts = has_scripts || name.EndsWith (".msd", StringComparison.InvariantCultureIgnoreCase);
|
||||
has_scripts = has_scripts || name.HasExtension (".msd");
|
||||
dir.Add (entry);
|
||||
index_offset += 0x10;
|
||||
}
|
||||
@ -100,7 +100,7 @@ namespace GameRes.Formats.NSystem
|
||||
{
|
||||
var msarc = arc as MsdArchive;
|
||||
if (null == msarc || string.IsNullOrEmpty (msarc.Key)
|
||||
|| !entry.Name.EndsWith (".msd", StringComparison.InvariantCultureIgnoreCase)
|
||||
|| !entry.Name.HasExtension (".msd")
|
||||
|| arc.File.View.AsciiEqual (entry.Offset, "MSCENARIO FILE "))
|
||||
return base.OpenEntry (arc, entry);
|
||||
var input = arc.File.CreateStream (entry.Offset, entry.Size);
|
||||
|
@ -82,7 +82,7 @@ namespace GameRes.Formats.Nags
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
var input = arc.File.CreateStream (entry.Offset, entry.Size);
|
||||
if (!entry.Name.EndsWith (".scb", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!entry.Name.HasExtension (".scb"))
|
||||
return input;
|
||||
return new InputCryptoStream (input, new NotTransform());
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ namespace GameRes.Formats.Nejii
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (file.MaxOffset < 0x30 || !file.Name.EndsWith (".pcd", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (file.MaxOffset < 0x30 || !file.Name.HasExtension (".pcd"))
|
||||
return null;
|
||||
// check if first entry looks like WAVEFORMAT
|
||||
ushort channels = file.View.ReadUInt16 (0x12);
|
||||
|
@ -87,7 +87,7 @@ namespace GameRes.Formats.NekoSDK
|
||||
entry.Size = file.View.ReadUInt32 (index_offset+4) ^ (uint)key;
|
||||
if (!entry.CheckPlacement (file.MaxOffset))
|
||||
return null;
|
||||
if (name.EndsWith (".alp", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (name.HasExtension (".alp"))
|
||||
entry.Type = "";
|
||||
dir.Add (entry);
|
||||
index_offset += 8;
|
||||
|
@ -101,7 +101,7 @@ namespace GameRes.Formats.NonColor
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".dat", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".dat"))
|
||||
return null;
|
||||
int count = file.View.ReadInt32 (0) ^ 0x26ACA46E;
|
||||
if (!IsSaneCount (count))
|
||||
|
@ -42,7 +42,7 @@ namespace GameRes.Formats.Propeller
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".mgr", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".mgr"))
|
||||
return null;
|
||||
int count = file.View.ReadInt16 (0);
|
||||
if (count <= 0 || count >= 0x100)
|
||||
|
@ -77,7 +77,7 @@ namespace GameRes.Formats.Propeller
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
var input = arc.File.CreateStream (entry.Offset, entry.Size);
|
||||
if (!entry.Name.EndsWith (".msc", StringComparison.InvariantCultureIgnoreCase)
|
||||
if (!entry.Name.HasExtension (".msc")
|
||||
|| 0x88 != input.PeekByte())
|
||||
return input;
|
||||
return new XoredStream (input, 0x88);
|
||||
|
@ -94,7 +94,7 @@ namespace GameRes.Formats.Rpm
|
||||
return null;
|
||||
var scheme = GuessScheme (file, count);
|
||||
// additional filename extension check avoids dialog popup on false positives
|
||||
if (null == scheme && KnownSchemes.Count > 0 && file.Name.EndsWith (".arc", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (null == scheme && KnownSchemes.Count > 0 && file.Name.HasExtension (".arc"))
|
||||
scheme = QueryScheme();
|
||||
if (null == scheme)
|
||||
return null;
|
||||
|
@ -68,7 +68,7 @@ namespace GameRes.Formats.RealLive
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".g00", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".g00"))
|
||||
return null;
|
||||
if (file.View.ReadByte (0) != 2)
|
||||
return null;
|
||||
|
@ -41,7 +41,7 @@ namespace GameRes.Formats.RealLive
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".ovk", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".ovk"))
|
||||
return null;
|
||||
int count = file.View.ReadInt32 (0);
|
||||
if (!IsSaneCount (count))
|
||||
|
@ -57,7 +57,7 @@ namespace GameRes.Formats.Riddle
|
||||
string name = file.View.ReadString (index_offset, 0x10);
|
||||
uint size = file.View.ReadUInt32 (index_offset+0x10);
|
||||
var entry = new PackedEntry { Name = name };
|
||||
if (name.EndsWith (".scp", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (name.HasExtension (".scp"))
|
||||
{
|
||||
entry.Type = "script";
|
||||
entry.IsPacked = size > 12 && file.View.AsciiEqual (index_offset+0x14, "CMP1");
|
||||
|
@ -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);
|
||||
|
@ -115,12 +115,11 @@ namespace GameRes.Formats.TopCat
|
||||
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
if (entry.Name.EndsWith (".OGG", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (entry.Name.HasExtension (".OGG"))
|
||||
return RestoreOggStream (arc, entry);
|
||||
if (entry.Name.EndsWith (".TSF", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
entry.Name.EndsWith (".TCT", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (entry.Name.HasAnyOfExtensions (".TSF", ".TCT"))
|
||||
return OpenScript (arc, entry);
|
||||
if (entry.Name.EndsWith (".SPD", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (entry.Name.HasExtension (".SPD"))
|
||||
return OpenSpdc (arc, entry);
|
||||
return base.OpenEntry (arc, entry);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ namespace GameRes.Formats.Triangle
|
||||
var name = file.View.ReadString (index_offset, entry_size-4);
|
||||
uint flags = next_offset >> 30;
|
||||
Entry entry;
|
||||
if (1 == flags || name.EndsWith (".iaf", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (1 == flags || name.HasExtension (".iaf"))
|
||||
entry = new Entry();
|
||||
else
|
||||
entry = new CgfEntry { Flags = flags };
|
||||
|
@ -46,7 +46,7 @@ namespace GameRes.Formats.Triangle
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".iaf", StringComparison.InvariantCultureIgnoreCase)
|
||||
if (!file.Name.HasExtension (".iaf")
|
||||
|| file.MaxOffset < 0x20)
|
||||
return null;
|
||||
uint size = file.View.ReadUInt32 (1);
|
||||
|
@ -83,8 +83,7 @@ namespace GameRes.Formats.UMeSoft
|
||||
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
if (!entry.Name.EndsWith (".scr", StringComparison.InvariantCultureIgnoreCase) &&
|
||||
!entry.Name.EndsWith (".tbl", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!entry.Name.HasAnyOfExtensions ("scr", "tbl"))
|
||||
return base.OpenEntry (arc, entry);
|
||||
int output_size = arc.File.View.ReadInt32 (entry.Offset);
|
||||
if (output_size <= 0)
|
||||
|
@ -65,7 +65,7 @@ namespace GameRes.Formats.Valkyria
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".odn", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".odn"))
|
||||
return null;
|
||||
var reader = new OdnIndexReader (file);
|
||||
var dir = reader.ReadIndex();
|
||||
|
@ -97,7 +97,7 @@ namespace GameRes.Formats.Will
|
||||
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
if (!entry.Name.EndsWith (".ws2", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!IsScriptFile (entry.Name))
|
||||
return base.OpenEntry (arc, entry);
|
||||
var data = arc.File.View.ReadBytes (entry.Offset, entry.Size);
|
||||
for (int i = 0; i < data.Length; ++i)
|
||||
@ -107,6 +107,11 @@ namespace GameRes.Formats.Will
|
||||
return new BinMemoryStream (data, entry.Name);
|
||||
}
|
||||
|
||||
static bool IsScriptFile (string name)
|
||||
{
|
||||
return name.HasAnyOfExtensions ("ws2", "json");
|
||||
}
|
||||
|
||||
public override void Create (Stream output, IEnumerable<Entry> list, ResourceOptions options,
|
||||
EntryCallback callback)
|
||||
{
|
||||
@ -132,7 +137,7 @@ namespace GameRes.Formats.Will
|
||||
var size = input.Length;
|
||||
if (size > uint.MaxValue || current_offset + size > uint.MaxValue)
|
||||
throw new FileSizeException();
|
||||
if (entry.Name.EndsWith (".ws2", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (IsScriptFile (entry.Name))
|
||||
CopyScript (input, output);
|
||||
else
|
||||
input.CopyTo (output);
|
||||
|
@ -275,8 +275,7 @@ namespace GameRes.Formats.Will
|
||||
|
||||
private static bool IsScriptFile (string filename)
|
||||
{
|
||||
return filename.EndsWith (".scr", StringComparison.InvariantCultureIgnoreCase)
|
||||
|| filename.EndsWith (".wsc", StringComparison.InvariantCultureIgnoreCase);
|
||||
return filename.HasAnyOfExtensions ("scr", "wsc");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ namespace GameRes.Formats.Will
|
||||
if (24 == meta.BPP)
|
||||
{
|
||||
byte[] raw = reader.Data;
|
||||
if (ApplyMask && !meta.FileName.EndsWith (".msk", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (ApplyMask && !meta.FileName.HasExtension (".msk"))
|
||||
{
|
||||
var mask_name = Path.ChangeExtension (meta.FileName, "msk");
|
||||
if (VFS.FileExists (mask_name))
|
||||
|
@ -42,7 +42,7 @@ namespace GameRes.Formats.Yatagarasu
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".pkg", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".pkg"))
|
||||
return null;
|
||||
uint key = file.View.ReadUInt32 (0x84); // last bytes of the first entry name
|
||||
if (key != file.View.ReadUInt32 (0x10C)) // keys of the first two entries supposed to be the same
|
||||
|
@ -42,7 +42,7 @@ namespace GameRes.Formats.Youkai
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".dat", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".dat"))
|
||||
return null;
|
||||
int count = file.View.ReadInt32 (0);
|
||||
if (!IsSaneCount (count) || 0 != file.View.ReadInt32 (4))
|
||||
@ -91,7 +91,7 @@ namespace GameRes.Formats.Youkai
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".dat", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".dat"))
|
||||
return null;
|
||||
int count = file.View.ReadInt32 (0);
|
||||
if (!IsSaneCount (count))
|
||||
@ -132,7 +132,7 @@ namespace GameRes.Formats.Youkai
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".dat", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".dat"))
|
||||
return null;
|
||||
uint data_offset = file.View.ReadUInt32 (0);
|
||||
int count = file.View.ReadInt32 (4);
|
||||
|
@ -143,7 +143,7 @@ namespace GameRes.Formats.YuRis
|
||||
input = new ZLibStream (input, CompressionMode.Decompress);
|
||||
uint unpacked_size = null == packed_entry ? entry.Size : packed_entry.UnpackedSize;
|
||||
if (null == ypf || 0 == ypf.ScriptKey || unpacked_size <= 0x20
|
||||
|| !entry.Name.EndsWith (".ybn", StringComparison.InvariantCultureIgnoreCase))
|
||||
|| !entry.Name.HasExtension (".ybn"))
|
||||
return input;
|
||||
using (input)
|
||||
{
|
||||
|
@ -90,7 +90,7 @@ namespace GameRes.Formats.Yuka
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
if (entry.Size < 0x24
|
||||
|| !entry.Name.EndsWith (".yks", StringComparison.InvariantCultureIgnoreCase)
|
||||
|| !entry.Name.HasExtension (".yks")
|
||||
|| !arc.File.View.AsciiEqual (entry.Offset, "YKS001")
|
||||
|| 1 != arc.File.View.ReadUInt16 (entry.Offset+6))
|
||||
return base.OpenEntry (arc, entry);
|
||||
|
@ -94,8 +94,7 @@ namespace GameRes.Formats.Elf
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
var input = arc.File.CreateStream (entry.Offset, entry.Size);
|
||||
if (entry.Name.EndsWith (".mes", StringComparison.InvariantCultureIgnoreCase)
|
||||
|| entry.Name.EndsWith (".lib", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (entry.Name.HasAnyOfExtensions ("mes", "lib"))
|
||||
return new LzssStream (input);
|
||||
return input;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ namespace GameRes.Formats.Elf
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".vol", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".vol"))
|
||||
return null;
|
||||
uint first_offset = file.View.ReadUInt32 (0);
|
||||
if (first_offset < 0x10 || 0 != (first_offset & 0xF) || first_offset >= file.MaxOffset)
|
||||
|
@ -115,7 +115,7 @@ namespace GameRes.Formats.Rugp
|
||||
if (CRioArchive.RioSignature == file.View.ReadUInt32 (0))
|
||||
return new RioReader (file);
|
||||
|
||||
if (file.Name.EndsWith (".ici", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (file.Name.HasExtension (".ici"))
|
||||
return null;
|
||||
var ici_name = file.Name + ".ici";
|
||||
if (!VFS.FileExists (ici_name))
|
||||
|
@ -42,7 +42,7 @@ namespace GameRes.Formats.uGOS
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.EndsWith (".det", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!file.Name.HasExtension (".det"))
|
||||
return null;
|
||||
var name_file = Path.ChangeExtension (file.Name, "nme");
|
||||
var index_file = Path.ChangeExtension (file.Name, "atm");
|
||||
|
@ -47,7 +47,7 @@ namespace GameRes.Formats.CellWorks
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (VFS.IsVirtual || !file.Name.EndsWith (".dat", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (VFS.IsVirtual || !file.Name.HasExtension (".dat"))
|
||||
return null;
|
||||
var db_files = VFS.GetFiles (VFS.CombinePath (VFS.GetDirectoryName (file.Name), "*.db"));
|
||||
if (!db_files.Any())
|
||||
|
Loading…
x
Reference in New Issue
Block a user