public FolderRecordBuilder(BSABuilder bsa, string folderName, IEnumerable <FileEntry> files) { _files = files.OrderBy(f => f._hash); _name = folderName.ToLowerInvariant(); _bsa = bsa; // Folders don't have extensions, so let's make sure we cut it out _hash = _name.GetBSAHash(""); _fileCount = (uint)files.Count(); _nameBytes = folderName.ToBZString(); _recordSize = sizeof(ulong) + sizeof(uint) + sizeof(uint); }
public static async Task <BSABuilder> Create(long size) { var self = new BSABuilder { _fileId = Encoding.ASCII.GetBytes("BSA\0"), _offset = 0x24, _slab = await DiskSlabAllocator.Create(size) }; return(self); }
public FolderRecordBuilder(BSABuilder bsa, RelativePath folderName, IEnumerable <FileEntry> files) { _files = files.OrderBy(f => f._hash); Name = folderName; _bsa = bsa; // Folders don't have extensions, so let's make sure we cut it out _hash = Name.GetFolderBSAHash(); _fileCount = (uint)files.Count(); _nameBytes = folderName.ToBZString(_bsa.HeaderType); _recordSize = sizeof(ulong) + sizeof(uint) + sizeof(uint); }
public FileEntry(BSABuilder bsa, string path, Stream src, bool flipCompression) { _bsa = bsa; _path = path.ToLowerInvariant(); _name = System.IO.Path.GetFileName(_path); _hash = _name.GetBSAHash(); _nameBytes = _name.ToTermString(); _pathBytes = _path.ToTermString(); _flipCompression = flipCompression; var ms = new MemoryStream(); src.CopyTo(ms); _rawData = ms.ToArray(); _originalSize = _rawData.Length; if (Compressed) { CompressData(); } }
public static async Task <FileEntry> Create(BSABuilder bsa, RelativePath path, Stream src, bool flipCompression) { var entry = new FileEntry(); entry._bsa = bsa; entry._path = path; entry._name = (string)entry._path.FileName; entry._hash = entry._name.GetBSAHash(); entry._nameBytes = entry._name.ToTermString(bsa.HeaderType); entry._pathBytes = entry._path.ToTermString(bsa.HeaderType); entry._pathBSBytes = entry._path.ToBSString(); entry._flipCompression = flipCompression; entry._srcData = src; entry._originalSize = (int)entry._srcData.Length; if (entry.Compressed) { await entry.CompressData(); } return(entry); }
public override async Task <IBSABuilder> MakeBuilder(long size) { return(await BSABuilder.Create(this, size).ConfigureAwait(false)); }