Ejemplo n.º 1
0
        public NPOIFSDocument(string name, int size, NPOIFSFileSystem filesystem, POIFSWriterListener Writer)
        {
            _filesystem = filesystem;

            if (size < 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();
            }

            Stream innerOs            = _stream.GetOutputStream();
            DocumentOutputStream os   = new DocumentOutputStream(innerOs, size);
            POIFSDocumentPath    path = new POIFSDocumentPath(name.Split(new string[] { "\\\\" }, StringSplitOptions.RemoveEmptyEntries));
            string           docName  = path.GetComponent(path.Length - 1);
            POIFSWriterEvent event1   = new POIFSWriterEvent(os, path, docName, size);

            Writer.ProcessPOIFSWriterEvent(event1);
            innerOs.Dispose();

            // And build the property for it
            _property            = new DocumentProperty(name, size);
            _property.StartBlock = (/*setter*/ _stream.GetStartBlock());
        }
Ejemplo n.º 2
0
 internal BigBlockStore(POIFSBigBlockSize bigBlockSize, DocumentBlock[] blocks)
 {
     this.bigBlockSize = bigBlockSize;
     bigBlocks         = (DocumentBlock[])blocks.Clone();
     path   = null;
     name   = null;
     size   = -1;
     writer = null;
 }
Ejemplo n.º 3
0
 internal BigBlockStore(POIFSBigBlockSize bigBlockSize, POIFSDocumentPath path, string name, int size, POIFSWriterListener writer)
 {
     this.bigBlockSize = bigBlockSize;
     this.bigBlocks    = new DocumentBlock[0];
     this.path         = path;
     this.name         = name;
     this.size         = size;
     this.writer       = writer;
 }
Ejemplo n.º 4
0
 internal SmallBlockStore(POIFSBigBlockSize bigBlockSize, SmallDocumentBlock[] blocks)
 {
     this.bigBlockSize = bigBlockSize;
     smallBlocks       = (SmallDocumentBlock[])blocks.Clone();
     this.path         = null;
     this.name         = null;
     this.size         = -1;
     this.writer       = null;
 }
Ejemplo n.º 5
0
 public DocumentEntry CreateDocument(string name, int size, POIFSWriterListener writer)
 {
     if (_nFilesSystem != null)
     {
         return(CreateDocument(new NPOIFSDocument(name, size, _nFilesSystem, writer)));
     }
     else
     {
         return(CreateDocument(new POIFSDocument(name, size, _path, writer)));
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Create a new DocumentEntry in the root entry; 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>
 /// <param name="writer">the Writer of the new DocumentEntry</param>
 /// <returns>the new DocumentEntry</returns>
 public DocumentEntry CreateDocument(String name, int size,
                                     /*POIFSWriterEventHandler*/ POIFSWriterListener writer) //Leon
 {
     return(this.Root.CreateDocument(name, size, writer));
 }
Ejemplo n.º 7
0
        public NPOIFSDocument(String name, int size, NPOIFSFileSystem filesystem, POIFSWriterListener Writer)
        {
            this._filesystem = filesystem;

            if (size < 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();
            }

            Stream innerOs = _stream.GetOutputStream();
            DocumentOutputStream os = new DocumentOutputStream(innerOs, size);
            POIFSDocumentPath path = new POIFSDocumentPath(name.Split(new string[] { "\\\\" }, StringSplitOptions.RemoveEmptyEntries));
            String docName = path.GetComponent(path.Length - 1);
            POIFSWriterEvent event1 = new POIFSWriterEvent(os, path, docName, size);
            Writer.ProcessPOIFSWriterEvent(event1);
            innerOs.Close();

            // And build the property for it
            this._property = new DocumentProperty(name, size);
            _property.StartBlock = (/*setter*/_stream.GetStartBlock());
        }
Ejemplo n.º 8
0
 internal BigBlockStore(POIFSBigBlockSize bigBlockSize, POIFSDocumentPath path, string name, int size, POIFSWriterListener writer)
 {
     this.bigBlockSize = bigBlockSize;
     this.bigBlocks = new DocumentBlock[0];
     this.path = path;
     this.name = name;
     this.size = size;
     this.writer = writer;
 }
Ejemplo n.º 9
0
 public DocumentEntry CreateDocument(string name, int size, POIFSWriterListener writer)
 {
     // return CreateDocument(name, size, write);
     return(CreateDocument(new POIFSDocument(name, size, _path, writer)));
 }
Ejemplo n.º 10
0
 internal SmallBlockStore(POIFSBigBlockSize bigBlockSize, SmallDocumentBlock[] blocks)
 {
     this.bigBlockSize = bigBlockSize;
     smallBlocks = (SmallDocumentBlock[])blocks.Clone();
     this.path = null;
     this.name = null;
     this.size = -1;
     this.writer = null;
 }
Ejemplo n.º 11
0
 internal BigBlockStore(POIFSBigBlockSize bigBlockSize, DocumentBlock[] blocks)
 {
     this.bigBlockSize = bigBlockSize;
     bigBlocks = (DocumentBlock[])blocks.Clone();
     path = null;
     name = null;
     size = -1;
     writer = null;
 }
Ejemplo n.º 12
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);
     }
 }
Ejemplo n.º 13
0
 public POIFSDocument(string name, int size, POIFSDocumentPath path, POIFSWriterListener writer)
     :this(name, size, POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, path, writer)
 {
 }
Ejemplo n.º 14
0
        /**
         * create a new DocumentEntry in the root entry; the data will be
         * provided later
         *
         * @param name the name of the new DocumentEntry
         * @param size the size of the new DocumentEntry
         * @param Writer the Writer of the new DocumentEntry
         *
         * @return the new DocumentEntry
         *
         * @exception IOException
         */

        public DocumentEntry CreateDocument(String name, int size, POIFSWriterListener writer)
        {
            return Root.CreateDocument(name, size, writer);
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Create a new DocumentEntry in the root entry; 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>
 /// <param name="writer">the Writer of the new DocumentEntry</param>
 /// <returns>the new DocumentEntry</returns>
 public DocumentEntry CreateDocument(String name, int size,
     /*POIFSWriterEventHandler*/ POIFSWriterListener writer) //Leon
 {
     return this.Root.CreateDocument(name, size, writer);
 }
Ejemplo n.º 16
0
        /**
         * create a new DocumentEntry in the root entry; the data will be
         * provided later
         *
         * @param name the name of the new DocumentEntry
         * @param size the size of the new DocumentEntry
         * @param Writer the Writer of the new DocumentEntry
         *
         * @return the new DocumentEntry
         *
         * @exception IOException
         */

        public DocumentEntry CreateDocument(String name, int size, POIFSWriterListener writer)
        {
            return(Root.CreateDocument(name, size, writer));
        }
Ejemplo n.º 17
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);
     }
 }
Ejemplo n.º 18
0
 public POIFSDocument(string name, int size, POIFSDocumentPath path, POIFSWriterListener writer)
     : this(name, size, POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, path, writer)
 {
 }