internal static PublicFolderMailboxDiagnosticsInfo Load(PublicFolderSession session, DiagnosticsLoadFlags loadFlags, Action <LocalizedString, LocalizedString, int> writeProgress)
        {
            PublicFolderMailboxDiagnosticsInfo publicFolderMailboxDiagnosticsInfo = new PublicFolderMailboxDiagnosticsInfo("Public Folder Diagnostics Information");

            publicFolderMailboxDiagnosticsInfo.SyncInfo      = (PublicFolderMailboxDiagnosticsInfo.LoadMailboxInfo <PublicFolderMailboxSynchronizerInfo>(session, "PublicFolderSyncInfo", "PublicFolderLastSyncCylceLog") as PublicFolderMailboxSynchronizerInfo);
            publicFolderMailboxDiagnosticsInfo.AssistantInfo = (PublicFolderMailboxDiagnosticsInfo.LoadMailboxInfo <PublicFolderMailboxAssistantInfo>(session, "PublicFolderAssistantInfo", "PublicFolderLastAssistantCycleLog") as PublicFolderMailboxAssistantInfo);
            if ((loadFlags & DiagnosticsLoadFlags.DumpsterInfo) != DiagnosticsLoadFlags.Default)
            {
                publicFolderMailboxDiagnosticsInfo.DumpsterInfo = PublicFolderMailboxDumpsterInfo.LoadInfo(session, writeProgress);
            }
            if ((loadFlags & DiagnosticsLoadFlags.HierarchyInfo) != DiagnosticsLoadFlags.Default)
            {
                publicFolderMailboxDiagnosticsInfo.HierarchyInfo = PublicFolderMailboxHierarchyInfo.LoadInfo(session, writeProgress);
            }
            return(publicFolderMailboxDiagnosticsInfo);
        }
        internal static PublicFolderMailboxDumpsterInfo LoadInfo(PublicFolderSession session, Action <LocalizedString, LocalizedString, int> writeProgress)
        {
            string value = null;
            int    num   = 0;
            bool   flag  = false;
            int    num2  = 0;
            int    num3  = 0;
            int    num4  = 0;
            int    num5  = 0;
            int    num6  = 0;

            using (Folder folder = Folder.Bind(session, session.GetDumpsterRootFolderId(), PublicFolderMailboxDumpsterInfo.DumpsterPropertiesToLoad))
            {
                byte[] valueOrDefault = folder.GetValueOrDefault <byte[]>(FolderSchema.PublicFolderDumpsterHolderEntryId, null);
                if (valueOrDefault != null)
                {
                    value = session.IdConverter.CreateFolderId(session.IdConverter.GetIdFromLongTermId(valueOrDefault)).ToHexEntryId();
                }
                using (QueryResult queryResult = folder.FolderQuery(FolderQueryFlags.DeepTraversal, null, null, PublicFolderMailboxDumpsterInfo.DumpsterSubfoldersProperties))
                {
                    int  estimatedRowCount = queryResult.EstimatedRowCount;
                    bool flag2             = false;
                    int  num7 = 0;
                    for (;;)
                    {
                        object[][] rows = queryResult.GetRows(10000);
                        if (rows == null || rows.Length == 0)
                        {
                            break;
                        }
                        if (num == 0 && estimatedRowCount > rows.Length && writeProgress != null)
                        {
                            flag2 = true;
                        }
                        foreach (object[] array2 in rows)
                        {
                            num++;
                            if (flag2)
                            {
                                if (num > estimatedRowCount)
                                {
                                    estimatedRowCount = queryResult.EstimatedRowCount;
                                }
                                int num8 = num * 100 / estimatedRowCount;
                                if (num8 != num7 && num8 <= 100)
                                {
                                    writeProgress(ClientStrings.PublicFolderMailboxDumpsterInfo, ClientStrings.PublicFolderMailboxInfoFolderEnumeration(num, estimatedRowCount), num8);
                                    num7 = num8;
                                }
                            }
                            string text = array2[1] as string;
                            if (!string.IsNullOrEmpty(text))
                            {
                                bool flag3 = StringComparer.OrdinalIgnoreCase.Equals("\\NON_IPM_SUBTREE\\DUMPSTER_ROOT\\DUMPSTER_EXTEND", text);
                                if (flag3)
                                {
                                    flag = true;
                                }
                                else if (!text.StartsWith("\\NON_IPM_SUBTREE\\DUMPSTER_ROOT\\DUMPSTER_EXTEND\\", StringComparison.OrdinalIgnoreCase))
                                {
                                    num2++;
                                }
                                else
                                {
                                    object obj = array2[0];
                                    if (obj is int)
                                    {
                                        int num9 = (int)obj;
                                        if (num9 == 2)
                                        {
                                            num3++;
                                        }
                                        else if (num9 == 3)
                                        {
                                            num4++;
                                        }
                                        else if (num9 == 4)
                                        {
                                            num5++;
                                        }
                                        else if (num9 > 4)
                                        {
                                            num6++;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            PublicFolderMailboxDumpsterInfo publicFolderMailboxDumpsterInfo = new PublicFolderMailboxDumpsterInfo();

            publicFolderMailboxDumpsterInfo[PublicFolderDumpsterInfoSchema.DumpsterHolderEntryId] = value;
            publicFolderMailboxDumpsterInfo[PublicFolderDumpsterInfoSchema.CountTotalFolders]     = num;
            publicFolderMailboxDumpsterInfo[PublicFolderDumpsterInfoSchema.HasDumpsterExtended]   = flag;
            publicFolderMailboxDumpsterInfo[PublicFolderDumpsterInfoSchema.CountLegacyDumpsters]  = num2;
            publicFolderMailboxDumpsterInfo[PublicFolderDumpsterInfoSchema.CountContainerLevel1]  = num3;
            publicFolderMailboxDumpsterInfo[PublicFolderDumpsterInfoSchema.CountContainerLevel2]  = num4;
            publicFolderMailboxDumpsterInfo[PublicFolderDumpsterInfoSchema.CountDumpsters]        = num5;
            publicFolderMailboxDumpsterInfo[PublicFolderDumpsterInfoSchema.CountDeletedFolders]   = num6;
            publicFolderMailboxDumpsterInfo.propertyBag.ResetChangeTracking();
            return(publicFolderMailboxDumpsterInfo);
        }