private static int CreateChain(int streamSize, ArrayList allocationTable, int sectorSize) { int num = allocationTable.Count; int num2 = CompoundFileData.SectorCount(streamSize, sectorSize); for (int i = 0; i < (num2 - 1); i++) { allocationTable.Add(allocationTable.Count + 1); } allocationTable.Add(-2); return(num); }
private void BuildSATAndMAT() { int sectorSize = base.sectorSize / 4; int num3 = sectorSize - 1; int streamSize = base.sectorAllocationTable.Count; while (true) { int num = streamSize; base.SATSectorCount = CompoundFileData.SectorCount(streamSize, sectorSize); if (base.SATSectorCount <= 0x6d) { base.MATSectorCount = 0; } else { base.MATSectorCount = CompoundFileData.SectorCount(base.SATSectorCount - 0x6d, num3); } streamSize = (base.sectorAllocationTable.Count + base.SATSectorCount) + base.MATSectorCount; if (streamSize <= num) { base.sectorAllocationTableSID = this.FillSAT(base.SATSectorCount, CompoundFileData.SpecialSIDs.SAT); if (base.MATSectorCount > 0) { base.masterAllocationTableSID = this.FillSAT(base.MATSectorCount, CompoundFileData.SpecialSIDs.MSAT); } else { base.masterAllocationTableSID = -2; } if (base.sectorAllocationTable.Count != streamSize) { throw new CompoundFileException("Internal error: wrong SAT / MAT calculation."); } return; } } }