Beispiel #1
0
        public FilePackInfo(string inDirectory)
        {
            PackDirectory      = inDirectory;
            QualifiedFileNames = new List <string>(Directory.GetFiles(PackDirectory));
            FileBaseNames      = GetFileBaseNames();
            FileCount          = QualifiedFileNames.Count;
            FileExtensions     = GetFileExtensions();
            NameTableBlockSize = GetNameTableBlockSize();
            FileSizeDict       = GetFileSizeDict();
            MetadataTable metadataTable = new MetadataTable
            {
                Size   = 4 * FileCount,
                Offset = 32
            };

            FileOffsetTable = metadataTable;
            metadataTable   = new MetadataTable
            {
                Size   = 4 * FileCount,
                Offset = FileOffsetTable.EndOffset()
            };
            ExtensionTable = metadataTable;
            metadataTable  = new MetadataTable
            {
                Size   = 4 + NameTableBlockSize * FileCount,
                Offset = ExtensionTable.EndOffset()
            };
            NameTable            = metadataTable;
            NameTable.EndPadding = ((NameTable.EndOffset() % 4 != 0) ? (4 - NameTable.EndOffset() % 4) : 0);
            metadataTable        = (SizeTable = new MetadataTable
            {
                Size = 4 * FileCount,
                Offset = NameTable.EndOffset()
            });
            metadataTable = (CrcTable = new MetadataTable
            {
                Size = 16,
                Offset = SizeTable.EndOffset()
            });
            CrcTable.EndPadding = ((CrcTable.EndOffset() % 16 != 0) ? (16 - CrcTable.EndOffset() % 16) : 0);
        }