public override void SaveFileTo(ulong hash, string extractPath, string fullName)
{
EncodingEntry encInfo;
if (GetEncodingEntry(hash, out encInfo))
{
SaveFileTo(encInfo.Key, extractPath, fullName);
return;
}
if (RootHandler is OwRootHandler)
{
OWRootEntry entry;
if ((RootHandler as OwRootHandler).GetEntry(hash, out entry))
{
if ((entry.baseEntry.ContentFlags & ContentFlags.Bundle) != ContentFlags.None)
{
if (Encoding.GetEntry(entry.pkgIndex.bundleContentKey, out encInfo))
{
using (Stream bundle = OpenFile(encInfo.Key))
{
string fullPath = Path.Combine(extractPath, fullName);
string dir = Path.GetDirectoryName(fullPath);
if (!Directory.Exists(dir))
Directory.CreateDirectory(dir);
using (var fileStream = File.Open(fullPath, FileMode.Create))
{
bundle.Position = entry.pkgIndexRec.Offset;
bundle.CopyBytes(fileStream, entry.pkgIndexRec.Size);
}
}
return;
}
}
}
}
if (CASCConfig.ThrowOnFileNotFound)
throw new FileNotFoundException(fullName);
}