private PieceDescriptorCollection GetPieceDescriptors(BinaryReader reader, int offset, uint length) { PieceDescriptorCollection pieceDescriptorCollection = new PieceDescriptorCollection(offset, length); pieceDescriptorCollection.Read(reader); return(pieceDescriptorCollection); }
private bool LoadText(OleStorage storage, out string text) { text = string.Empty; if (storage == null) { return(false); } BinaryReader documentStreamReader = GetDocumentStreamReader(storage); if (documentStreamReader == null) { return(false); } GetDataFromFib(documentStreamReader, out string tableName, out int pdcOffset, out uint pdcLength); BinaryReader tableStreamReader = GetTableStreamReader(storage, tableName); if (tableStreamReader == null) { return(false); } PieceDescriptorCollection pieceDescriptors = GetPieceDescriptors(tableStreamReader, pdcOffset, pdcLength); if (pieceDescriptors == null) { return(false); } int count = pieceDescriptors.Count; for (int i = 0; i < count; i++) { uint start; uint end; bool pieceFileBounds = pieceDescriptors.GetPieceFileBounds(i, out start, out end); documentStreamReader.BaseStream.Seek(start, SeekOrigin.Begin); text += ReadString(documentStreamReader, end - start, pieceFileBounds); } return(true); }