Beispiel #1
0
        /**
         * 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)
        {
            _filesystem = filesystem;
            // sotre it
            int length = Store(stream);

            // Build the property for it
            _property            = new DocumentProperty(name, length);
            _property.StartBlock = _stream.GetStartBlock();
        }
Beispiel #2
0
        public NPOIFSMiniStore(NPOIFSFileSystem filesystem, RootProperty root,
                               List <BATBlock> sbats, HeaderBlock header)
        {
            _filesystem  = filesystem;
            _sbat_blocks = sbats;
            _header      = header;
            _root        = root;

            _mini_stream = new NPOIFSStream(filesystem, root.StartBlock);
        }
Beispiel #3
0
        /**
         * Constructor for an existing Document
         */

        public NPOIFSDocument(DocumentProperty property, NPOIFSFileSystem filesystem)
        {
            _property   = property;
            _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();
            }
        }
Beispiel #4
0
        private DirectoryNode(DirectoryProperty property,
                              DirectoryNode parent,
                              POIFSFileSystem oFileSystem,
                              NPOIFSFileSystem nFileSystem)
            : base(property, parent)
        {
            _oFilesSystem = oFileSystem;
            _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);
            }
        }
Beispiel #5
0
 /// <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)
 {
 }