コード例 #1
0
 /// <summary>
 /// Create an InputStream from the specified Document
 /// </summary>
 /// <param name="document">the Document to be read</param>
 public POIFSDocumentReader(POIFSDocument document)
 {
     this._current_offset = 0;
     this._document_size  = document.Size;
     this._closed         = false;
     this._tiny_buffer    = null;
     this._document       = document;
 }
コード例 #2
0
ファイル: ODocumentInputStream.cs プロジェクト: okevin/chama
 /**
  * Create an InputStream from the specified Document
  *
  * @param document the Document to be read
  */
 public ODocumentInputStream(POIFSDocument document)
 {
     _current_offset = 0;
     _marked_offset  = 0;
     _document_size  = document.Size;
     _closed         = false;
     _document       = document;
     _currentBlock   = GetDataInputBlock(0);
 }
コード例 #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;
 }
コード例 #4
0
ファイル: DirectoryNode.cs プロジェクト: okevin/chama
        /// <summary>
        /// Create a new DocumentEntry; the data will be provided later
        /// </summary>
        /// <param name="name">the name of the new DocumentEntry</param>
        /// <param name="size">the size of the new DocumentEntry</param>
        /// <returns>the new DocumentEntry</returns>
        public DocumentEntry CreateDocument(POIFSDocument 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);
        }
コード例 #5
0
ファイル: POIFSFileSystem.cs プロジェクト: okevin/chama
        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;
                    POIFSDocument document   = null;

                    if (property.ShouldUseSmallBlocks)
                    {
                        document =
                            new POIFSDocument(name, small_blocks
                                              .FetchBlocks(startBlock, headerPropertiesStartAt), size);
                    }
                    else
                    {
                        document =
                            new POIFSDocument(name,
                                              big_blocks.FetchBlocks(startBlock, headerPropertiesStartAt),
                                              size);
                    }
                    parent.CreateDocument(document);
                }
            }
        }
コード例 #6
0
ファイル: ODocumentInputStream.cs プロジェクト: okevin/chama
        /**
         * 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);
        }
コード例 #7
0
ファイル: POIFSFileSystem.cs プロジェクト: okevin/chama
        /// <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(POIFSDocument document)
        {
            _documents.Add(document);
            _property_table.AddProperty(document.DocumentProperty);
        }
コード例 #8
0
ファイル: DocumentInputStream.cs プロジェクト: okevin/chama
 /**
  * Create an InputStream from the specified Document
  *
  * @param document the Document to be read
  */
 public DocumentInputStream(POIFSDocument document)
 {
     delegate1 = new ODocumentInputStream(document);
 }
コード例 #9
0
ファイル: DocumentNode.cs プロジェクト: okevin/chama
        /**
         * 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;
        }