예제 #1
0
        public override int GetBuilderSize()
        {
            if (CompressedChunks.Any())
            {
                throw new NotSupportedException("Cannot rebuild compressed files. Yet.");
            }

            if (Signature == Signatures.EncryptedSignature)
            {
                throw new NotSupportedException("Cannot rebuild fully encrypted files. Yet.");
            }

            BuilderSize = sizeof(uint) * 7
                          + sizeof(ushort) * 2
                          + sizeof(int) * 10
                          + Group.GetBuilderSize()
                          + Guid.Length
                          + GenerationTable.Sum(gen => gen.GetBuilderSize());

            BuilderNameTableOffset = BuilderSize;

            BuilderSize += NameTable.Sum(name => name.GetBuilderSize());

            BuilderImportTableOffset = BuilderSize;

            BuilderSize += ImportTable.Sum(import => import.GetBuilderSize());

            BuilderExportTableOffset = BuilderSize;

            BuilderSize += ExportTable.Sum(export => export.GetBuilderSize());

            BuilderDependsTableOffset = BuilderSize;

            BuilderSize += DependsTable.Length;

            ExportTable.Aggregate(BuilderSize, (current, export) => current + export.GetObjectSize(current));

            return(BuilderSize);
        }