// Token: 0x060000BD RID: 189 RVA: 0x00008770 File Offset: 0x00006970
        private void SendMaxDevicesExceededMailIfNeeded(int deviceCount, uint maxDevicesLimit)
        {
            if (Command.CurrentCommand == null)
            {
                return;
            }
            MailboxSession mailboxSession = Command.CurrentCommand.MailboxSession;

            using (SyncStateRootStorage orCreateSyncStateRootStorage = SyncStateRootStorage.GetOrCreateSyncStateRootStorage(mailboxSession, "AirSync", null))
            {
                if (orCreateSyncStateRootStorage == null)
                {
                    AirSyncDiagnostics.TraceError(this.tracer, null, "Error: Could not load SyncStateRootStorage!");
                }
                else
                {
                    using (AirSyncRootInfo airSyncRootInfo = AirSyncRootInfo.LoadFromMailbox(mailboxSession, orCreateSyncStateRootStorage))
                    {
                        if (airSyncRootInfo == null)
                        {
                            AirSyncDiagnostics.TraceError(this.tracer, null, "Error: Could not load AirSyncRootInfo!");
                        }
                        else if (airSyncRootInfo.LastMaxDevicesExceededMailSentTime == null || airSyncRootInfo.LastMaxDevicesExceededMailSentTime.Value.AddHours(24.0) < ExDateTime.UtcNow)
                        {
                            CultureInfo preferedCulture = mailboxSession.PreferedCulture;
                            SystemMessageHelper.PostMessage(mailboxSession, Strings.MaxDevicesExceededMailSubject.ToString(preferedCulture), Strings.MaxDevicesExceededMailBody(deviceCount, maxDevicesLimit).ToString(preferedCulture), null, Importance.High);
                            airSyncRootInfo.LastMaxDevicesExceededMailSentTime = new ExDateTime?(ExDateTime.UtcNow);
                            airSyncRootInfo.SaveToMailbox();
                        }
                    }
                }
            }
        }
        // Token: 0x06000299 RID: 665 RVA: 0x0000EF00 File Offset: 0x0000D100
        public static AirSyncRootInfo LoadFromMailbox(MailboxSession mailboxSession, SyncStateRootStorage syncStateRootStorage)
        {
            ArgumentValidator.ThrowIfNull("mailboxSession", mailboxSession);
            ArgumentValidator.ThrowIfNull("syncStateRootStorage", syncStateRootStorage);
            AirSyncRootInfo airSyncRootInfo = null;
            CustomSyncState customSyncState = null;
            bool            flag            = false;
            AirSyncRootInfo result;

            try
            {
                bool isDirty = false;
                AirSyncRootSyncStateInfo syncStateInfo = new AirSyncRootSyncStateInfo();
                customSyncState = syncStateRootStorage.GetCustomSyncState(syncStateInfo);
                if (customSyncState == null)
                {
                    AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, null, "[AirSyncRootInfo.LoadFromMailbox] Had to create root sync state.");
                    customSyncState = syncStateRootStorage.CreateCustomSyncState(syncStateInfo);
                    isDirty         = true;
                }
                airSyncRootInfo         = new AirSyncRootInfo(customSyncState);
                airSyncRootInfo.IsDirty = isDirty;
                flag   = true;
                result = airSyncRootInfo;
            }
            finally
            {
                if (!flag)
                {
                    if (airSyncRootInfo != null)
                    {
                        airSyncRootInfo.Dispose();
                    }
                    else if (customSyncState != null)
                    {
                        customSyncState.Dispose();
                    }
                }
            }
            return(result);
        }