コード例 #1
0
ファイル: FatSector.cs プロジェクト: yangchao123/SL.RExcel
 public FatSector(Stream stream)
 {
     Fats = new SectorIndex[XLSFile.MaxSectorIndex];
     BinaryReader reader = new BinaryReader(stream);
     for (int i = 0; i < Fats.Length; ++i)
         Fats[i] = new SectorIndex(reader.ReadUInt32());
 }
コード例 #2
0
ファイル: XLSHeader.cs プロジェクト: yangchao123/SL.RExcel
        public XLSHeader(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);
            CheckFormart(reader.ReadUInt64());

            ID = new Guid(reader.ReadBytes(16));
            MinorVer = reader.ReadUInt16();
            DllVer = reader.ReadUInt16();
            ByteOrder = reader.ReadUInt16();
            Shift = reader.ReadUInt16();
            MiniShift = reader.ReadUInt16();
            Reserved = reader.ReadUInt16();
            Reserved1 = reader.ReadUInt32();
            Reserved2 = reader.ReadUInt32();
            FatCount = reader.ReadUInt32();
            DirStart = new SectorIndex(reader.ReadUInt32());
            Signature = reader.ReadUInt32();
            MiniSectorCutoff = reader.ReadUInt32();
            MiniFatStart = new SectorIndex(reader.ReadUInt32());
            MiniFatCount = reader.ReadUInt32();
            DifStart = new SectorIndex(reader.ReadUInt32());
            DifCount = reader.ReadUInt32();
            Fats = new SectorIndex[109];
            for (int i = 0; i < Fats.Length; i++)
            {
                Fats[i] = new SectorIndex(reader.ReadUInt32());
            }
        }
コード例 #3
0
ファイル: XLSHeader.cs プロジェクト: yangchao123/SL.RExcel
        public XLSHeader(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);

            CheckFormart(reader.ReadUInt64());

            ID               = new Guid(reader.ReadBytes(16));
            MinorVer         = reader.ReadUInt16();
            DllVer           = reader.ReadUInt16();
            ByteOrder        = reader.ReadUInt16();
            Shift            = reader.ReadUInt16();
            MiniShift        = reader.ReadUInt16();
            Reserved         = reader.ReadUInt16();
            Reserved1        = reader.ReadUInt32();
            Reserved2        = reader.ReadUInt32();
            FatCount         = reader.ReadUInt32();
            DirStart         = new SectorIndex(reader.ReadUInt32());
            Signature        = reader.ReadUInt32();
            MiniSectorCutoff = reader.ReadUInt32();
            MiniFatStart     = new SectorIndex(reader.ReadUInt32());
            MiniFatCount     = reader.ReadUInt32();
            DifStart         = new SectorIndex(reader.ReadUInt32());
            DifCount         = reader.ReadUInt32();
            Fats             = new SectorIndex[109];
            for (int i = 0; i < Fats.Length; i++)
            {
                Fats[i] = new SectorIndex(reader.ReadUInt32());
            }
        }
コード例 #4
0
ファイル: XLSDirectory.cs プロジェクト: yangchao123/SL.RExcel
        private void SetData(long length, SectorIndex dataOffset, List <Sector> sectors, List <SectorIndex> index)
        {
            if (!dataOffset.IsEndOfChain)
            {
                int          left   = (int)length;
                MemoryStream stream = new MemoryStream(Data);
                SectorIndex  sect   = dataOffset;

                do
                {
                    try
                    {
                        Storage sector = (Storage)sectors[sect.ToInt()];

                        int toWrite = Math.Min(sector.Data.Length, left);
                        stream.Write(sector.Data, 0, toWrite);
                        left -= toWrite;

                        sect = index[sect.ToInt()];
                    }
                    catch (Exception)
                    {
                        return;
                    }
                } while (!sect.IsEndOfChain);
            }
        }
コード例 #5
0
ファイル: XLSDirectory.cs プロジェクト: yangchao123/SL.RExcel
 public XLSStreamDirectory(string name, long length, SectorIndex dataOffset,
                           List <Sector> sectors, List <SectorIndex> index)
     : base(name)
 {
     Length = length;
     Data   = new byte[length];
     SetData(length, dataOffset, sectors, index);
 }
コード例 #6
0
        public MiniFatSector(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);

            for (int i = 0; i < Fats.Length; ++i)
            {
                Fats[i] = new SectorIndex(reader.ReadUInt32());
            }
        }
コード例 #7
0
ファイル: DifSector.cs プロジェクト: yangchao123/SL.RExcel
        public DifSector(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);
            Fats = new SectorIndex[127];
            for (int i = 0; i < Fats.Length; ++i)
                Fats[i] = new SectorIndex(reader.ReadUInt32());

            NextDif = new SectorIndex(reader.ReadUInt32());
        }
コード例 #8
0
        public FatSector(Stream stream)
        {
            Fats = new SectorIndex[XLSFile.MaxSectorIndex];
            BinaryReader reader = new BinaryReader(stream);

            for (int i = 0; i < Fats.Length; ++i)
            {
                Fats[i] = new SectorIndex(reader.ReadUInt32());
            }
        }
コード例 #9
0
ファイル: DifSector.cs プロジェクト: yangchao123/SL.RExcel
        public DifSector(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);

            Fats = new SectorIndex[127];
            for (int i = 0; i < Fats.Length; ++i)
            {
                Fats[i] = new SectorIndex(reader.ReadUInt32());
            }

            NextDif = new SectorIndex(reader.ReadUInt32());
        }
コード例 #10
0
ファイル: XLSFile.cs プロジェクト: yangchao123/SL.RExcel
        private List <DirectorySectorData> SetDirs(XLSHeader header, List <Sector> sectors, List <SectorIndex> index)
        {
            var dirs = new List <DirectorySectorData>();

            for (SectorIndex dirSect = header.DirStart;
                 !dirSect.IsEndOfChain;
                 dirSect = index[dirSect.ToInt()])
            {
                DirectorySector dir = new DirectorySector(sectors[dirSect.ToInt()].ToStorage().ToStream());

                foreach (DirectorySectorData entry in dir.Entries)
                {
                    dirs.Add(entry);
                }
                sectors[dirSect.ToInt()] = dir;
            }
            return(dirs);
        }
コード例 #11
0
        public DirectorySectorData(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);

            SetName(reader);
            Type            = (Stgty)reader.ReadByte();
            Color           = (DeColor)reader.ReadByte();
            LeftSibling     = new SectorIndex(reader.ReadUInt32());
            RightSibling    = new SectorIndex(reader.ReadUInt32());
            Child           = new SectorIndex(reader.ReadUInt32());
            ID              = new Guid(reader.ReadBytes(16));
            UserFlags       = reader.ReadUInt32();
            CreateTimeStamp = reader.ReadUInt64();
            ModifyTimeStamp = reader.ReadUInt64();
            Start           = new SectorIndex(reader.ReadUInt32());
            Size            = reader.ReadUInt32();
            PropType        = reader.ReadUInt16();
            Padding         = reader.ReadUInt16();
        }