mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 03:44:13 +08:00
(ResourceHeader.Read): create class on return.
This commit is contained in:
parent
0ef85a0c94
commit
47bc5b17b1
@ -45,17 +45,19 @@ namespace GameRes.Formats.BlackCyc
|
||||
|
||||
public static ResourceHeader Read (Stream file)
|
||||
{
|
||||
var header = new ResourceHeader { Bytes = new byte[0x40] };
|
||||
if (0x40 != file.Read (header.Bytes, 0, 0x40))
|
||||
var header = new byte[0x40];
|
||||
if (0x40 != file.Read (header, 0, 0x40))
|
||||
return null;
|
||||
|
||||
var header_string = Encoding.ASCII.GetString (header.Bytes, 0x30, 0x10);
|
||||
var header_string = Encoding.ASCII.GetString (header, 0x30, 0x10);
|
||||
var match = PackTypeRe.Match (header_string);
|
||||
if (!match.Success)
|
||||
return null;
|
||||
header.PackType = ushort.Parse (match.Groups[1].Value);
|
||||
header.AType = match.Groups[2].Value.Length > 0;
|
||||
return header;
|
||||
return new ResourceHeader {
|
||||
Bytes = header,
|
||||
PackType = ushort.Parse (match.Groups[1].Value),
|
||||
AType = match.Groups[2].Value.Length > 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user