Beispiel #1
0
 /// <summary>
 /// Create an InputStream from the specified Document
 /// </summary>
 /// <param name="document">the Document to be read</param>
 public POIFSDocumentReader(OPOIFSDocument document)
 {
     this._current_offset = 0;
     this._document_size  = document.Size;
     this._closed         = false;
     this._tiny_buffer    = null;
     this._document       = document;
 }
Beispiel #2
0
 /**
  * Create an InputStream from the specified Document
  *
  * @param document the Document to be read
  */
 public ODocumentInputStream(OPOIFSDocument document)
 {
     _current_offset = 0;
     _marked_offset  = 0;
     _document_size  = document.Size;
     _closed         = false;
     _document       = document;
     _currentBlock   = GetDataInputBlock(0);
 }
Beispiel #3
0
 /// <summary>
 /// Create an InputStream from the specified DocumentEntry
 /// </summary>
 /// <param name="document">the DocumentEntry to be read</param>
 public POIFSDocumentReader(DocumentEntry document)
 {
     this._current_offset = 0;
     this._document_size  = document.Size;
     this._closed         = false;
     this._tiny_buffer    = null;
     if (!(document is DocumentNode))
     {
         throw new IOException("Cannot open internal document storage");
     }
     this._document = ((DocumentNode)document).Document;
 }
Beispiel #4
0
        /// <summary>
        /// Create a new DocumentEntry; the data will be provided later
        /// </summary>
        /// <param name="document">the name of the new documentEntry</param>
        /// <returns>the new DocumentEntry</returns>
        public DocumentEntry CreateDocument(OPOIFSDocument document)
        {
            DocumentProperty property = document.DocumentProperty;
            DocumentNode     rval     = new DocumentNode(property, this);

            ((DirectoryProperty)Property).AddChild(property);
            _oFilesSystem.AddDocument(document);

            _entries.Add(rval);
            _byname.Add(property.Name, rval);

            return(rval);
        }
Beispiel #5
0
        private void ProcessProperties(BlockList small_blocks,
                                       BlockList big_blocks,
                                       IEnumerator properties,
                                       DirectoryNode dir,
                                       int headerPropertiesStartAt)
        {
            while (properties.MoveNext())
            {
                Property      property = ( Property )properties.Current;
                String        name     = property.Name;
                DirectoryNode parent   = (dir == null)
                                         ? (( DirectoryNode )this.Root)
                                         : dir;

                if (property.IsDirectory)
                {
                    DirectoryNode new_dir =
                        ( DirectoryNode )parent.CreateDirectory(name);

                    new_dir.StorageClsid = property.StorageClsid;

                    ProcessProperties(
                        small_blocks, big_blocks,
                        ((DirectoryProperty)property).Children, new_dir, headerPropertiesStartAt);
                }
                else
                {
                    int            startBlock = property.StartBlock;
                    int            size       = property.Size;
                    OPOIFSDocument document   = null;

                    if (property.ShouldUseSmallBlocks)
                    {
                        document =
                            new OPOIFSDocument(name, small_blocks
                                               .FetchBlocks(startBlock, headerPropertiesStartAt), size);
                    }
                    else
                    {
                        document =
                            new OPOIFSDocument(name,
                                               big_blocks.FetchBlocks(startBlock, headerPropertiesStartAt),
                                               size);
                    }
                    parent.CreateDocument(document);
                }
            }
        }
Beispiel #6
0
        /**
         * Create an InputStream from the specified DocumentEntry
         *
         * @param document the DocumentEntry to be read
         *
         * @exception IOException if the DocumentEntry cannot be opened (like, maybe it has
         *                been deleted?)
         */
        public ODocumentInputStream(DocumentEntry document)
        {
            if (!(document is DocumentNode))
            {
                throw new IOException("Cannot open internal document storage");
            }
            DocumentNode documentNode = (DocumentNode)document;

            if (documentNode.Document == null)
            {
                throw new IOException("Cannot open internal document storage");
            }

            _current_offset = 0;
            _marked_offset  = 0;
            _document_size  = document.Size;
            _closed         = false;
            _document       = documentNode.Document;
            _currentBlock   = GetDataInputBlock(0);
        }
Beispiel #7
0
        // <summary>
        // open a document in the root entry's list of entries
        // </summary>
        // <param name="documentName">the name of the document to be opened</param>
        // <returns>a newly opened POIFSDocumentReader</returns>
        //public DocumentReader CreatePOIFSDocumentReader(
        //        String documentName)
        //{
        //    return this.Root.CreatePOIFSDocumentReader(documentName);
        //}

        /// <summary>
        /// Add a new POIFSDocument
        /// </summary>
        /// <param name="document">the POIFSDocument being Added</param>
        public void AddDocument(OPOIFSDocument document)
        {
            _documents.Add(document);
            _property_table.AddProperty(document.DocumentProperty);
        }
Beispiel #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentInputStream"/> class.
 /// Create an <see cref="InputStream"/> from the specified DocumentEntry
 /// </summary>
 /// <param name="document">the DocumentEntry to be read</param>
 public DocumentInputStream(OPOIFSDocument document)
 {
     delegate1 = new ODocumentInputStream(document);
 }
Beispiel #9
0
        /**
         * create a DocumentNode. This method Is not public by design; it
         * Is intended strictly for the internal use of this package
         *
         * @param property the DocumentProperty for this DocumentEntry
         * @param parent the parent of this entry
         */

        public DocumentNode(DocumentProperty property, DirectoryNode parent) : base(property, parent)
        {
            _document = property.Document;
        }