public static ArchiveBlockDescriptor Create(uint magic, BinaryReader reader)
        {
            ArchiveBlockDescriptor ret = null;

            switch (magic)
            {
            case Signatures.ArchiveIndex:
                ret = new ArchiveIndex();
                ret.Populate(magic, reader);
                break;

            case Signatures.Pack:
                ret = new PackDescriptor();
                ret.Populate(magic, reader);
                break;

            case Signatures.Archive:
                ret = new AssetArchiveResourceContainerDescriptor();
                ret.Populate(magic, reader);
                break;
            }
            //if (ret == null)
            //    Debug.WriteLine($"WARN: Unknown magic: {magic:X8}");
            return(ret);
        }
Esempio n. 2
0
 public ResourceContainerTable(AssetArchiveResourceContainerDescriptor descriptor, WildstarFile archiveFile)
 {
     using (var directoryStream = archiveFile.File.CreateViewStream(archiveFile.BlockTable[descriptor.BlockEntry].DirectoryOffset, dirEntrySize * descriptor.EntryCount, MemoryMappedFileAccess.Read))
         using (var reader = new BinaryReader(directoryStream))
             for (var x = 0; x < descriptor.EntryCount; x++)
             {
                 var next     = ArchiveResourceEntry.Load(reader);
                 var position = _entries.BinarySearch(next);
                 if (position < 0)
                 {
                     position = ~position;
                 }
                 _entries.Insert(position, next);
             }
 }