Fast checking for file existance

This commit is contained in:
Paul Chote
2010-08-18 22:56:16 +12:00
parent 0c5fb4c6b0
commit 30ab5c33ea
4 changed files with 18 additions and 9 deletions

View File

@@ -18,6 +18,7 @@ namespace OpenRA.FileFormats
public interface IFolder
{
Stream GetContent(string filename);
bool Exists(string filename);
IEnumerable<uint> AllFileHashes();
}
@@ -143,6 +144,11 @@ namespace OpenRA.FileFormats
{
return index.Keys;
}
public bool Exists(string filename)
{
return index.ContainsKey(PackageEntry.HashFilename(filename));
}
}
[Flags]