Example #1
0
        // Token: 0x06000555 RID: 1365 RVA: 0x0001ED04 File Offset: 0x0001CF04
        public static List <Exception> ResetAutoBlockedDevices(MailboxSession mailboxSession)
        {
            List <Exception> list       = new List <Exception>();
            IEnumerator      enumerator = SyncStateStorage.GetEnumerator(mailboxSession, null);

            using (enumerator as IDisposable)
            {
                while (enumerator.MoveNext())
                {
                    object           obj = enumerator.Current;
                    SyncStateStorage syncStateStorage = (SyncStateStorage)obj;
                    if (syncStateStorage.DeviceIdentity.IsProtocol("AirSync"))
                    {
                        try
                        {
                            using (GlobalInfo globalInfo = GlobalInfo.LoadFromMailbox(mailboxSession, syncStateStorage, null))
                            {
                                if (globalInfo.DeviceBehavior.AutoBlockReason != DeviceAccessStateReason.Unknown)
                                {
                                    globalInfo.DeviceBehavior.UnblockDevice();
                                    globalInfo.IsDirty = true;
                                    globalInfo.SaveToMailbox();
                                }
                            }
                        }
                        catch (LocalizedException item)
                        {
                            list.Add(item);
                        }
                    }
                }
            }
            return(list);
        }
        private static bool TryGetInactiveSmsSyncDeviceName(MailboxSession session, E164Number smsSyncPhoneNumber, string smsSyncDeviceProtocol, string smsSyncDeviceType, string smsSyncDeviceId, ExDateTime boundary, out string deviceName)
        {
            deviceName = null;
            ExDateTime minValue = ExDateTime.MinValue;

            if (string.IsNullOrEmpty(smsSyncDeviceProtocol) || string.IsNullOrEmpty(smsSyncDeviceType) || string.IsNullOrEmpty(smsSyncDeviceId))
            {
                IEnumerator enumerator = SyncStateStorage.GetEnumerator(session, null);
                using (enumerator as IDisposable)
                {
                    while (enumerator.MoveNext())
                    {
                        object obj = enumerator.Current;
                        using (SyncStateStorage syncStateStorage = (SyncStateStorage)obj)
                        {
                            if (syncStateStorage.DeviceIdentity.IsProtocol("AirSync"))
                            {
                                if (TextMessagingUtilities.TryGetSmsSyncDeviceLastSyncTime(syncStateStorage, smsSyncPhoneNumber, out minValue, out deviceName))
                                {
                                    break;
                                }
                            }
                        }
                    }
                    goto IL_BB;
                }
            }
            DeviceIdentity deviceIdentity = new DeviceIdentity(smsSyncDeviceId, smsSyncDeviceType, smsSyncDeviceProtocol);

            using (SyncStateStorage syncStateStorage2 = SyncStateStorage.Bind(session, deviceIdentity, null))
            {
                if (!TextMessagingUtilities.TryGetSmsSyncDeviceLastSyncTime(syncStateStorage2, smsSyncPhoneNumber, out minValue, out deviceName))
                {
                    return(true);
                }
            }
IL_BB:
            return(minValue <= boundary);
        }