(RctFormat.Read): use ImageMetaData.FileName to extract base file location.

This commit is contained in:
morkt 2015-08-14 20:04:16 +04:00
parent f355288e97
commit 58dec16f25
2 changed files with 6 additions and 3 deletions

View File

@ -121,7 +121,7 @@ namespace GameRes.Formats.Majiro
if (null == meta)
throw new ArgumentException ("RctFormat.Read should be supplied with RctMetaData", "info");
byte[] base_image = null;
if (meta.AddSize > 0 && OverlayFrames)
if (meta.FileName != null && meta.AddSize > 0 && OverlayFrames)
base_image = ReadBaseImage (file, meta);
file.Position = meta.DataOffset + meta.AddSize;
@ -169,6 +169,8 @@ namespace GameRes.Formats.Majiro
try
{
string name = Encodings.cp932.GetString (name_bin, 0, name_bin.Length-1);
string dir_name = Path.GetDirectoryName (meta.FileName);
name = Path.Combine (dir_name, name);
if (File.Exists (name))
{
using (var base_file = File.OpenRead (name))
@ -177,6 +179,7 @@ namespace GameRes.Formats.Majiro
if (null != base_info && 0 == base_info.AddSize
&& meta.Width == base_info.Width && meta.Height == base_info.Height)
{
base_info.FileName = name;
base_file.Position = base_info.DataOffset;
Stream input = base_file;
if (base_info.IsEncrypted)

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion ("1.1.9.92")]
[assembly: AssemblyFileVersion ("1.1.9.92")]
[assembly: AssemblyVersion ("1.1.9.93")]
[assembly: AssemblyFileVersion ("1.1.9.93")]