Ejemplo n.º 1
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);
                }
            }
        }