add some helpful overloads to HawkFile for working with known filenames, instead of just extension lists

This commit is contained in:
zeromus 2012-09-12 00:41:07 +00:00
parent 1e6a9415c1
commit 05f1608de5
1 changed files with 29 additions and 0 deletions

View File

@ -207,6 +207,35 @@ namespace BizHawk.MultiClient
return fn.Replace('\\', '/');
}
/// <summary>
/// binds the specified ArchiveItem which you should have gotten by interrogating an archive hawkfile
/// </summary>
public HawkFile BindArchiveMember(ArchiveItem item)
{
return BindArchiveMember(item.index);
}
/// <summary>
/// finds an ArchiveItem with the specified name (path) within the archive; returns null if it doesnt exist
/// </summary>
public ArchiveItem FindArchiveMember(string name)
{
foreach (var ai in ArchiveItems)
if (ai.name == name)
return ai;
return null;
}
/// <summary>
/// binds a path within the archive; returns null if that path didnt exist.
/// </summary>
public HawkFile BindArchiveMember(string name)
{
var ai = FindArchiveMember(name);
if (ai == null) return null;
else return BindArchiveMember(ai);
}
/// <summary>
/// binds the selected archive index
/// </summary>