mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 20:04:13 +08:00
use string.EndsWith() method instead of Path.GetExtension()
This commit is contained in:
parent
8640e34c27
commit
a2051e6752
@ -240,8 +240,7 @@ namespace GameRes.Formats
|
|||||||
int update_count = 0;
|
int update_count = 0;
|
||||||
foreach (var entry in list)
|
foreach (var entry in list)
|
||||||
{
|
{
|
||||||
string ext = Path.GetExtension (entry.Name).ToLower();
|
if (entry.Type != "image" && !entry.Name.EndsWith (".scr", StringComparison.InvariantCultureIgnoreCase))
|
||||||
if (entry.Type != "image" && ext != ".scr")
|
|
||||||
continue;
|
continue;
|
||||||
uint id;
|
uint id;
|
||||||
if (!uint.TryParse (Path.GetFileNameWithoutExtension (entry.Name), NumberStyles.HexNumber,
|
if (!uint.TryParse (Path.GetFileNameWithoutExtension (entry.Name), NumberStyles.HexNumber,
|
||||||
|
@ -89,7 +89,7 @@ namespace GameRes.Formats.AZSys
|
|||||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||||
{
|
{
|
||||||
if (entry.Size < 20
|
if (entry.Size < 20
|
||||||
|| ".asb" != Path.GetExtension (entry.Name).ToLowerInvariant()
|
|| !entry.Name.EndsWith (".asb", StringComparison.InvariantCultureIgnoreCase)
|
||||||
|| !arc.File.View.AsciiEqual (entry.Offset, "ASB\x1a"))
|
|| !arc.File.View.AsciiEqual (entry.Offset, "ASB\x1a"))
|
||||||
return arc.File.CreateStream (entry.Offset, entry.Size);
|
return arc.File.CreateStream (entry.Offset, entry.Size);
|
||||||
uint packed = arc.File.View.ReadUInt32 (entry.Offset+4);
|
uint packed = arc.File.View.ReadUInt32 (entry.Offset+4);
|
||||||
|
@ -76,7 +76,7 @@ namespace GameRes.Formats.Ffa
|
|||||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||||
{
|
{
|
||||||
var input = arc.File.CreateStream (entry.Offset, entry.Size);
|
var input = arc.File.CreateStream (entry.Offset, entry.Size);
|
||||||
if (entry.Size <= 8 || Path.GetExtension (entry.Name).ToLowerInvariant() != ".so4")
|
if (entry.Size <= 8 || !entry.Name.EndsWith (".so4", StringComparison.InvariantCultureIgnoreCase))
|
||||||
return input;
|
return input;
|
||||||
using (var header = new ArcView.Reader (input))
|
using (var header = new ArcView.Reader (input))
|
||||||
{
|
{
|
||||||
|
@ -296,8 +296,7 @@ namespace GameRes.Formats.ONScripter
|
|||||||
var header_entry = new NsaEntry { Name = entry.Name };
|
var header_entry = new NsaEntry { Name = entry.Name };
|
||||||
if (Compression.None != ons_options.CompressionType)
|
if (Compression.None != ons_options.CompressionType)
|
||||||
{
|
{
|
||||||
string ext = Path.GetExtension (entry.Name).ToLower();
|
if (entry.Name.EndsWith (".bmp", StringComparison.InvariantCultureIgnoreCase))
|
||||||
if (".bmp" == ext)
|
|
||||||
header_entry.CompressionType = ons_options.CompressionType;
|
header_entry.CompressionType = ons_options.CompressionType;
|
||||||
}
|
}
|
||||||
index_size += 13;
|
index_size += 13;
|
||||||
|
@ -76,7 +76,7 @@ namespace GameRes.Formats.Fs
|
|||||||
entry.Size = file.View.ReadUInt32 (cur_offset+0x88);
|
entry.Size = file.View.ReadUInt32 (cur_offset+0x88);
|
||||||
if (!entry.CheckPlacement (file.MaxOffset))
|
if (!entry.CheckPlacement (file.MaxOffset))
|
||||||
return null;
|
return null;
|
||||||
if (Path.GetExtension (name).Equals (".dsf", System.StringComparison.OrdinalIgnoreCase))
|
if (name.EndsWith (".dsf", System.StringComparison.InvariantCultureIgnoreCase))
|
||||||
entry.Type = "script";
|
entry.Type = "script";
|
||||||
dir.Add (entry);
|
dir.Add (entry);
|
||||||
cur_offset += 0x90;
|
cur_offset += 0x90;
|
||||||
|
@ -610,8 +610,7 @@ NextEntry:
|
|||||||
{
|
{
|
||||||
if ("image" == entry.Type || "archive" == entry.Type)
|
if ("image" == entry.Type || "archive" == entry.Type)
|
||||||
return false;
|
return false;
|
||||||
var ext = Path.GetExtension (entry.Name);
|
if (entry.Name.EndsWith (".ogg", StringComparison.InvariantCultureIgnoreCase))
|
||||||
if (!string.IsNullOrEmpty (ext) && ext.Equals (".ogg", StringComparison.OrdinalIgnoreCase))
|
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user