BN089-BS开发框架MVC4版/source20131023/Zephyr.Net/Zephyr.Utils/Document/Excel/ExcelLibrary/Office/CompoundDocumentFormat/SectorAllocation.cs

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Text;

namespace Zephyr.Utils.ExcelLibrary.CompoundDocumentFormat
{
    public class SectorAllocation
    {
        CompoundDocument Document;

        int SecIDCapacity;

        public SectorAllocation(CompoundDocument document)
        {
            this.Document = document;
            this.SecIDCapacity = document.SectorSize / 4;
        }

        public int AllocateSector()
        {
            int newSectorID = Document.AllocateNewSector();
            LinkSectorID(newSectorID, SID.EOC);
            return newSectorID;
        }

        public void LinkSectorID(int sectorID, int newSectorID)
        {
            if (sectorID < 0)
            {
                throw new ArgumentOutOfRangeException("sectorID");
            }
            int SATSectorIndex = sectorID / SecIDCapacity;
            int SectorIndex = sectorID % SecIDCapacity;

            int SATSectorID = Document.MasterSectorAllocation.GetSATSectorID(SATSectorIndex);
            Document.WriteInSector(SATSectorID, SectorIndex * 4, newSectorID);
        }

        public int GetNextSectorID(int sectorID)
        {
            if (sectorID < 0)
            {
                throw new ArgumentOutOfRangeException("sectorID");
            }
            int SATSectorIndex = sectorID / SecIDCapacity;
            int SectorIndex = sectorID % SecIDCapacity;

            int SATSectorID = Document.MasterSectorAllocation.GetSATSectorID(SATSectorIndex);
            return Document.ReadInt32InSector(SATSectorID, SectorIndex * 4);
        }

        public List<int> GetSIDChain(int StartSID)
        {
            List<int> chain = new List<int>();
            int sid = StartSID;
            while (sid != SID.EOC)
            {
                chain.Add(sid);
                sid = GetNextSectorID(sid);
            }
后面还有 4 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。