supply filename to FileNotFoundException when possible.

This commit is contained in:
morkt 2016-10-24 19:57:58 +04:00
parent 3034d55d47
commit c97985e5d0
3 changed files with 8 additions and 4 deletions

View File

@ -300,7 +300,7 @@ namespace GameRes.Formats.Entis
{
var ref_info = ReadMetaData (ref_src) as EriMetaData;
if (null == ref_info)
throw new FileNotFoundException ("Referenced image not found");
throw new FileNotFoundException ("Referenced image not found", ref_file);
ref_info.FileName = ref_file;
var ref_reader = ReadImageData (ref_src, ref_info);
AddImageBuffer (meta, reader.Data, ref_info, ref_reader.Data);

View File

@ -109,6 +109,10 @@ namespace GameRes.Formats.KiriKiri
if (null != blended_image)
return blended_image;
}
catch (FileNotFoundException X)
{
Trace.WriteLine (string.Format ("{0}: {1}", X.Message, X.FileName), "[TlgFormat.Read]");
}
catch (Exception X)
{
Trace.WriteLine (X.Message, "[TlgFormat.Read]");

View File

@ -303,7 +303,7 @@ namespace GameRes
{
Entry entry = null;
if (!m_dir.TryGetValue (filename, out entry))
throw new FileNotFoundException();
throw new FileNotFoundException ("Unable to find the specified file.", filename);
return entry;
}
@ -373,7 +373,7 @@ namespace GameRes
var dir_name = filename + PathDelimiter;
if (m_dir.Keys.Any (n => n.StartsWith (dir_name)))
return new SubDirEntry (filename);
throw new FileNotFoundException();
throw new FileNotFoundException ("Unable to find the specified file.", filename);
}
static readonly Regex path_re = new Regex (@"\G[/\\]?([^/\\]+)([/\\])");
@ -678,7 +678,7 @@ namespace GameRes
{
var entry = m_vfs.Top.FindFile (desired[Count-1]);
if (entry is SubDirEntry)
throw new FileNotFoundException();
throw new FileNotFoundException ("Unable to find the specified file.", desired[Count-1]);
m_vfs.ChDir (entry);
}
m_vfs.Top.CurrentDirectory = desired.Last();