示例#1
0
 private void EnumSingleFolder(FolderRecWrapper folderRec, FolderMap.EnumFolderContext ctx, FolderMap.EnumFolderCallback callback, EnumHierarchyFlags flags)
 {
     ctx.Result = EnumHierarchyResult.Continue;
     if (folderRec.IsSpoolerQueue)
     {
         return;
     }
     if (FolderMap.IsValidFolderType(flags, folderRec))
     {
         callback(folderRec, ctx);
     }
     if (ctx.Result == EnumHierarchyResult.Cancel || ctx.Result == EnumHierarchyResult.SkipSubtree)
     {
         return;
     }
     if (folderRec.Children != null)
     {
         foreach (FolderRecWrapper folderRec2 in folderRec.Children)
         {
             ctx.Result = EnumHierarchyResult.Continue;
             this.EnumSingleFolder(folderRec2, ctx, callback, flags);
             if (ctx.Result == EnumHierarchyResult.Cancel)
             {
                 break;
             }
         }
     }
 }
示例#2
0
        protected virtual IEnumerable <FolderRecWrapper> GetFolderList(EnumHierarchyFlags flags, FolderRecWrapper folderRec)
        {
            Stack <FolderRecWrapper> stack = new Stack <FolderRecWrapper>();

            stack.Push(folderRec);
            while (stack.Count > 0)
            {
                FolderRecWrapper currentFolderRec = stack.Pop();
                if (!currentFolderRec.IsSpoolerQueue)
                {
                    if (FolderMap.IsValidFolderType(flags, currentFolderRec))
                    {
                        yield return(currentFolderRec);
                    }
                    if (currentFolderRec.Children != null)
                    {
                        foreach (FolderRecWrapper item in currentFolderRec.Children)
                        {
                            stack.Push(item);
                        }
                    }
                }
            }
            yield break;
        }