public IGameDataEntry GetEntry(string name) { var file = m_directory.GetFile(name); if (file != null) { if (file.Name.EndsWith(".rpf")) { var binaryFile = (IArchiveBinaryFile)file; return(new ArchiveDirectoryEntry(RageArchiveWrapper7.Open(binaryFile.GetStream(), binaryFile.Name).Root, binaryFile.Name)); } return(new ArchiveFileEntry(file)); } var directory = m_directory.GetDirectory(name); if (directory != null) { return(new ArchiveDirectoryEntry(directory)); } throw new FileNotFoundException(); }
/// <summary> /// Merges the contents of another directory with another. /// </summary> /// <param name="to">Destination directory.</param> /// <param name="from">Directory to merge data from.</param> public static void MergeWith(this IArchiveDirectory to, IArchiveDirectory from) { foreach (var item in from) { if (item is IArchiveDirectory dir) { var selfDir = to.GetDirectory(item.BuildPath(from.Parent)); if (selfDir == null) { to.Add(item, true); continue; } selfDir.MergeWith(dir); } else { to.Add(item, true); } } }
private void Handle(IArchiveDirectory root, RpfListBuilder.IDirectory innerD, string name) { var dir = root.GetDirectory(name); foreach (var c in innerD.Contents) ProcessContent(c, dir); }