Пример #1
0
        public CustomToolbarWrapper(VirtualStreamReader reader) : base(reader, ByteStructure.VARIABLE_LENGTH)
        {
            long startPos = reader.BaseStream.Position;

            //skip the first 7 bytes
            byte[] skipped = reader.ReadBytes(7);

            this.cbTBD  = reader.ReadInt16();
            this.cCust  = reader.ReadInt16();
            this.cbDTBC = reader.ReadInt32();

            this.rTBDC = new List <ToolbarControl>();
            int rTbdcEndPos = (int)(reader.BaseStream.Position + cbDTBC);

            while (reader.BaseStream.Position < rTbdcEndPos)
            {
                this.rTBDC.Add(new ToolbarControl(reader));
            }
            reader.BaseStream.Seek(rTbdcEndPos, System.IO.SeekOrigin.Begin);

            this.rCustomizations = new List <ToolbarCustomization>();
            for (int i = 0; i < cCust; i++)
            {
                this.rCustomizations.Add(new ToolbarCustomization(reader));
            }

            long endPos = reader.BaseStream.Position;

            //read the raw bytes
            reader.BaseStream.Seek(startPos - 1, System.IO.SeekOrigin.Begin);
            this._rawBytes = reader.ReadBytes((int)(endPos - startPos + 1));
        }
Пример #2
0
        public KeyMapEntry(VirtualStreamReader reader)
            : base(reader, KME_LENGTH)
        {
            //ignore the first 4 bytes
            reader.ReadBytes(4);

            //Primary KCM
            this.kcm1 = reader.ReadInt16();

            //Secondary KCM
            this.kcm2 = reader.ReadInt16();

            //Key Action Type
            this.kt = (ActionType)reader.ReadInt16();

            //read the params
            switch (this.kt)
            {
            case ActionType.ktCid:
                this.paramCid = new CommandIdentifier(reader);
                break;

            case ActionType.ktChar:
                this.paramChar = (char)reader.ReadInt32();
                break;

            default:
                reader.ReadBytes(4);
                break;
            }
        }
        public ListFormatOverrideTable(FileInformationBlock fib, VirtualStream tableStream)
        {
            if (fib.lcbPlfLfo > 0)
            {
                var reader = new VirtualStreamReader(tableStream);
                reader.BaseStream.Seek((long)fib.fcPlfLfo, System.IO.SeekOrigin.Begin);

                //read the count of LFOs
                int count = reader.ReadInt32();

                //read the LFOs
                for (int i = 0; i < count; i++)
                {
                    this.Add(new ListFormatOverride(reader, LFO_LENGTH));
                }

                //read the LFOLVLs
                for (int i = 0; i < count; i++)
                {
                    for (int j = 0; j < this[i].clfolvl; j++)
                    {
                        this[i].rgLfoLvl[j] = new ListFormatOverrideLevel(reader, LFOLVL_LENGTH);
                    }
                }
            }
        }
        public ToolbarControlBitmap(VirtualStreamReader reader)
            : base(reader, ByteStructure.VARIABLE_LENGTH)
        {
            this.cbDIB = reader.ReadInt32();

            //ToDo: Read TBCBitmap
            reader.ReadBytes(cbDIB - 10);
        }
Пример #5
0
        private void processOleStream(string oleStream)
        {
            try
            {
                VirtualStreamReader reader = new VirtualStreamReader(_docStorage.GetStream(oleStream));

                //skip version
                reader.ReadBytes(4);

                //read the embedded/linked flag
                Int32 flag = reader.ReadInt32();
                this.fLinked = Utils.BitmaskToBool(flag, 0x1);

                //Link update option
                this.UpdateMode = (LinkUpdateOption)reader.ReadInt32();
            }
            catch (StreamNotFoundException) { }
        }
Пример #6
0
        private void parse(VirtualStream stream, int fc)
        {
            stream.Seek(fc, System.IO.SeekOrigin.Begin);
            var reader = new VirtualStreamReader(stream);

            this.lcb      = reader.ReadInt32();
            this.cbHeader = reader.ReadInt16();
            reader.ReadBytes(62);
            this.binData = reader.ReadBytes(this.lcb - this.cbHeader);
        }
Пример #7
0
        public CustomToolbar(VirtualStreamReader reader)
            : base(reader, ByteStructure.VARIABLE_LENGTH)
        {
            this.name     = Utils.ReadXst(reader.BaseStream);
            this.cbTBData = reader.ReadInt32();

            //cbTBData specifies the size of this structure excluding the name, cCtls, and rTBC fields
            //so it is the size of cbtb + tb + rVisualData + iWCTB + 4ignore bytes
            //so we can retrieve the size of tb:
            this.tb          = reader.ReadBytes(this.cbTBData - 4 - 100 - 4 - 4);
            this.rVisualData = reader.ReadBytes(100);
            this.iWCTB       = reader.ReadInt32();
            reader.ReadBytes(4);

            this.cCtls = reader.ReadInt32();
            this.rTBC  = new List <ToolbarControl>();
            for (int i = 0; i < this.cCtls; i++)
            {
                this.rTBC.Add(new ToolbarControl(reader));
            }
        }
Пример #8
0
        public ToolbarDelta(VirtualStreamReader reader)
            : base(reader, TBDelta_LENGTH)
        {
            byte flags1 = reader.ReadByte();

            this.dopr   = Utils.BitmaskToInt((int)flags1, 0x03);
            this.fAtEnd = Utils.BitmaskToBool((int)flags1, 0x04);

            this.ibts    = reader.ReadByte();
            this.cidNext = reader.ReadInt32();
            this.cid     = reader.ReadInt32();
            this.fc      = reader.ReadInt32();

            UInt16 flags2 = reader.ReadUInt16();

            this.fOnDisk = Utils.BitmaskToBool((int)flags2, 0x0001);
            this.iTB     = Utils.BitmaskToInt((int)flags2, 0x3FFE);
            this.fDead   = Utils.BitmaskToBool((int)flags2, 0x8000);

            this.cbTBC = reader.ReadUInt16();
        }
Пример #9
0
        public Plex(int structureLength, VirtualStream tableStream, uint fc, uint lcb)
        {
            tableStream.Seek((long)fc, System.IO.SeekOrigin.Begin);
            var reader = new VirtualStreamReader(tableStream);

            int n = 0;

            if (structureLength > 0)
            {
                //this PLEX contains CPs and Elements
                n = ((int)lcb - CP_LENGTH) / (structureLength + CP_LENGTH);
            }
            else
            {
                //this PLEX only contains CPs
                n = ((int)lcb - CP_LENGTH) / CP_LENGTH;
            }

            //read the n + 1 CPs
            this.CharacterPositions = new List <int>();
            for (int i = 0; i < n + 1; i++)
            {
                this.CharacterPositions.Add(reader.ReadInt32());
            }

            //read the n structs
            this.Elements = new List <T>();
            var genericType = typeof(T);

            if (genericType == typeof(short))
            {
                this.Elements = new List <T>();
                for (int i = 0; i < n; i++)
                {
                    short value        = reader.ReadInt16();
                    var   genericValue = (T)Convert.ChangeType(value, typeof(T));
                    this.Elements.Add(genericValue);
                }
            }
            else if (structureLength > 0)
            {
                for (int i = 0; i < n; i++)
                {
                    var    constructor  = genericType.GetConstructor(new Type[] { typeof(VirtualStreamReader), typeof(int) });
                    object value        = constructor.Invoke(new object[] { reader, structureLength });
                    var    genericValue = (T)Convert.ChangeType(value, typeof(T));
                    this.Elements.Add(genericValue);
                }
            }
        }
Пример #10
0
        public OfficeDrawingTable(WordDocument doc, OfficeDrawingTableType type)
        {
            var reader = new VirtualStreamReader(doc.TableStream);

            //FSPA has size 26 + 4 byte for the FC = 30 byte
            int  n       = 0;
            uint startFc = 0;

            if (type == OfficeDrawingTableType.MainDocument)
            {
                startFc = doc.FIB.fcPlcSpaMom;
                n       = (int)Math.Floor((double)doc.FIB.lcbPlcSpaMom / 30);
            }
            else if (type == OfficeDrawingTableType.Header)
            {
                startFc = doc.FIB.fcPlcSpaHdr;
                n       = (int)Math.Floor((double)doc.FIB.lcbPlcSpaHdr / 30);
            }

            //there are n+1 FCs ...
            doc.TableStream.Seek(startFc, System.IO.SeekOrigin.Begin);
            var fcs = new int[n + 1];

            for (int i = 0; i < (n + 1); i++)
            {
                fcs[i] = reader.ReadInt32();
            }

            //followed by n FSPAs
            for (int i = 0; i < n; i++)
            {
                FileShapeAddress fspa = null;
                if (type == OfficeDrawingTableType.Header)
                {
                    //fspa = new FileShapeAddress(reader, doc.OfficeArtContent);
                }
                else if (type == OfficeDrawingTableType.MainDocument)
                {
                    //fspa = new FileShapeAddress(reader, doc.OfficeArtContent);
                }
                this.Add(fcs[i], fspa);
            }
        }
Пример #11
0
        public ToolbarCustomization(VirtualStreamReader reader)
            : base(reader, ByteStructure.VARIABLE_LENGTH)
        {
            this.tbidForTBD = reader.ReadInt32();
            reader.ReadBytes(2);
            this.ctbds = reader.ReadInt16();

            //read the cutomization data
            if (this.tbidForTBD == 0)
            {
                this.customToolbar = new CustomToolbar(reader);
            }
            else
            {
                this.customToolbarDeltas = new List <ToolbarDelta>();
                for (int i = 0; i < this.ctbds; i++)
                {
                    this.customToolbarDeltas.Add(new ToolbarDelta(reader));
                }
            }
        }
Пример #12
0
        public HeaderAndFooterTable(WordDocument doc)
        {
            IStreamReader tableReader = new VirtualStreamReader(doc.TableStream);

            FirstHeaders = new List <CharacterRange>();
            EvenHeaders  = new List <CharacterRange>();
            OddHeaders   = new List <CharacterRange>();
            FirstFooters = new List <CharacterRange>();
            EvenFooters  = new List <CharacterRange>();
            OddFooters   = new List <CharacterRange>();

            //read the Table
            Int32[] table = new Int32[doc.FIB.lcbPlcfHdd / 4];
            doc.TableStream.Seek(doc.FIB.fcPlcfHdd, System.IO.SeekOrigin.Begin);
            for (int i = 0; i < table.Length; i++)
            {
                table[i] = tableReader.ReadInt32();
            }
            int count = (table.Length - 8) / 6;

            int initialPos = doc.FIB.ccpText + doc.FIB.ccpFtn;

            //the first 6 _entries are about footnote and endnote formatting
            //so skip these _entries
            int pos = 6;

            for (int i = 0; i < count; i++)
            {
                //Even Header
                if (table[pos] == table[pos + 1])
                {
                    this.EvenHeaders.Add(null);
                }
                else
                {
                    this.EvenHeaders.Add(new CharacterRange(initialPos + table[pos], table[pos + 1] - table[pos]));
                }
                pos++;

                //Odd Header
                if (table[pos] == table[pos + 1])
                {
                    this.OddHeaders.Add(null);
                }
                else
                {
                    this.OddHeaders.Add(new CharacterRange(initialPos + table[pos], table[pos + 1] - table[pos]));
                }
                pos++;

                //Even Footer
                if (table[pos] == table[pos + 1])
                {
                    this.EvenFooters.Add(null);
                }
                else
                {
                    this.EvenFooters.Add(new CharacterRange(initialPos + table[pos], table[pos + 1] - table[pos]));
                }
                pos++;

                //Odd Footer
                if (table[pos] == table[pos + 1])
                {
                    this.OddFooters.Add(null);
                }
                else
                {
                    this.OddFooters.Add(new CharacterRange(initialPos + table[pos], table[pos + 1] - table[pos]));
                }
                pos++;

                //First Page Header
                if (table[pos] == table[pos + 1])
                {
                    this.FirstHeaders.Add(null);
                }
                else
                {
                    this.FirstHeaders.Add(new CharacterRange(initialPos + table[pos], table[pos + 1] - table[pos]));
                }
                pos++;

                //First Page Footers
                if (table[pos] == table[pos + 1])
                {
                    this.FirstFooters.Add(null);
                }
                else
                {
                    this.FirstFooters.Add(new CharacterRange(initialPos + table[pos], table[pos + 1] - table[pos]));
                }
                pos++;
            }
        }
Пример #13
0
        private void parse(Type dataType, VirtualStreamReader reader, UInt32 fc)
        {
            //read fExtend
            if (reader.ReadUInt16() == 0xFFFF)
            {
                //if the first 2 bytes are 0xFFFF the STTB contains unicode characters
                this.fExtend = true;
                _enc         = Encoding.Unicode;
            }
            else
            {
                //else the STTB contains 1byte characters and the fExtend field is non-existend
                //seek back to the beginning
                this.fExtend = false;
                _enc         = Encoding.ASCII;
                reader.BaseStream.Seek((long)fc, System.IO.SeekOrigin.Begin);
            }

            //read cData
            long   cDataStart = reader.BaseStream.Position;
            UInt16 c          = reader.ReadUInt16();

            if (c != 0xFFFF)
            {
                //cData is a 2byte unsigned Integer and the read bytes are already cData
                this.cData = (int)c;
            }
            else
            {
                //cData is a 4byte signed Integer, so we need to seek back
                reader.BaseStream.Seek((long)fc + cDataStart, System.IO.SeekOrigin.Begin);
                this.cData = reader.ReadInt32();
            }

            //read cbExtra
            this.cbExtra = reader.ReadUInt16();

            //read the strings and extra datas
            for (int i = 0; i < this.cData; i++)
            {
                int cchData = 0;
                int cbData  = 0;
                if (this.fExtend)
                {
                    cchData = (int)reader.ReadUInt16();
                    cbData  = cchData * 2;
                }
                else
                {
                    cchData = (int)reader.ReadByte();
                    cbData  = cchData;
                }

                long posBeforeType = reader.BaseStream.Position;

                if (dataType == typeof(string))
                {
                    //It's a real string table
                    this.Strings.Add(_enc.GetString(reader.ReadBytes(cbData)));
                }
                else
                {
                    //It's a modified string table that contains custom data
                    ConstructorInfo constructor = dataType.GetConstructor(new Type[] { typeof(VirtualStreamReader), typeof(int) });
                    ByteStructure   data        = (ByteStructure)constructor.Invoke(new object[] { reader, cbData });
                    this.Data.Add(data);
                }

                reader.BaseStream.Seek(posBeforeType + cbData, System.IO.SeekOrigin.Begin);

                //skip the extra byte
                reader.ReadBytes(cbExtra);
            }
        }
Пример #14
0
        //*****************************************************************************************
        //                                                                              CONSTRUCTOR
        //*****************************************************************************************

        public FileInformationBlock(VirtualStreamReader reader)
        {
            UInt16 flag16 = 0;
            byte   flag8  = 0;

            //read the FIB base
            this.wIdent = reader.ReadUInt16();
            this.nFib   = (FibVersion)reader.ReadUInt16();
            reader.ReadBytes(2);
            this.lid                  = reader.ReadUInt16();
            this.pnNext               = reader.ReadInt16();
            flag16                    = reader.ReadUInt16();
            this.fDot                 = Utils.BitmaskToBool((int)flag16, 0x0001);
            this.fGlsy                = Utils.BitmaskToBool((int)flag16, 0x0002);
            this.fComplex             = Utils.BitmaskToBool((int)flag16, 0x0002);
            this.fHasPic              = Utils.BitmaskToBool((int)flag16, 0x0008);
            this.cQuickSaves          = (UInt16)(((int)flag16 & 0x00F0) >> 4);
            this.fEncrypted           = Utils.BitmaskToBool((int)flag16, 0x0100);
            this.fWhichTblStm         = Utils.BitmaskToBool((int)flag16, 0x0200);
            this.fReadOnlyRecommended = Utils.BitmaskToBool((int)flag16, 0x0400);
            this.fWriteReservation    = Utils.BitmaskToBool((int)flag16, 0x0800);
            this.fExtChar             = Utils.BitmaskToBool((int)flag16, 0x1000);
            this.fLoadOverwrite       = Utils.BitmaskToBool((int)flag16, 0x2000);
            this.fFarEast             = Utils.BitmaskToBool((int)flag16, 0x4000);
            this.fCrypto              = Utils.BitmaskToBool((int)flag16, 0x8000);
            this.nFibBack             = reader.ReadUInt16();
            this.lKey                 = reader.ReadInt32();
            this.envr                 = reader.ReadByte();
            flag8                  = reader.ReadByte();
            this.fMac              = Utils.BitmaskToBool((int)flag8, 0x01);
            this.fEmptySpecial     = Utils.BitmaskToBool((int)flag8, 0x02);
            this.fLoadOverridePage = Utils.BitmaskToBool((int)flag8, 0x04);
            this.fFutureSavedUndo  = Utils.BitmaskToBool((int)flag8, 0x08);
            this.fWord97Saved      = Utils.BitmaskToBool((int)flag8, 0x10);
            reader.ReadBytes(4);
            this.fcMin = reader.ReadInt32();
            this.fcMac = reader.ReadInt32();

            this.csw = reader.ReadUInt16();

            //read the RgW97
            reader.ReadBytes(26);
            this.lidFE = reader.ReadInt16();

            this.cslw = reader.ReadUInt16();

            //read the RgLW97
            this.cbMac = reader.ReadInt32();
            reader.ReadBytes(8);
            this.ccpText = reader.ReadInt32();
            this.ccpFtn  = reader.ReadInt32();
            this.ccpHdr  = reader.ReadInt32();
            reader.ReadBytes(4);
            this.ccpAtn     = reader.ReadInt32();
            this.ccpEdn     = reader.ReadInt32();
            this.ccpTxbx    = reader.ReadInt32();
            this.ccpHdrTxbx = reader.ReadInt32();
            reader.ReadBytes(44);

            this.cbRgFcLcb = reader.ReadUInt16();

            if (this.nFib >= FibVersion.Fib1997Beta)
            {
                //Read the FibRgFcLcb97
                this.fcStshfOrig    = reader.ReadUInt32();
                this.lcbStshfOrig   = reader.ReadUInt32();
                this.fcStshf        = reader.ReadUInt32();
                this.lcbStshf       = reader.ReadUInt32();
                this.fcPlcffndRef   = reader.ReadUInt32();
                this.lcbPlcffndRef  = reader.ReadUInt32();
                this.fcPlcffndTxt   = reader.ReadUInt32();
                this.lcbPlcffndTxt  = reader.ReadUInt32();
                this.fcPlcfandRef   = reader.ReadUInt32();
                this.lcbPlcfandRef  = reader.ReadUInt32();
                this.fcPlcfandTxt   = reader.ReadUInt32();
                this.lcbPlcfandTxt  = reader.ReadUInt32();
                this.fcPlcfSed      = reader.ReadUInt32();
                this.lcbPlcfSed     = reader.ReadUInt32();
                this.fcPlcPad       = reader.ReadUInt32();
                this.lcbPlcPad      = reader.ReadUInt32();
                this.fcPlcfPhe      = reader.ReadUInt32();
                this.lcbPlcfPhe     = reader.ReadUInt32();
                this.fcSttbfGlsy    = reader.ReadUInt32();
                this.lcbSttbfGlsy   = reader.ReadUInt32();
                this.fcPlcfGlsy     = reader.ReadUInt32();
                this.lcbPlcfGlsy    = reader.ReadUInt32();
                this.fcPlcfHdd      = reader.ReadUInt32();
                this.lcbPlcfHdd     = reader.ReadUInt32();
                this.fcPlcfBteChpx  = reader.ReadUInt32();
                this.lcbPlcfBteChpx = reader.ReadUInt32();
                this.fcPlcfBtePapx  = reader.ReadUInt32();
                this.lcbPlcfBtePapx = reader.ReadUInt32();
                this.fcPlcfSea      = reader.ReadUInt32();
                this.lcbPlcfSea     = reader.ReadUInt32();
                this.fcSttbfFfn     = reader.ReadUInt32();
                this.lcbSttbfFfn    = reader.ReadUInt32();
                this.fcPlcfFldMom   = reader.ReadUInt32();
                this.lcbPlcfFldMom  = reader.ReadUInt32();
                this.fcPlcfFldHdr   = reader.ReadUInt32();
                this.lcbPlcfFldHdr  = reader.ReadUInt32();
                this.fcPlcfFldFtn   = reader.ReadUInt32();
                this.lcbPlcfFldFtn  = reader.ReadUInt32();
                this.fcPlcfFldAtn   = reader.ReadUInt32();
                this.lcbPlcfFldAtn  = reader.ReadUInt32();
                this.fcPlcfFldMcr   = reader.ReadUInt32();
                this.lcbPlcfFldMcr  = reader.ReadUInt32();
                this.fcSttbfBkmk    = reader.ReadUInt32();
                this.lcbSttbfBkmk   = reader.ReadUInt32();
                this.fcPlcfBkf      = reader.ReadUInt32();
                this.lcbPlcfBkf     = reader.ReadUInt32();
                this.fcPlcfBkl      = reader.ReadUInt32();
                this.lcbPlcfBkl     = reader.ReadUInt32();
                this.fcCmds         = reader.ReadUInt32();
                this.lcbCmds        = reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                this.fcSttbfMcr         = reader.ReadUInt32();
                this.lcbSttbfMcr        = reader.ReadUInt32();
                this.fcPrDrvr           = reader.ReadUInt32();
                this.lcbPrDrvr          = reader.ReadUInt32();
                this.fcPrEnvPort        = reader.ReadUInt32();
                this.lcbPrEnvPort       = reader.ReadUInt32();
                this.fcPrEnvLand        = reader.ReadUInt32();
                this.lcbPrEnvLand       = reader.ReadUInt32();
                this.fcWss              = reader.ReadUInt32();
                this.lcbWss             = reader.ReadUInt32();
                this.fcDop              = reader.ReadUInt32();
                this.lcbDop             = reader.ReadUInt32();
                this.fcSttbfAssoc       = reader.ReadUInt32();
                this.lcbSttbfAssoc      = reader.ReadUInt32();
                this.fcClx              = reader.ReadUInt32();
                this.lcbClx             = reader.ReadUInt32();
                this.fcPlcfPgdFtn       = reader.ReadUInt32();
                this.lcbPlcfPgdFtn      = reader.ReadUInt32();
                this.fcAutosaveSource   = reader.ReadUInt32();
                this.lcbAutosaveSource  = reader.ReadUInt32();
                this.fcGrpXstAtnOwners  = reader.ReadUInt32();
                this.lcbGrpXstAtnOwners = reader.ReadUInt32();
                this.fcSttbfAtnBkmk     = reader.ReadUInt32();
                this.lcbSttbfAtnBkmk    = reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                this.fcPlcSpaMom     = reader.ReadUInt32();
                this.lcbPlcSpaMom    = reader.ReadUInt32();
                this.fcPlcSpaHdr     = reader.ReadUInt32();
                this.lcbPlcSpaHdr    = reader.ReadUInt32();
                this.fcPlcfAtnBkf    = reader.ReadUInt32();
                this.lcbPlcfAtnBkf   = reader.ReadUInt32();
                this.fcPlcfAtnBkl    = reader.ReadUInt32();
                this.lcbPlcfAtnBkl   = reader.ReadUInt32();
                this.fcPms           = reader.ReadUInt32();
                this.lcbPms          = reader.ReadUInt32();
                this.fcFormFldSttbs  = reader.ReadUInt32();
                this.lcbFormFldSttbs = reader.ReadUInt32();
                this.fcPlcfendRef    = reader.ReadUInt32();
                this.lcbPlcfendRef   = reader.ReadUInt32();
                this.fcPlcfendTxt    = reader.ReadUInt32();
                this.lcbPlcfendTxt   = reader.ReadUInt32();
                this.fcPlcfFldEdn    = reader.ReadUInt32();
                this.lcbPlcfFldEdn   = reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                this.fcDggInfo           = reader.ReadUInt32();
                this.lcbDggInfo          = reader.ReadUInt32();
                this.fcSttbfRMark        = reader.ReadUInt32();
                this.lcbSttbfRMark       = reader.ReadUInt32();
                this.fcSttbfCaption      = reader.ReadUInt32();
                this.lcbSttbfCaption     = reader.ReadUInt32();
                this.fcSttbfAutoCaption  = reader.ReadUInt32();
                this.lcbSttbfAutoCaption = reader.ReadUInt32();
                this.fcPlcfWkb           = reader.ReadUInt32();
                this.lcbPlcfWkb          = reader.ReadUInt32();
                this.fcPlcfSpl           = reader.ReadUInt32();
                this.lcbPlcfSpl          = reader.ReadUInt32();
                this.fcPlcftxbxTxt       = reader.ReadUInt32();
                this.lcbPlcftxbxTxt      = reader.ReadUInt32();
                this.fcPlcfFldTxbx       = reader.ReadUInt32();
                this.lcbPlcfFldTxbx      = reader.ReadUInt32();
                this.fcPlcfHdrtxbxTxt    = reader.ReadUInt32();
                this.lcbPlcfHdrtxbxTxt   = reader.ReadUInt32();
                this.fcPlcffldHdrTxbx    = reader.ReadUInt32();
                this.lcbPlcffldHdrTxbx   = reader.ReadUInt32();
                this.fcStwUser           = reader.ReadUInt32();
                this.lcbStwUser          = reader.ReadUInt32();
                this.fcSttbTtmbd         = reader.ReadUInt32();
                this.lcbSttbTtmbd        = reader.ReadUInt32();
                this.fcCookieData        = reader.ReadUInt32();
                this.lcbCookieData       = reader.ReadUInt32();
                this.fcPgdMotherOldOld   = reader.ReadUInt32();
                this.lcbPgdMotherOldOld  = reader.ReadUInt32();
                this.fcBkdMotherOldOld   = reader.ReadUInt32();
                this.lcbBkdMotherOldOld  = reader.ReadUInt32();
                this.fcPgdFtnOldOld      = reader.ReadUInt32();
                this.lcbPgdFtnOldOld     = reader.ReadUInt32();
                this.fcBkdFtnOldOld      = reader.ReadUInt32();
                this.lcbBkdFtnOldOld     = reader.ReadUInt32();
                this.fcPgdEdnOldOld      = reader.ReadUInt32();
                this.lcbPgdEdnOldOld     = reader.ReadUInt32();
                this.fcBkdEdnOldOld      = reader.ReadUInt32();
                this.lcbBkdEdnOldOld     = reader.ReadUInt32();
                this.fcSttbfIntlFld      = reader.ReadUInt32();
                this.lcbSttbfIntlFld     = reader.ReadUInt32();
                this.fcRouteSlip         = reader.ReadUInt32();
                this.lcbRouteSlip        = reader.ReadUInt32();
                this.fcSttbSavedBy       = reader.ReadUInt32();
                this.lcbSttbSavedBy      = reader.ReadUInt32();
                this.fcSttbFnm           = reader.ReadUInt32();
                this.lcbSttbFnm          = reader.ReadUInt32();
                this.fcPlfLst            = reader.ReadUInt32();
                this.lcbPlfLst           = reader.ReadUInt32();
                this.fcPlfLfo            = reader.ReadUInt32();
                this.lcbPlfLfo           = reader.ReadUInt32();
                this.fcPlcfTxbxBkd       = reader.ReadUInt32();
                this.lcbPlcfTxbxBkd      = reader.ReadUInt32();
                this.fcPlcfTxbxHdrBkd    = reader.ReadUInt32();
                this.lcbPlcfTxbxHdrBkd   = reader.ReadUInt32();
                this.fcDocUndoWord9      = reader.ReadUInt32();
                this.lcbDocUndoWord9     = reader.ReadUInt32();
                this.fcRgbUse            = reader.ReadUInt32();
                this.lcbRgbUse           = reader.ReadUInt32();
                this.fcUsp            = reader.ReadUInt32();
                this.lcbUsp           = reader.ReadUInt32();
                this.fcUskf           = reader.ReadUInt32();
                this.lcbUskf          = reader.ReadUInt32();
                this.fcPlcupcRgbUse   = reader.ReadUInt32();
                this.lcbPlcupcRgbUse  = reader.ReadUInt32();
                this.fcPlcupcUsp      = reader.ReadUInt32();
                this.lcbPlcupcUsp     = reader.ReadUInt32();
                this.fcSttbGlsyStyle  = reader.ReadUInt32();
                this.lcbSttbGlsyStyle = reader.ReadUInt32();
                this.fcPlgosl         = reader.ReadUInt32();
                this.lcbPlgosl        = reader.ReadUInt32();
                this.fcPlcocx         = reader.ReadUInt32();
                this.lcbPlcocx        = reader.ReadUInt32();
                this.fcPlcfBteLvc     = reader.ReadUInt32();
                this.lcbPlcfBteLvc    = reader.ReadUInt32();
                this.dwLowDateTime    = reader.ReadUInt32();
                this.dwHighDateTime   = reader.ReadUInt32();
                this.fcPlcfLvcPre10   = reader.ReadUInt32();
                this.lcbPlcfLvcPre10  = reader.ReadUInt32();
                this.fcPlcfAsumy      = reader.ReadUInt32();
                this.lcbPlcfAsumy     = reader.ReadUInt32();
                this.fcPlcfGram       = reader.ReadUInt32();
                this.lcbPlcfGram      = reader.ReadUInt32();
                this.fcSttbListNames  = reader.ReadUInt32();
                this.lcbSttbListNames = reader.ReadUInt32();
                this.fcSttbfUssr      = reader.ReadUInt32();
                this.lcbSttbfUssr     = reader.ReadUInt32();
            }
            if (this.nFib >= FibVersion.Fib2000)
            {
                //Read also the FibRgFcLcb2000
                this.fcPlcfTch        = reader.ReadUInt32();
                this.lcbPlcfTch       = reader.ReadUInt32();
                this.fcRmdThreading   = reader.ReadUInt32();
                this.lcbRmdThreading  = reader.ReadUInt32();
                this.fcMid            = reader.ReadUInt32();
                this.lcbMid           = reader.ReadUInt32();
                this.fcSttbRgtplc     = reader.ReadUInt32();
                this.lcbSttbRgtplc    = reader.ReadUInt32();
                this.fcMsoEnvelope    = reader.ReadUInt32();
                this.lcbMsoEnvelope   = reader.ReadUInt32();
                this.fcPlcfLad        = reader.ReadUInt32();
                this.lcbPlcfLad       = reader.ReadUInt32();
                this.fcRgDofr         = reader.ReadUInt32();
                this.lcbRgDofr        = reader.ReadUInt32();
                this.fcPlcosl         = reader.ReadUInt32();
                this.lcbPlcosl        = reader.ReadUInt32();
                this.fcPlcfCookieOld  = reader.ReadUInt32();
                this.lcbPlcfCookieOld = reader.ReadUInt32();
                this.fcPgdMotherOld   = reader.ReadUInt32();
                this.lcbPgdMotherOld  = reader.ReadUInt32();
                this.fcBkdMotherOld   = reader.ReadUInt32();
                this.lcbBkdMotherOld  = reader.ReadUInt32();
                this.fcPgdFtnOld      = reader.ReadUInt32();
                this.lcbPgdFtnOld     = reader.ReadUInt32();
                this.fcBkdFtnOld      = reader.ReadUInt32();
                this.lcbBkdFtnOld     = reader.ReadUInt32();
                this.fcPgdEdnOld      = reader.ReadUInt32();
                this.lcbPgdEdnOld     = reader.ReadUInt32();
                this.fcBkdEdnOld      = reader.ReadUInt32();
                this.lcbBkdEdnOld     = reader.ReadUInt32();
            }
            if (this.nFib >= FibVersion.Fib2002)
            {
                //Read also the fibRgFcLcb2002
                reader.ReadUInt32();
                reader.ReadUInt32();
                this.fcPlcfPgp             = reader.ReadUInt32();
                this.lcbPlcfPgp            = reader.ReadUInt32();
                this.fcPlcfuim             = reader.ReadUInt32();
                this.lcbPlcfuim            = reader.ReadUInt32();
                this.fcPlfguidUim          = reader.ReadUInt32();
                this.lcbPlfguidUim         = reader.ReadUInt32();
                this.fcAtrdExtra           = reader.ReadUInt32();
                this.lcbAtrdExtra          = reader.ReadUInt32();
                this.fcPlrsid              = reader.ReadUInt32();
                this.lcbPlrsid             = reader.ReadUInt32();
                this.fcSttbfBkmkFactoid    = reader.ReadUInt32();
                this.lcbSttbfBkmkFactoid   = reader.ReadUInt32();
                this.fcPlcfBkfFactoid      = reader.ReadUInt32();
                this.lcbPlcfBkfFactoid     = reader.ReadUInt32();
                this.fcPlcfcookie          = reader.ReadUInt32();
                this.lcbPlcfcookie         = reader.ReadUInt32();
                this.fcPlcfBklFactoid      = reader.ReadUInt32();
                this.lcbPlcfBklFactoid     = reader.ReadUInt32();
                this.fcFactoidData         = reader.ReadUInt32();
                this.lcbFactoidData        = reader.ReadUInt32();
                this.fcDocUndo             = reader.ReadUInt32();
                this.lcbDocUndo            = reader.ReadUInt32();
                this.fcSttbfBkmkFcc        = reader.ReadUInt32();
                this.lcbSttbfBkmkFcc       = reader.ReadUInt32();
                this.fcPlcfBkfFcc          = reader.ReadUInt32();
                this.lcbPlcfBkfFcc         = reader.ReadUInt32();
                this.fcPlcfBklFcc          = reader.ReadUInt32();
                this.lcbPlcfBklFcc         = reader.ReadUInt32();
                this.fcSttbfbkmkBPRepairs  = reader.ReadUInt32();
                this.lcbSttbfbkmkBPRepairs = reader.ReadUInt32();
                this.fcPlcfbkfBPRepairs    = reader.ReadUInt32();
                this.lcbPlcfbkfBPRepairs   = reader.ReadUInt32();
                this.fcPlcfbklBPRepairs    = reader.ReadUInt32();
                this.lcbPlcfbklBPRepairs   = reader.ReadUInt32();
                this.fcPmsNew              = reader.ReadUInt32();
                this.lcbPmsNew             = reader.ReadUInt32();
                this.fcODSO            = reader.ReadUInt32();
                this.lcbODSO           = reader.ReadUInt32();
                this.fcPlcfpmiOldXP    = reader.ReadUInt32();
                this.lcbPlcfpmiOldXP   = reader.ReadUInt32();
                this.fcPlcfpmiNewXP    = reader.ReadUInt32();
                this.lcbPlcfpmiNewXP   = reader.ReadUInt32();
                this.fcPlcfpmiMixedXP  = reader.ReadUInt32();
                this.lcbPlcfpmiMixedXP = reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                this.fcPlcffactoid     = reader.ReadUInt32();
                this.lcbPlcffactoid    = reader.ReadUInt32();
                this.fcPlcflvcOldXP    = reader.ReadUInt32();
                this.lcbPlcflvcOldXP   = reader.ReadUInt32();
                this.fcPlcflvcNewXP    = reader.ReadUInt32();
                this.lcbPlcflvcNewXP   = reader.ReadUInt32();
                this.fcPlcflvcMixedXP  = reader.ReadUInt32();
                this.lcbPlcflvcMixedXP = reader.ReadUInt32();
            }
            if (this.nFib >= FibVersion.Fib2003)
            {
                //Read also the fibRgFcLcb2003
                this.fcHplxsdr        = reader.ReadUInt32();
                this.lcbHplxsdr       = reader.ReadUInt32();
                this.fcSttbfBkmkSdt   = reader.ReadUInt32();
                this.lcbSttbfBkmkSdt  = reader.ReadUInt32();
                this.fcPlcfBkfSdt     = reader.ReadUInt32();
                this.lcbPlcfBkfSdt    = reader.ReadUInt32();
                this.fcPlcfBklSdt     = reader.ReadUInt32();
                this.lcbPlcfBklSdt    = reader.ReadUInt32();
                this.fcCustomXForm    = reader.ReadUInt32();
                this.lcbCustomXForm   = reader.ReadUInt32();
                this.fcSttbfBkmkProt  = reader.ReadUInt32();
                this.lcbSttbfBkmkProt = reader.ReadUInt32();
                this.fcPlcfBkfProt    = reader.ReadUInt32();
                this.lcbPlcfBkfProt   = reader.ReadUInt32();
                this.fcPlcfBklProt    = reader.ReadUInt32();
                this.lcbPlcfBklProt   = reader.ReadUInt32();
                this.fcSttbProtUser   = reader.ReadUInt32();
                this.lcbSttbProtUser  = reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                this.fcPlcfpmiOld        = reader.ReadUInt32();
                this.lcbPlcfpmiOld       = reader.ReadUInt32();
                this.fcPlcfpmiOldInline  = reader.ReadUInt32();
                this.lcbPlcfpmiOldInline = reader.ReadUInt32();
                this.fcPlcfpmiNew        = reader.ReadUInt32();
                this.lcbPlcfpmiNew       = reader.ReadUInt32();
                this.fcPlcfpmiNewInline  = reader.ReadUInt32();
                this.lcbPlcfpmiNewInline = reader.ReadUInt32();
                this.fcPlcflvcOld        = reader.ReadUInt32();
                this.lcbPlcflvcOld       = reader.ReadUInt32();
                this.fcPlcflvcOldInline  = reader.ReadUInt32();
                this.lcbPlcflvcOldInline = reader.ReadUInt32();
                this.fcPlcflvcNew        = reader.ReadUInt32();
                this.lcbPlcflvcNew       = reader.ReadUInt32();
                this.fcPlcflvcNewInline  = reader.ReadUInt32();
                this.lcbPlcflvcNewInline = reader.ReadUInt32();
                this.fcPgdMother         = reader.ReadUInt32();
                this.lcbPgdMother        = reader.ReadUInt32();
                this.fcBkdMother         = reader.ReadUInt32();
                this.lcbBkdMother        = reader.ReadUInt32();
                this.fcAfdMother         = reader.ReadUInt32();
                this.lcbAfdMother        = reader.ReadUInt32();
                this.fcPgdFtn            = reader.ReadUInt32();
                this.lcbPgdFtn           = reader.ReadUInt32();
                this.fcBkdFtn            = reader.ReadUInt32();
                this.lcbBkdFtn           = reader.ReadUInt32();
                this.fcAfdFtn            = reader.ReadUInt32();
                this.lcbAfdFtn           = reader.ReadUInt32();
                this.fcPgdEdn            = reader.ReadUInt32();
                this.lcbPgdEdn           = reader.ReadUInt32();
                this.fcBkdEdn            = reader.ReadUInt32();
                this.lcbBkdEdn           = reader.ReadUInt32();
                this.fcAfdEdn            = reader.ReadUInt32();
                this.lcbAfdEdn           = reader.ReadUInt32();
                this.fcAfd  = reader.ReadUInt32();
                this.lcbAfd = reader.ReadUInt32();
            }
            if (this.nFib >= FibVersion.Fib2007)
            {
                //Read also the fibRgFcLcb2007
                this.fcPlcfmthd           = reader.ReadUInt32();
                this.lcbPlcfmthd          = reader.ReadUInt32();
                this.fcSttbfBkmkMoveFrom  = reader.ReadUInt32();
                this.lcbSttbfBkmkMoveFrom = reader.ReadUInt32();
                this.fcPlcfBkfMoveFrom    = reader.ReadUInt32();
                this.lcbPlcfBkfMoveFrom   = reader.ReadUInt32();
                this.fcPlcfBklMoveFrom    = reader.ReadUInt32();
                this.lcbPlcfBklMoveFrom   = reader.ReadUInt32();
                this.fcSttbfBkmkMoveTo    = reader.ReadUInt32();
                this.lcbSttbfBkmkMoveTo   = reader.ReadUInt32();
                this.fcPlcfBkfMoveTo      = reader.ReadUInt32();
                this.lcbPlcfBkfMoveTo     = reader.ReadUInt32();
                this.fcPlcfBklMoveTo      = reader.ReadUInt32();
                this.lcbPlcfBklMoveTo     = reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                this.fcSttbfBkmkArto  = reader.ReadUInt32();
                this.lcbSttbfBkmkArto = reader.ReadUInt32();
                this.fcPlcfBkfArto    = reader.ReadUInt32();
                this.lcbPlcfBkfArto   = reader.ReadUInt32();
                this.fcPlcfBklArto    = reader.ReadUInt32();
                this.lcbPlcfBklArto   = reader.ReadUInt32();
                this.fcArtoData       = reader.ReadUInt32();
                this.lcbArtoData      = reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                this.fcOssTheme            = reader.ReadUInt32();
                this.lcbOssTheme           = reader.ReadUInt32();
                this.fcColorSchemeMapping  = reader.ReadUInt32();
                this.lcbColorSchemeMapping = reader.ReadUInt32();
            }

            this.cswNew = reader.ReadUInt16();

            if (this.cswNew != 0)
            {
                //Read the FibRgCswNew
                this.nFibNew        = (FibVersion)reader.ReadUInt16();
                this.cQuickSavesNew = reader.ReadUInt16();
            }
        }
Пример #15
0
        public ToolbarControl(VirtualStreamReader reader)
            : base(reader, ByteStructure.VARIABLE_LENGTH)
        {
            //HEADER START

            this.bSignature = reader.ReadByte();
            this.bVersion   = reader.ReadByte();

            int bFlagsTCR = (int)reader.ReadByte();

            this.fHidden      = Utils.BitmaskToBool(bFlagsTCR, 0x01);
            this.fBeginGroup  = Utils.BitmaskToBool(bFlagsTCR, 0x02);
            this.fOwnLine     = Utils.BitmaskToBool(bFlagsTCR, 0x04);
            this.fNoCustomize = Utils.BitmaskToBool(bFlagsTCR, 0x08);
            this.fSaveDxy     = Utils.BitmaskToBool(bFlagsTCR, 0x10);
            this.fBeginLine   = Utils.BitmaskToBool(bFlagsTCR, 0x40);

            this.tct       = (ToolbarControlType)reader.ReadByte();
            this.tcid      = reader.ReadInt16();
            this.tbct      = reader.ReadInt32();
            this.bPriority = reader.ReadByte();

            if (this.fSaveDxy)
            {
                this.width  = reader.ReadUInt16();
                this.height = reader.ReadUInt16();
            }

            //HEADER END

            //cid
            if (this.tcid != 0x01 && this.tcid != 0x1051)
            {
                this.cid = reader.ReadBytes(4);
            }

            //DATA START

            if (this.tct != ToolbarControlType.ActiveX)
            {
                //general control info
                byte flags = reader.ReadByte();
                this.fSaveText          = Utils.BitmaskToBool((int)flags, 0x01);
                this.fSaveMiscUIStrings = Utils.BitmaskToBool((int)flags, 0x02);
                this.fSaveMiscCustom    = Utils.BitmaskToBool((int)flags, 0x04);
                this.fDisabled          = Utils.BitmaskToBool((int)flags, 0x04);

                if (this.fSaveText)
                {
                    this.customText = Utils.ReadWString(reader.BaseStream);
                }
                if (this.fSaveMiscUIStrings)
                {
                    this.descriptionText = Utils.ReadWString(reader.BaseStream);
                    this.tooltip         = Utils.ReadWString(reader.BaseStream);
                }
                if (this.fSaveMiscCustom)
                {
                    this.helpFile      = Utils.ReadWString(reader.BaseStream);
                    this.idHelpContext = reader.ReadInt32();
                    this.tag           = Utils.ReadWString(reader.BaseStream);
                    this.onAction      = Utils.ReadWString(reader.BaseStream);
                    this.param         = Utils.ReadWString(reader.BaseStream);
                    this.tbcu          = reader.ReadByte();
                    this.tbmg          = reader.ReadByte();
                }

                //control specific info
                switch (this.tct)
                {
                case ToolbarControlType.Button:
                case ToolbarControlType.ExpandingGrid:

                    //TBCB Specific
                    int  bFlags         = (int)reader.ReadByte();
                    int  state          = Utils.BitmaskToInt(bFlags, 0x03);
                    bool fAccelerator   = Utils.BitmaskToBool(bFlags, 0x04);
                    bool fCustomBitmap  = Utils.BitmaskToBool(bFlags, 0x08);
                    bool fCustomBtnFace = Utils.BitmaskToBool(bFlags, 0x10);
                    bool fHyperlinkType = Utils.BitmaskToBool(bFlags, 0x20);
                    if (fCustomBitmap)
                    {
                        ToolbarControlBitmap icon     = new ToolbarControlBitmap(reader);
                        ToolbarControlBitmap iconMask = new ToolbarControlBitmap(reader);
                    }
                    if (fCustomBtnFace)
                    {
                        UInt16 iBtnFace = reader.ReadUInt16();
                    }
                    if (fAccelerator)
                    {
                        string wstrAcc = Utils.ReadWString(reader.BaseStream);
                    }

                    break;

                case ToolbarControlType.Popup:
                case ToolbarControlType.ButtonPopup:
                case ToolbarControlType.SplitButtonPopup:
                case ToolbarControlType.SplitButtonMRUPopup:

                    //TBC Menu Specific
                    Int32  tbid = reader.ReadInt32();
                    string name = Utils.ReadWString(reader.BaseStream);

                    break;

                case ToolbarControlType.Edit:
                case ToolbarControlType.ComboBox:
                case ToolbarControlType.GraphicCombo:
                case ToolbarControlType.Dropdown:
                case ToolbarControlType.SplitDropDown:
                case ToolbarControlType.OCXDropDown:
                case ToolbarControlType.GraphicDropDown:

                    //TBC Combo Dropdown Specific
                    if (this.tcid == 1)
                    {
                        Int16  cwstrItems = reader.ReadInt16();
                        string wstrList   = Utils.ReadWString(reader.BaseStream);
                        Int16  cwstrMRU   = reader.ReadInt16();
                        Int16  iSel       = reader.ReadInt16();
                        Int16  cLines     = reader.ReadInt16();
                        Int16  dxWidth    = reader.ReadInt16();
                        string wstrEdit   = Utils.ReadWString(reader.BaseStream);
                    }

                    break;

                default:
                    //no control Specific Info
                    break;
                }
            }
        }
Пример #16
0
        public CommandTable(FileInformationBlock fib, VirtualStream tableStream)
        {
            tableStream.Seek(fib.fcCmds, System.IO.SeekOrigin.Begin);
            VirtualStreamReader reader = new VirtualStreamReader(tableStream);

            //byte[] bytes = reader.ReadBytes((int)fib.lcbCmds);
            this.MacroDatas    = new List <MacroData>();
            this.KeyMapEntries = new List <KeyMapEntry>();
            this.MacroNames    = new Dictionary <int, string>();

            //skip the version
            reader.ReadByte();

            //parse the commandtable
            while (reader.BaseStream.Position < (fib.fcCmds + fib.lcbCmds) && !breakWhile)
            {
                //read the type
                byte ch = reader.ReadByte();

                switch (ch)
                {
                case 0x1:
                    //it's a PlfMcd
                    int iMacMcd = reader.ReadInt32();
                    for (int i = 0; i < iMacMcd; i++)
                    {
                        this.MacroDatas.Add(new MacroData(reader));
                    }
                    break;

                case 0x2:
                    //it's a PlfAcd
                    //skip the ACDs
                    int iMacAcd = reader.ReadInt32();
                    reader.ReadBytes(iMacAcd * 4);
                    break;

                case 0x3:
                    //Keymap Entries
                    int iMacKme = reader.ReadInt32();
                    for (int i = 0; i < iMacKme; i++)
                    {
                        this.KeyMapEntries.Add(new KeyMapEntry(reader));
                    }
                    break;

                case 0x4:
                    //Keymap Entries
                    int iMacKmeInvalid = reader.ReadInt32();
                    for (int i = 0; i < iMacKmeInvalid; i++)
                    {
                        this.KeyMapEntries.Add(new KeyMapEntry(reader));
                    }
                    break;

                case 0x10:
                    //it's a TcgSttbf
                    this.CommandStringTable = new StringTable(typeof(String), reader);
                    break;

                case 0x11:
                    //it's a MacroNames table
                    int iMacMn = reader.ReadInt16();
                    for (int i = 0; i < iMacMn; i++)
                    {
                        Int16 ibst = reader.ReadInt16();
                        Int16 cch  = reader.ReadInt16();
                        this.MacroNames[ibst] = Encoding.Unicode.GetString(reader.ReadBytes(cch * 2));
                        //skip the terminating zero
                        reader.ReadBytes(2);
                    }
                    break;

                case 0x12:
                    //it's a CTBWRAPPER structure
                    this.CustomToolbars = new CustomToolbarWrapper(reader);
                    break;

                default:
                    breakWhile = true;
                    break;
                }
            }
        }
        private void parse(VirtualStream stream, Int32 fc)
        {
            stream.Seek(fc, System.IO.SeekOrigin.Begin);
            VirtualStreamReader reader = new VirtualStreamReader(stream);

            Int32 lcb = reader.ReadInt32();

            if (lcb > 0)
            {
                UInt16 cbHeader = reader.ReadUInt16();

                this.mfp      = new MetafilePicture();
                this.mfp.mm   = reader.ReadInt16();
                this.mfp.xExt = reader.ReadInt16();
                this.mfp.yExt = reader.ReadInt16();
                this.mfp.hMf  = reader.ReadInt16();

                if (this.mfp.mm > 98)
                {
                    this.rcWinMf = reader.ReadBytes(14);

                    //dimensions
                    this.dxaGoal = reader.ReadInt16();
                    this.dyaGoal = reader.ReadInt16();
                    this.mx      = reader.ReadUInt16();
                    this.my      = reader.ReadUInt16();

                    //cropping
                    this.dxaCropLeft   = reader.ReadInt16();
                    this.dyaCropTop    = reader.ReadInt16();
                    this.dxaCropRight  = reader.ReadInt16();
                    this.dyaCropBottom = reader.ReadInt16();

                    Int16 brcl = reader.ReadInt16();

                    //borders
                    this.brcTop    = new BorderCode(reader.ReadBytes(4));
                    this.brcLeft   = new BorderCode(reader.ReadBytes(4));
                    this.brcBottom = new BorderCode(reader.ReadBytes(4));
                    this.brcRight  = new BorderCode(reader.ReadBytes(4));

                    this.dxaOrigin = reader.ReadInt16();
                    this.dyaOrigin = reader.ReadInt16();
                    this.cProps    = reader.ReadInt16();

                    //Parse the OfficeDrawing Stuff
                    Record r = Record.ReadRecord(reader);
                    if (r is ShapeContainer)
                    {
                        this.ShapeContainer = (ShapeContainer)r;
                        long pos = reader.BaseStream.Position;
                        if (pos < (fc + lcb))
                        {
                            Record rec = Record.ReadRecord(reader);
                            if (rec.GetType() == typeof(BlipStoreEntry))
                            {
                                this.BlipStoreEntry = (BlipStoreEntry)rec;
                            }
                        }
                    }
                }
            }
        }