示例#1
0
        private HeaderRecord ParseHeaderRecord()
        {
            var headerRecord = new HeaderRecord();

            headerRecord.dwVersion   = this.binaryReader.ReadUInt32();
            headerRecord.cjSize      = this.binaryReader.ReadUInt32();
            headerRecord.dpszDocName = this.binaryReader.ReadUInt32();
            headerRecord.dpszOutput  = this.binaryReader.ReadUInt32();

            if (headerRecord.dpszDocName != 0)
            {
                this.binaryReader.BaseStream.Seek(headerRecord.dpszDocName + this._iSplBeginPos, SeekOrigin.Begin);
                var docNameStringBuilder = new StringBuilder();
                while (this.binaryReader.PeekChar() != 0)
                {
                    docNameStringBuilder.Append(this.binaryReader.ReadChar());
                }
                headerRecord.DocName = docNameStringBuilder.ToString();
                _sDocName            = headerRecord.DocName;
            }
            this.Ensure32BitAlignment();
            if (headerRecord.dpszOutput != 0)
            {
                this.binaryReader.BaseStream.Seek(headerRecord.dpszOutput + this._iSplBeginPos, SeekOrigin.Begin);
                var outputDeviceStringBuilder = new StringBuilder();
                while (this.binaryReader.PeekChar() != 0)
                {
                    outputDeviceStringBuilder.Append(this.binaryReader.ReadChar());
                }
                headerRecord.OutputDevice = outputDeviceStringBuilder.ToString();
            }
            this.Ensure32BitAlignment();
            this.EnsurePosition(headerRecord.cjSize);
            this._nHeaderSize = headerRecord.cjSize;
            return(headerRecord);
        }         // ParseHeaderRecord