mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-23 19:34:15 +08:00
use Entry.ChangeType method.
This commit is contained in:
parent
ec9f615919
commit
f40102bef9
@ -156,19 +156,12 @@ namespace GameRes.Formats.Neko
|
||||
}
|
||||
uint signature = get_signature (entry);
|
||||
var res = AutoEntry.DetectFileType (signature);
|
||||
string ext = "";
|
||||
if (res != null)
|
||||
{
|
||||
ext = res.Extensions.FirstOrDefault();
|
||||
entry.Type = res.Type;
|
||||
}
|
||||
entry.ChangeType (res);
|
||||
else if (0x474E4D8A == signature)
|
||||
ext = "mng";
|
||||
entry.Name = Path.ChangeExtension (entry.Name, "mng");
|
||||
else if (entry.Name.StartsWith ("script/"))
|
||||
entry.Type = "script";
|
||||
|
||||
if (!string.IsNullOrEmpty (ext))
|
||||
entry.Name = Path.ChangeExtension (entry.Name, ext);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,12 +108,7 @@ namespace GameRes.Formats.DDSystem
|
||||
else
|
||||
res = AutoEntry.DetectFileType (signature);
|
||||
if (res != null)
|
||||
{
|
||||
entry.Type = res.Type;
|
||||
var ext = res.Extensions.FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty (ext))
|
||||
entry.Name = Path.ChangeExtension (entry.Name, ext);
|
||||
}
|
||||
entry.ChangeType (res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,12 +82,7 @@ namespace GameRes.Formats.Dogenzaka
|
||||
return null;
|
||||
var res = AutoEntry.DetectFileType (file.View.ReadUInt32 (entry.Offset));
|
||||
if (res != null)
|
||||
{
|
||||
entry.Type = res.Type;
|
||||
var ext = res.Extensions.FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty (ext))
|
||||
entry.Name = Path.ChangeExtension (entry.Name, ext);
|
||||
}
|
||||
entry.ChangeType (res);
|
||||
}
|
||||
return new ArcFile (file, this, dir);
|
||||
}
|
||||
|
@ -120,12 +120,7 @@ namespace GameRes.Formats.Patisserie
|
||||
{
|
||||
var res = AutoEntry.DetectFileType (signature);
|
||||
if (null != res)
|
||||
{
|
||||
entry.Type = res.Type;
|
||||
var ext = res.Extensions.FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty (ext))
|
||||
entry.Name = Path.ChangeExtension (entry.Name, ext);
|
||||
}
|
||||
entry.ChangeType (res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,22 +147,9 @@ namespace GameRes.Formats.Qlie
|
||||
static protected void DetectFileType (ArcView file, Entry entry)
|
||||
{
|
||||
uint signature = file.View.ReadUInt32 (entry.Offset);
|
||||
if (signature != 0)
|
||||
{
|
||||
string ext = null;
|
||||
if (0x4D42 == (signature & 0xFFFF))
|
||||
{
|
||||
ext = "bmp";
|
||||
}
|
||||
else
|
||||
{
|
||||
var res = FormatCatalog.Instance.LookupSignature (signature).FirstOrDefault();
|
||||
if (null != res)
|
||||
ext = res.Extensions.FirstOrDefault();
|
||||
}
|
||||
if (!string.IsNullOrEmpty (ext))
|
||||
entry.Name = Path.ChangeExtension (entry.Name, ext);
|
||||
}
|
||||
var res = AutoEntry.DetectFileType (signature);
|
||||
if (null != res)
|
||||
entry.ChangeType (res);
|
||||
}
|
||||
|
||||
static string GetTypeName (byte[] type_buf)
|
||||
|
@ -109,12 +109,7 @@ namespace GameRes.Formats.SHSystem
|
||||
else
|
||||
res = AutoEntry.DetectFileType (signature);
|
||||
if (res != null)
|
||||
{
|
||||
entry.Type = res.Type;
|
||||
var ext = res.Extensions.FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty (ext))
|
||||
entry.Name = Path.ChangeExtension (entry.Name, ext);
|
||||
}
|
||||
entry.ChangeType (res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -141,12 +141,7 @@ namespace GameRes.Formats.SuperNekoX
|
||||
else
|
||||
res = AutoEntry.DetectFileType (signature);
|
||||
if (null != res)
|
||||
{
|
||||
entry.Type = res.Type;
|
||||
var ext = res.Extensions.FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty (ext))
|
||||
entry.Name = Path.ChangeExtension (entry.Name, ext);
|
||||
}
|
||||
entry.ChangeType (res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -330,12 +330,7 @@ namespace GameRes.Formats.Valkyria
|
||||
else
|
||||
res = AutoEntry.DetectFileType (signature);
|
||||
if (res != null)
|
||||
{
|
||||
entry.Type = res.Type;
|
||||
var ext = res.Extensions.FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty (ext))
|
||||
entry.Name = Path.ChangeExtension (entry.Name, ext);
|
||||
}
|
||||
entry.ChangeType (res);
|
||||
else if (OdnOpener.Image32NameRe.IsMatch (entry.Name))
|
||||
entry.Type = "image";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user