public NPropertyTable(HeaderBlock headerBlock, NPOIFSFileSystem fileSystem) :base(headerBlock, BuildProperties( (new NPOIFSStream(fileSystem, headerBlock.PropertyStart)).GetEnumerator(),headerBlock.BigBlockSize) ) { _bigBigBlockSize = headerBlock.BigBlockSize; }
public NPOIFSMiniStore(NPOIFSFileSystem filesystem, RootProperty root, List <BATBlock> sbats, HeaderBlock header) { this._filesystem = filesystem; this._sbat_blocks = sbats; this._header = header; this._root = root; this._mini_stream = new NPOIFSStream(filesystem, root.StartBlock); }
public NPOIFSMiniStore(NPOIFSFileSystem filesystem, RootProperty root, List<BATBlock> sbats, HeaderBlock header) { this._filesystem = filesystem; this._sbat_blocks = sbats; this._header = header; this._root = root; this._mini_stream = new NPOIFSStream(filesystem, root.StartBlock); }
/** * Constructor for an existing Document */ public NPOIFSDocument(DocumentProperty property, NPOIFSFileSystem filesystem) { this._property = property; this._filesystem = filesystem; if (property.Size < POIFSConstants.BIG_BLOCK_MINIMUM_DOCUMENT_SIZE) { _stream = new NPOIFSStream(_filesystem.GetMiniStore(), property.StartBlock); _block_size = _filesystem.GetMiniStore().GetBlockStoreBlockSize(); } else { _stream = new NPOIFSStream(_filesystem, property.StartBlock); _block_size = _filesystem.GetBlockStoreBlockSize(); } }
/** * Constructor for an existing Document */ public NPOIFSDocument(DocumentProperty property, NPOIFSFileSystem filesystem) { this._property = property; this._filesystem = filesystem; if (property.Size < POIFSConstants.BIG_BLOCK_MINIMUM_DOCUMENT_SIZE) { _stream = new NPOIFSStream(_filesystem.GetMiniStore(), property.StartBlock); _block_size = _filesystem.GetMiniStore().GetBlockStoreBlockSize(); } else { _stream = new NPOIFSStream(_filesystem, property.StartBlock); _block_size = _filesystem.GetBlockStoreBlockSize(); } }
private DirectoryNode(DirectoryProperty property, DirectoryNode parent, POIFSFileSystem oFileSystem, NPOIFSFileSystem nFileSystem) : base(property, parent) { this._oFilesSystem = oFileSystem; this._nFilesSystem = nFileSystem; if (parent == null) { _path = new POIFSDocumentPath(); } else { _path = new POIFSDocumentPath(parent._path, new string[] { property.Name }); } _byname = new Dictionary <string, Entry>(); _entries = new List <Entry>(); IEnumerator <Property> iter = property.Children; while (iter.MoveNext()) { Property child = iter.Current; Entry childNode = null; if (child.IsDirectory) { DirectoryProperty childDir = (DirectoryProperty)child; if (_oFilesSystem != null) { childNode = new DirectoryNode(childDir, _oFilesSystem, this); } else { childNode = new DirectoryNode(childDir, _nFilesSystem, this); } } else { childNode = new DocumentNode((DocumentProperty)child, this); } _entries.Add(childNode); _byname.Add(childNode.Name, childNode); } }
/** * Constructor for a new Document * * @param name the name of the POIFSDocument * @param stream the InputStream we read data from */ public NPOIFSDocument(String name, NPOIFSFileSystem filesystem, Stream stream) { this._filesystem = filesystem; // Buffer the contents into memory. This is a bit icky... // TODO Replace with a buffer up to the mini stream size, then streaming write byte[] contents; if (stream is MemoryStream) { MemoryStream bais = (MemoryStream)stream; contents = new byte[bais.Length]; bais.Read(contents, 0, contents.Length); } else { MemoryStream baos = new MemoryStream(); IOUtils.Copy(stream, baos); contents = baos.ToArray(); } // Do we need to store as a mini stream or a full one? if (contents.Length <= POIFSConstants.BIG_BLOCK_MINIMUM_DOCUMENT_SIZE) { _stream = new NPOIFSStream(filesystem.GetMiniStore()); _block_size = _filesystem.GetMiniStore().GetBlockStoreBlockSize(); } else { _stream = new NPOIFSStream(filesystem); _block_size = _filesystem.GetBlockStoreBlockSize(); } // Store it _stream.UpdateContents(contents); // And build the property for it this._property = new DocumentProperty(name, contents.Length); _property.StartBlock = _stream.GetStartBlock(); }
/** * Constructor for a new Document * * @param name the name of the POIFSDocument * @param stream the InputStream we read data from */ public NPOIFSDocument(String name, NPOIFSFileSystem filesystem, Stream stream) { this._filesystem = filesystem; // Buffer the contents into memory. This is a bit icky... // TODO Replace with a buffer up to the mini stream size, then streaming write byte[] contents; if (stream is MemoryStream) { MemoryStream bais = (MemoryStream)stream; contents = new byte[bais.Length]; bais.Read(contents, 0, contents.Length); } else { MemoryStream baos = new MemoryStream(); IOUtils.Copy(stream, baos); contents = baos.ToArray(); } // Do we need to store as a mini stream or a full one? if (contents.Length <= POIFSConstants.BIG_BLOCK_MINIMUM_DOCUMENT_SIZE) { _stream = new NPOIFSStream(filesystem.GetMiniStore()); _block_size = _filesystem.GetMiniStore().GetBlockStoreBlockSize(); } else { _stream = new NPOIFSStream(filesystem); _block_size = _filesystem.GetBlockStoreBlockSize(); } // Store it _stream.UpdateContents(contents); // And build the property for it this._property = new DocumentProperty(name, contents.Length); _property.StartBlock = _stream.GetStartBlock(); }
/// <summary> /// Create a DirectoryNode. This method Is not public by design; it /// Is intended strictly for the internal use of this package /// </summary> /// <param name="property">the DirectoryProperty for this DirectoryEntry</param> /// <param name="nFileSystem">the POIFSFileSystem we belong to</param> /// <param name="parent">the parent of this entry</param> public DirectoryNode(DirectoryProperty property, NPOIFSFileSystem nFileSystem, DirectoryNode parent) : this(property, parent, (POIFSFileSystem)null, nFileSystem) { }
public Stream GetDataStream(NPOIFSFileSystem fs) { return GetDataStream(fs.Root); }
public EncryptionInfo(NPOIFSFileSystem fs) : this(fs.Root) { }