public void CloneArchiveTest() { PboArchive pboArchive = new PboArchive("testdata/cba_common.pbo"); Dictionary <FileEntry, string> files = new Dictionary <FileEntry, string>(); foreach (FileEntry entry in pboArchive.Files) { FileInfo info = new FileInfo(Path.Combine("testdata\\cba_common", entry.FileName)); Assert.That(info.Exists); files.Add(entry, info.FullName); } PboArchive.Clone("clone_common.pbo", pboArchive.ProductEntry, files, pboArchive.Checksum); PboArchive cloneArchive = new PboArchive("clone_common.pbo"); Assert.That(pboArchive.Checksum.SequenceEqual(cloneArchive.Checksum), "Checksum dosen't match"); Assert.That(pboArchive.Files.Count == cloneArchive.Files.Count, "Checksum dosen't match"); Assert.That(pboArchive.ProductEntry.Name == cloneArchive.ProductEntry.Name); Assert.That(pboArchive.ProductEntry.Prefix == cloneArchive.ProductEntry.Prefix); Assert.That(pboArchive.ProductEntry.Addtional.Count == cloneArchive.ProductEntry.Addtional.Count); }
public void CloneArchiveTest() { var pboArchive = new PboArchive("testdata/cba_common.pbo"); var files = new Dictionary<FileEntry, string>(); foreach (var entry in pboArchive.Files) { var info = new FileInfo(Path.Combine("testdata\\cba_common",entry.FileName)); Assert.That(info.Exists); files.Add(entry,info.FullName); } PboArchive.Clone("clone_common.pbo", pboArchive.ProductEntry, files, pboArchive.Checksum); var cloneArchive = new PboArchive("clone_common.pbo"); Assert.That(pboArchive.Checksum.SequenceEqual(cloneArchive.Checksum), "Checksum dosen't match"); Assert.That(pboArchive.Files.Count == cloneArchive.Files.Count, "Checksum dosen't match"); Assert.That(pboArchive.ProductEntry.Name == cloneArchive.ProductEntry.Name); Assert.That(pboArchive.ProductEntry.Prefix == cloneArchive.ProductEntry.Prefix); Assert.That(pboArchive.ProductEntry.Addtional.Count == cloneArchive.ProductEntry.Addtional.Count); }
public void OpenArchiveTest() { var pboArchive = new PboArchive("testdata/cba_common.pbo"); Assert.That(pboArchive.Files.Count == 113); Assert.That(pboArchive.Checksum.SequenceEqual(_checksum),"Checksum dosen't match"); Assert.That(pboArchive.ProductEntry.Name == "prefix"); Assert.That(pboArchive.ProductEntry.Prefix == @"x\cba\addons\common"); Assert.That(pboArchive.ProductEntry.Addtional.Count == 3); }
public void OpenArchiveTest() { PboArchive pboArchive = new PboArchive("testdata/cba_common.pbo"); Assert.That(pboArchive.Files.Count == 113); Assert.That(pboArchive.Checksum.SequenceEqual(_checksum), "Checksum dosen't match"); Assert.That(pboArchive.ProductEntry.Name == "prefix"); Assert.That(pboArchive.ProductEntry.Prefix == @"x\cba\addons\common"); Assert.That(pboArchive.ProductEntry.Addtional.Count == 3); }
public PboFSFile(string name, PboArchive archive, FileEntry file) : base() { Archive = archive; File = file; FileInformation = new DokanNet.FileInformation() { Attributes = System.IO.FileAttributes.Normal, FileName = name, Length = (long)file.DataSize, LastAccessTime = DateTime.Now, LastWriteTime = DateTime.Now, CreationTime = DateTime.Now, }; }
private void ReadPboFiles(string[] filePaths) { foreach (var filePath in filePaths) { var archive = new PboArchive(filePath); foreach (var file in archive.Files) { var wholeFilePath = ("\\" + archive.ProductEntry.Prefix + "\\" + file.FileName).ToLower(); FilePathToArchive[wholeFilePath] = archive; FilePathToFileEntry[wholeFilePath] = file; TotalBytes += (long)file.DataSize; } } }
public Stream ReadStream(string filePath) { PboArchive archive = null; if (FilePathToArchive.TryGetValue(filePath, out archive)) { FileEntry file = null; if (FilePathToFileEntry.TryGetValue(filePath, out file)) { return(archive.Extract(file)); } } return(null); }
public void CreateArchiveTest() { Assert.That(PboArchive.Create("testdata\\cba_common", "cba_common.pbo")); PboArchive pbo = new PboArchive("cba_common.pbo"); Assert.That(pbo.Files.Count == 113); // checksums shoulden't match due to the time. Assert.False(pbo.Checksum.SequenceEqual(_checksum), "Checksum match"); Assert.That(pbo.ProductEntry.Name == "prefix"); Assert.That(pbo.ProductEntry.Prefix == @"x\cba\addons\common"); Assert.That(pbo.ProductEntry.Addtional.Count == 1); // i don't add wonky shit like mikero. }
public void CreateArchiveTest() { Assert.That(PboArchive.Create("testdata\\cba_common","cba_common.pbo")); var pbo = new PboArchive("cba_common.pbo"); Assert.That(pbo.Files.Count == 113); // checksums shoulden't match due to the time. Assert.False(pbo.Checksum.SequenceEqual(_checksum), "Checksum match"); Assert.That(pbo.ProductEntry.Name == "prefix"); Assert.That(pbo.ProductEntry.Prefix == @"x\cba\addons\common"); Assert.That(pbo.ProductEntry.Addtional.Count == 1); // i don't add wonky shit like mikero. }
public static void Main(string[] args) { // ReSharper disable line StringLiteralTypo const string outFolder = "@rof_addons\\addons"; foreach (var directoryPath in Directory.GetDirectories(Directory.GetCurrentDirectory())) { var directory = Path.GetFileName(directoryPath); if (directory is null || directory.StartsWith(".") || directory.StartsWith("@")) { continue; } Console.WriteLine(directory); var outPath = Path.Combine(Directory.GetCurrentDirectory(), outFolder, directory + ".pbo"); PboArchive.Create(directoryPath, outPath); } Console.WriteLine("Done."); }
private void createFileTree() { this.root = new PboFSFolder(null); this.fileTreeLookup = new Dictionary <string, PboFSNode>(); this.fileTreeLookup["\\"] = this.root; foreach (string filePath in this.archiveManager.FilePathToArchive.Keys) { PboArchive archive = this.archiveManager.FilePathToArchive[filePath]; FileEntry file = this.archiveManager.FilePathToFileEntry[filePath]; PboFSFolder currentFolder = root; var currentPath = "\\"; var paths = filePath.Split('\\'); // Create folder for all sub paths for (int i = 1; i < paths.Length - 1; i++) { var folderName = paths[i]; currentPath += folderName; PboFSFolder folder = null; if (!this.fileTreeLookup.ContainsKey(currentPath)) { this.fileTreeLookup[currentPath] = new PboFSFolder(folderName); } folder = (PboFSFolder)this.fileTreeLookup[currentPath]; if (!currentFolder.Children.ContainsKey(folderName)) { currentFolder.Children[folderName] = folder; } currentFolder = (PboFSFolder)currentFolder.Children[folderName]; currentPath += "\\"; } var fileName = paths[paths.Length - 1]; var fileNode = new PboFSFile(fileName, archive, file); currentFolder.Children[fileName] = fileNode; this.fileTreeLookup[filePath] = fileNode; } }
private void ReadPboFiles(string[] filePaths) { foreach (var filePath in filePaths) { var archive = new PboArchive(filePath); foreach (var file in archive.Files) { var prefix = ""; if (!string.IsNullOrEmpty(archive.ProductEntry.Prefix)) { prefix = "\\" + archive.ProductEntry.Prefix; } var wholeFilePath = (prefix + "\\" + file.FileName).ToLower(); FilePathToFileEntry[wholeFilePath] = file; TotalBytes += (long)file.DataSize; } } }