예제 #1
0
        public void Read(Stream stream)
        {
            var rw = new StreamRW(stream);

            HeaderSignature = rw.ReadBytes(8);
            CheckSignature();
            CLSID        = rw.ReadBytes(16);
            MinorVersion = rw.ReadUInt16();
            MajorVersion = rw.ReadUInt16();
            CheckVersion();
            ByteOrder              = rw.ReadUInt16();
            SectorShift            = rw.ReadUInt16();
            MiniSectorShift        = rw.ReadUInt16();
            UnUsed                 = rw.ReadBytes(6);
            DirectorySectorsNumber = rw.ReadInt32();
            FATSectorsNumber       = rw.ReadInt32();
            FirstDirectorySectorId = rw.ReadInt32();
            UnUsed2                = rw.ReadUInt32();
            MinSizeStandardStream  = rw.ReadUInt32();
            FirstMiniFATSectorId   = rw.ReadInt32();
            MiniFATSectorsNumber   = rw.ReadUInt32();
            FirstDIFATSectorId     = rw.ReadInt32();
            DIFATSectorsNumber     = rw.ReadUInt32();

            for (var i = 0; i < 109; i++)
            {
                DIFAT[i] = rw.ReadInt32();
            }

            rw.Close();
        }
예제 #2
0
        public void Write(Stream stream)
        {
            var rw = new StreamRW(stream);

            rw.Write(HeaderSignature);
            rw.Write(CLSID);
            rw.Write(MinorVersion);
            rw.Write(MajorVersion);
            rw.Write(ByteOrder);
            rw.Write(SectorShift);
            rw.Write(MiniSectorShift);
            rw.Write(UnUsed);
            rw.Write(DirectorySectorsNumber);
            rw.Write(FATSectorsNumber);
            rw.Write(FirstDirectorySectorId);
            rw.Write(UnUsed2);
            rw.Write(MinSizeStandardStream);
            rw.Write(FirstMiniFATSectorId);
            rw.Write(MiniFATSectorsNumber);
            rw.Write(FirstDIFATSectorId);
            rw.Write(DIFATSectorsNumber);

            foreach (var i in DIFAT)
            {
                rw.Write(i);
            }

            if (MajorVersion == 4)
            {
                var zeroHead = new byte[3584];
                rw.Write(zeroHead);
            }

            rw.Close();
        }