Esempio n. 1
0
 internal bool VisitAllHelper(int level, VisitDirectoryEntryHandler visitEntryMethod, ArrayList levelTags)
 {
     foreach (Ole2DirectoryEntry entry in this)
     {
         VisitDirectoryEntryArgs args = new VisitDirectoryEntryArgs(entry, this, level, true, true, true, ArrayList.FixedSize(levelTags));
         visitEntryMethod(args);
         if (!args.ContinueVisiting)
         {
             return(false);
         }
         if (args.VisitChildren)
         {
             Ole2Storage storage = entry as Ole2Storage;
             if (storage != null)
             {
                 levelTags.Add(null);
                 bool flag = storage.VisitAllHelper(level + 1, visitEntryMethod, levelTags);
                 levelTags.RemoveAt(levelTags.Count - 1);
                 if (!flag)
                 {
                     return(false);
                 }
             }
         }
         if (!args.VisitSiblings)
         {
             break;
         }
     }
     return(true);
 }
Esempio n. 2
0
        private void ProcessEntry(VisitDirectoryEntryArgs args)
        {
            CompoundFileData.RedBlackTreeNode node = new CompoundFileData.RedBlackTreeNode {
                DirectoryEntry = args.CurrentEntry,
                LeftDID        = -1,
                RightDID       = -1,
                MembersDID     = -1
            };
            int        newNodeDID   = this.nodes.Add(node);
            Ole2Stream currentEntry = args.CurrentEntry as Ole2Stream;

            if (currentEntry != null)
            {
                if (currentEntry.Size < base.shortThreshold)
                {
                    currentEntry.WriteSID = CreateChain(currentEntry.Size, base.shortSectorAllocationTable, base.shortSectorSize);
                    WriteOle2Stream(currentEntry, base.shortStreamContainer, base.shortSectorSize);
                }
                else
                {
                    currentEntry.WriteSID = CreateChain(currentEntry.Size, base.sectorAllocationTable, base.sectorSize);
                }
            }
            else
            {
                args.LevelTags[args.Level] = node;
            }
            CompoundFileData.RedBlackTreeNode node2 = (RedBlackTreeNode)args.LevelTags[args.Level - 1];
            this.InsertNodeToTree(ref node2.MembersDID, node.DirectoryEntry.Name, newNodeDID);
        }
Esempio n. 3
0
        private static void CacheStreamData(VisitDirectoryEntryArgs args)
        {
            Ole2Stream currentEntry = args.CurrentEntry as Ole2Stream;

            if (currentEntry != null)
            {
                currentEntry.LoadData();
            }
        }
Esempio n. 4
0
        private void WriteEntry(VisitDirectoryEntryArgs args)
        {
            Ole2Stream currentEntry = args.CurrentEntry as Ole2Stream;

            if ((currentEntry != null) && (currentEntry.Size >= base.shortThreshold))
            {
                WriteOle2Stream(currentEntry, this.outputStream, base.sectorSize);
            }
        }
Esempio n. 5
0
        private static void CopyEntry(VisitDirectoryEntryArgs args)
        {
            Ole2Storage storage      = args.LevelTags[args.Level - 1] as Ole2Storage;//.get_Item(args.Level - 1);
            Ole2Stream  currentEntry = args.CurrentEntry as Ole2Stream;

            if (currentEntry != null)
            {
                SourceStreamHolder holder = new SourceStreamHolder(currentEntry);
                storage.AddStream(currentEntry.Name, currentEntry.Size, new GetStreamDataHandler(holder.CopyStreamData));
            }
            else
            {
                Ole2Storage storage2 = args.CurrentEntry as Ole2Storage;
                args.LevelTags[args.Level] = storage.AddStorage(storage2.Name);
            }
        }