// Token: 0x06000AAA RID: 2730 RVA: 0x0003B168 File Offset: 0x00039368
        public static GlobalInfo LoadFromMailbox(MailboxSession mailboxSession, SyncStateStorage syncStateStorage, ProtocolLogger protocolLogger, out bool updateUserHasPartnership)
        {
            if (mailboxSession == null)
            {
                throw new ArgumentNullException("mailboxSession");
            }
            if (syncStateStorage == null)
            {
                throw new ArgumentNullException("syncStateStorage");
            }
            updateUserHasPartnership = false;
            CustomSyncState customSyncState         = null;
            GlobalInfo      globalInfo              = null;
            bool            isDirty                 = false;
            bool            hasNewSyncData          = false;
            bool            hasNewAutdData          = false;
            bool            isSyncStateJustUpgraded = false;
            bool            flag = false;
            GlobalInfo      result;

            try
            {
                GlobalSyncStateInfo syncStateInfo = new GlobalSyncStateInfo();
                customSyncState = syncStateStorage.GetCustomSyncState(syncStateInfo, GlobalInfo.ExtraGlobalInfoPropertiesToFetch);
                if (customSyncState == null)
                {
                    isDirty = true;
                    using (CustomSyncState customSyncState2 = syncStateStorage.GetCustomSyncState(new FolderIdMappingSyncStateInfo(), new PropertyDefinition[0]))
                    {
                        if (customSyncState2 == null)
                        {
                            updateUserHasPartnership = true;
                            syncStateStorage.DeleteAllSyncStates();
                        }
                    }
                    customSyncState = syncStateStorage.CreateCustomSyncState(syncStateInfo);
                    isDirty         = true;
                }
                else
                {
                    try
                    {
                        object obj = customSyncState.StoreObject.TryGetProperty(AirSyncStateSchema.LastSyncAttemptTime);
                        hasNewSyncData = (obj != null && !(obj is PropertyError));
                    }
                    catch (Exception arg)
                    {
                        AirSyncDiagnostics.TraceError <Exception>(ExTraceGlobals.RequestsTracer, null, "[GlobalInfo.LoadFromMailbox] Encountered exception when checking for new syncStatus properties.  Exception: {0}", arg);
                    }
                    try
                    {
                        object obj2 = customSyncState.StoreObject.TryGetProperty(AirSyncStateSchema.LastPingHeartbeatInterval);
                        hasNewAutdData = (obj2 != null && !(obj2 is PropertyError));
                    }
                    catch (Exception arg2)
                    {
                        AirSyncDiagnostics.TraceError <Exception>(ExTraceGlobals.RequestsTracer, null, "[GlobalInfo.LoadFromMailbox] Encountered exception when checking for new syncStatus properties.  Exception: {0}", arg2);
                    }
                    if (customSyncState.BackendVersion != null && customSyncState.BackendVersion.Value != customSyncState.Version)
                    {
                        isDirty = true;
                        isSyncStateJustUpgraded = true;
                        if (protocolLogger != null)
                        {
                            protocolLogger.SetValue(ProtocolLoggerData.Ssu, "2007");
                        }
                    }
                }
                globalInfo                         = new GlobalInfo(customSyncState);
                globalInfo.IsDirty                 = isDirty;
                globalInfo.HasNewSyncData          = hasNewSyncData;
                globalInfo.HasNewAutdData          = hasNewAutdData;
                globalInfo.IsSyncStateJustUpgraded = isSyncStateJustUpgraded;
                if (Command.CurrentCommand != null)
                {
                    globalInfo.WriteNewSyncData = Command.CurrentCommand.User.Features.IsEnabled(EasFeature.SyncStatusOnGlobalInfo);
                }
                flag   = true;
                result = globalInfo;
            }
            finally
            {
                if (!flag)
                {
                    if (globalInfo != null)
                    {
                        globalInfo.Dispose();
                    }
                    else if (customSyncState != null)
                    {
                        customSyncState.Dispose();
                    }
                }
            }
            return(result);
        }