// Token: 0x060002F9 RID: 761 RVA: 0x0001AD34 File Offset: 0x00018F34
 private void WipeMobileDevice(DeviceIdentity deviceIdentity)
 {
     using (SyncStateStorage syncStateStorage = SyncStateStorage.Bind(this.userContext.MailboxSession, deviceIdentity, null))
     {
         if (syncStateStorage == null)
         {
             throw new OwaInvalidRequestException("Attempting to wipe device that does not exist.");
         }
         DeviceInfo.StartRemoteWipe(syncStateStorage, ExDateTime.UtcNow, this.userContext.ExchangePrincipal.MailboxInfo.PrimarySmtpAddress.ToString());
     }
 }
 // Token: 0x060002FA RID: 762 RVA: 0x0001ADAC File Offset: 0x00018FAC
 private void CancelWipe(DeviceIdentity deviceIdentity)
 {
     using (SyncStateStorage syncStateStorage = SyncStateStorage.Bind(this.userContext.MailboxSession, deviceIdentity, null))
     {
         if (syncStateStorage == null)
         {
             throw new OwaInvalidRequestException("Attempting to cancel wipe on device that does not exist.");
         }
         DeviceInfo.CancelRemoteWipe(syncStateStorage);
     }
 }
        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);
        }
Пример #4
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            MailboxSession mailboxSession = null;

            try
            {
                mailboxSession = MailboxSession.OpenAsAdmin(this.principal, CultureInfo.InvariantCulture, "Client=Management;Action=Get-ActiveSyncDeviceStatistics");
                DeviceInfo deviceInfo = MobileDeviceTaskHelper.GetDeviceInfo(mailboxSession, this.Identity);
                if (deviceInfo == null)
                {
                    base.WriteError(new MobileDeviceNotExistException(this.Identity.ToString()), ErrorCategory.InvalidOperation, this.Identity);
                }
                using (SyncStateStorage syncStateStorage = SyncStateStorage.Bind(mailboxSession, deviceInfo.DeviceIdentity, null))
                {
                    if (syncStateStorage == null)
                    {
                        base.WriteError(new MobileDeviceNotExistException(this.Identity.ToString()), ErrorCategory.InvalidOperation, this.Identity);
                    }
                    using (CustomSyncState orCreateGlobalSyncState = AirSyncUtility.GetOrCreateGlobalSyncState(syncStateStorage))
                    {
                        if (this.Cancel)
                        {
                            if (!DeviceInfo.CancelRemoteWipeFromMailbox(orCreateGlobalSyncState))
                            {
                                this.WriteWarning(Strings.CannotCancelWipe(this.Identity.ToString()));
                            }
                        }
                        else
                        {
                            DeviceInfo.StartRemoteWipeFromMailbox(syncStateStorage, orCreateGlobalSyncState, ExDateTime.UtcNow, this.validatedAddresses, this.wipeRequestorSMTP);
                        }
                        orCreateGlobalSyncState.Commit();
                    }
                }
                base.InternalProcessRecord();
            }
            catch (FolderSaveException exception)
            {
                base.WriteError(exception, ErrorCategory.WriteError, this.Identity);
            }
            catch (CorruptSyncStateException ex)
            {
                TaskLogger.LogError(ex);
                base.WriteError(ex, ErrorCategory.ReadError, this.principal);
            }
            catch (InvalidSyncStateVersionException ex2)
            {
                TaskLogger.LogError(ex2);
                base.WriteError(ex2, ErrorCategory.ReadError, this.principal);
            }
            catch (StorageTransientException ex3)
            {
                TaskLogger.LogError(ex3);
                base.WriteError(ex3, ErrorCategory.ReadError, this.principal);
            }
            catch (StoragePermanentException ex4)
            {
                TaskLogger.LogError(ex4);
                base.WriteError(ex4, ErrorCategory.InvalidOperation, this.principal);
            }
            catch (InvalidOperationException ex5)
            {
                TaskLogger.LogError(ex5);
                base.WriteError(ex5, ErrorCategory.InvalidOperation, this.principal);
            }
            finally
            {
                if (mailboxSession != null)
                {
                    mailboxSession.Dispose();
                }
                TaskLogger.LogExit();
            }
        }