/// <summary> /// Initializes a new instance of the <see cref="POIFSDocument"/> class. /// </summary> /// <param name="name">the name of the POIFSDocument</param> /// <param name="stream">the InputStream we read data from</param> public POIFSDocument(string name, Stream stream) { DocumentBlock block; IList list = new ArrayList(); this._size = 0; do { block = new DocumentBlock(stream); int size = block.Size; if (size > 0) { list.Add(block); this._size += size; } }while (!block.PartiallyRead); DocumentBlock[] blocks = (DocumentBlock[])((ArrayList)list).ToArray(typeof(DocumentBlock)); this._big_store = new BigBlockStore(this, blocks); this._property = new DocumentProperty(name, this._size); this._property.Document = this; if (this._property.ShouldUseSmallBlocks) { this._small_store = new SmallBlockStore(this, SmallDocumentBlock.Convert(blocks, this._size)); this._big_store = new BigBlockStore(this, new DocumentBlock[0]); } else { this._small_store = new SmallBlockStore(this, new BlockWritable[0]); } }
/// <summary> /// Initializes a new instance of the <see cref="POIFSDocument"/> class. /// </summary> /// <param name="name">the name of the POIFSDocument</param> /// <param name="stream">the InputStream we read data from</param> public POIFSDocument(string name, Stream stream) { DocumentBlock block; IList list = new ArrayList(); this._size = 0; do { block = new DocumentBlock(stream); int size = block.Size; if (size > 0) { list.Add(block); this._size += size; } } while (!block.PartiallyRead); DocumentBlock[] blocks = (DocumentBlock[])((ArrayList)list).ToArray(typeof(DocumentBlock)); this._big_store = new BigBlockStore(this, blocks); this._property = new DocumentProperty(name, this._size); this._property.Document = this; if (this._property.ShouldUseSmallBlocks) { this._small_store = new SmallBlockStore(this, SmallDocumentBlock.Convert(blocks, this._size)); this._big_store = new BigBlockStore(this, new DocumentBlock[0]); } else { this._small_store = new SmallBlockStore(this, new BlockWritable[0]); } }
/// <summary> /// Constructor from large blocks /// </summary> /// <param name="name">the name of the POIFSDocument</param> /// <param name="blocks">the big blocks making up the POIFSDocument</param> /// <param name="length">the actual length of the POIFSDocument</param> public POIFSDocument(string name, RawDataBlock[] blocks, int length) { this._size = length; this._big_store = new BigBlockStore(this, blocks); this._property = new DocumentProperty(name, this._size); this._small_store = new SmallBlockStore(this, new BlockWritable[0]); this._property.Document = this; }
/// <summary> /// Constructor from small blocks /// </summary> /// <param name="name">the name of the POIFSDocument</param> /// <param name="blocks">Tthe small blocks making up the POIFSDocument</param> /// <param name="length">the actual length of the POIFSDocument</param> public POIFSDocument(string name, SmallDocumentBlock[] blocks, int length) { this._size = length; try { this._big_store = new BigBlockStore(this, new RawDataBlock[0]); } catch (IOException) { } this._property = new DocumentProperty(name, this._size); this._small_store = new SmallBlockStore(this, blocks); this._property.Document = this; }
public POIFSDocument(string name, RawDataBlock[] blocks, int length) { _size = length; if (blocks.Length == 0) _bigBigBlockSize = POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS; else { _bigBigBlockSize = (blocks[0].BigBlockSize == POIFSConstants.SMALLER_BIG_BLOCK_SIZE ? POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS : POIFSConstants.LARGER_BIG_BLOCK_SIZE_DETAILS); } _big_store = new BigBlockStore(_bigBigBlockSize, ConvertRawBlocksToBigBlocks(blocks)); _property = new DocumentProperty(name, _size); _small_store = new SmallBlockStore(_bigBigBlockSize, EMPTY_SMALL_BLOCK_ARRAY); _property.Document = this; }
/// <summary> /// Initializes a new instance of the <see cref="POIFSDocument"/> class. /// </summary> /// <param name="name">the name of the POIFSDocument</param> /// <param name="size">the length of the POIFSDocument</param> /// <param name="path">the path of the POIFSDocument</param> public POIFSDocument(string name, int size, POIFSDocumentPath path) { this._size = size; this._property = new DocumentProperty(name, this._size); this._property.Document = this; if (this._property.ShouldUseSmallBlocks) { this._small_store = new SmallBlockStore(this, path, name, size); this._big_store = new BigBlockStore(this, new object[0]); } else { this._small_store = new SmallBlockStore(this, new BlockWritable[0]); this._big_store = new BigBlockStore(this, path, name, size); } }
/// <summary> /// Constructor from small blocks /// </summary> /// <param name="name">the name of the POIFSDocument</param> /// <param name="blocks">the small blocks making up the POIFSDocument</param> /// <param name="length">the actual length of the POIFSDocument</param> public POIFSDocument(string name, ListManagedBlock[] blocks, int length) { this._size = length; this._property = new DocumentProperty(name, this._size); this._property.Document = this; if (Property.IsSmall(this._size)) { this._big_store = new BigBlockStore(this, new RawDataBlock[0]); this._small_store = new SmallBlockStore(this, blocks); } else { this._big_store = new BigBlockStore(this, blocks); this._small_store = new SmallBlockStore(this, new BlockWritable[0]); } }
public POIFSDocument(string name, int size, POIFSBigBlockSize bigBlockSize, POIFSDocumentPath path, POIFSWriterListener writer) { _size = size; _bigBigBlockSize = bigBlockSize; _property = new DocumentProperty(name, _size); _property.Document = this; if (_property.ShouldUseSmallBlocks) { _small_store = new SmallBlockStore(_bigBigBlockSize, path, name, size, writer); _big_store = new BigBlockStore(_bigBigBlockSize, EMPTY_BIG_BLOCK_ARRAY); } else { _small_store = new SmallBlockStore(_bigBigBlockSize, EMPTY_SMALL_BLOCK_ARRAY); _big_store = new BigBlockStore(_bigBigBlockSize, path, name, size, writer); } }
public POIFSDocument(string name, SmallDocumentBlock[] blocks, int length) { _size = length; if (blocks.Length == 0) { _bigBigBlockSize = POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS; } else { _bigBigBlockSize = blocks[0].BigBlockSize; } _big_store = new BigBlockStore(_bigBigBlockSize, EMPTY_BIG_BLOCK_ARRAY); _property = new DocumentProperty(name, _size); _small_store = new SmallBlockStore(_bigBigBlockSize, blocks); _property.Document = this; }
public POIFSDocument(string name, POIFSBigBlockSize bigBlockSize, ListManagedBlock[] blocks, int length) { _size = length; _bigBigBlockSize = bigBlockSize; _property = new DocumentProperty(name, _size); _property.Document = this; if (Property.IsSmall(_size)) { _big_store = new BigBlockStore(bigBlockSize, EMPTY_BIG_BLOCK_ARRAY); _small_store = new SmallBlockStore(bigBlockSize, ConvertRawBlocksToSmallBlocks(blocks)); } else { _big_store = new BigBlockStore(bigBlockSize, ConvertRawBlocksToBigBlocks(blocks)); _small_store = new SmallBlockStore(bigBlockSize, EMPTY_SMALL_BLOCK_ARRAY); } }
public POIFSDocument(string name, RawDataBlock[] blocks, int length) { _size = length; if (blocks.Length == 0) { _bigBigBlockSize = POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS; } else { _bigBigBlockSize = (blocks[0].BigBlockSize == POIFSConstants.SMALLER_BIG_BLOCK_SIZE ? POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS : POIFSConstants.LARGER_BIG_BLOCK_SIZE_DETAILS); } _big_store = new BigBlockStore(_bigBigBlockSize, ConvertRawBlocksToBigBlocks(blocks)); _property = new DocumentProperty(name, _size); _small_store = new SmallBlockStore(_bigBigBlockSize, EMPTY_SMALL_BLOCK_ARRAY); _property.Document = this; }
public POIFSDocument(string name, POIFSBigBlockSize bigBlockSize, Stream stream) { List <DocumentBlock> blocks = new List <DocumentBlock>(); _size = 0; _bigBigBlockSize = bigBlockSize; while (true) { DocumentBlock block = new DocumentBlock(stream, bigBlockSize); int blockSize = block.Size; if (blockSize > 0) { blocks.Add(block); _size += blockSize; } if (block.PartiallyRead) { break; } } DocumentBlock[] bigBlocks = blocks.ToArray(); _big_store = new BigBlockStore(bigBlockSize, bigBlocks); _property = new DocumentProperty(name, _size); _property.Document = this; if (_property.ShouldUseSmallBlocks) { _small_store = new SmallBlockStore(bigBlockSize, SmallDocumentBlock.Convert(bigBlockSize, bigBlocks, _size)); _big_store = new BigBlockStore(bigBlockSize, new DocumentBlock[0]); } else { _small_store = new SmallBlockStore(bigBlockSize, EMPTY_SMALL_BLOCK_ARRAY); } }
public POIFSDocument(string name, POIFSBigBlockSize bigBlockSize, Stream stream) { List<DocumentBlock> blocks = new List<DocumentBlock>(); _size = 0; _bigBigBlockSize = bigBlockSize; while (true) { DocumentBlock block = new DocumentBlock(stream, bigBlockSize); int blockSize = block.Size; if (blockSize > 0) { blocks.Add(block); _size += blockSize; } if (block.PartiallyRead) break; } DocumentBlock[] bigBlocks = blocks.ToArray(); _big_store = new BigBlockStore(bigBlockSize, bigBlocks); _property = new DocumentProperty(name, _size); _property.Document = this; if (_property.ShouldUseSmallBlocks) { _small_store = new SmallBlockStore(bigBlockSize, SmallDocumentBlock.Convert(bigBlockSize, bigBlocks, _size)); _big_store = new BigBlockStore(bigBlockSize, new DocumentBlock[0]); } else { _small_store = new SmallBlockStore(bigBlockSize, EMPTY_SMALL_BLOCK_ARRAY); } }
public void Dispose() { _big_store = null; _property = null; _small_store = null; }
public POIFSDocument(string name, SmallDocumentBlock[] blocks, int length) { _size = length; if(blocks.Length == 0) _bigBigBlockSize = POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS; else _bigBigBlockSize = blocks[0].BigBlockSize; _big_store = new BigBlockStore(_bigBigBlockSize, EMPTY_BIG_BLOCK_ARRAY); _property = new DocumentProperty(name, _size); _small_store = new SmallBlockStore(_bigBigBlockSize, blocks); _property.Document = this; }