/// <summary> /// Try to gather core file path strings from an archive index file. /// </summary> /// <param name="indexFilePath">Disk path to an .idx file</param> private void TryLoadIndexFileNames(string indexFilePath) { if (!File.Exists(indexFilePath)) { return; } var index = PackfileIndex.FromFile(indexFilePath); // TryAdd will skip over duplicate paths foreach (var entry in index.Entries) { _hashedCorePathToString.TryAdd(Packfile.GetHashForPath(entry.FilePath), entry.FilePath); } }
/// <summary> /// Forwarder for <see cref="PackfileReader.ExtractFile(string, Stream)"/> /// </summary> public void ExtractFile(string corePath, Stream stream) { ExtractFile(Packfile.GetHashForPath(corePath), stream); }
/// <summary> /// Forwarder for <see cref="Packfile.GetFileSize(string)"/> /// </summary> public uint GetFileSize(string corePath) { return(GetFileSize(Packfile.GetHashForPath(corePath))); }
/// <summary> /// Forwarder for <see cref="PackfileReader.ExtractFile(string, string, FileMode)"/> /// </summary> public void ExtractFile(string corePath, string destinationPath, FileMode mode = FileMode.CreateNew) { ExtractFile(Packfile.GetHashForPath(corePath), destinationPath, mode); }
/// <summary> /// Checks if a Decima-formatted path is present in the mounted archives. /// </summary> public bool HasFile(string corePath) { return(_corePathToArchiveIndex.ContainsKey(Packfile.GetHashForPath(corePath))); }