public BSARecord(BSAFile archive, string name, BSAFileInfo fileInfo, BSAHashRecord hash) { Archive = archive; Name = name; FileInfo = fileInfo; Hash = hash; }
/// <summary> /// Loops through all the archives defined in Morrowind.ini, and fetches record handles to any /// files that exist in them. If the BSA was modified before the normal file, the BSA takes /// priority. /// </summary> /// <exception cref="Exception"></exception> private void MapArchiveFiles() { ArgumentNullException.ThrowIfNull(DataFiles); foreach (var archive in Archives) { var archiveFile = GetDataFile(archive) as NormalDataFile ?? throw new Exception($"Archive '{archive}' could not be found."); var bsa = new BSAFile(archiveFile.FilePath); foreach (var contained in bsa.Files) { var existing = GetDataFile(contained.Name); if (existing is null || bsa.ModificationTime > existing.ModificationTime) { DataFiles[contained.Name.ToLower()] = new ArchiveDataFile(contained); } } ArchiveFiles[archive.ToLower()] = bsa; } }
public static FileValidation FromBSAFile(BSAFile file, ChecksumType asType = ChecksumType.Murmur128) { return(new FileValidation(file.GetContents(true), asType)); }