private void WaitAndProcessDeliveryReceipt(MapiFolder folder, string subject, string fromAddress, string toAddress, string perfInstance)
 {
     using (MapiMessage mapiMessage = this.WaitForDeliveryReceipt(folder, subject, base.Task.ErrorLatency, base.Task.ExecutionTimeout, fromAddress, toAddress))
     {
         if (mapiMessage != null)
         {
             PropValue        prop             = mapiMessage.GetProp(PropTag.MessageDeliveryTime);
             PropValue        prop2            = mapiMessage.GetProp(PropTag.OriginalSubmitTime);
             EnhancedTimeSpan enhancedTimeSpan = prop.GetDateTime() - prop2.GetDateTime();
             if (enhancedTimeSpan < EnhancedTimeSpan.Zero)
             {
                 enhancedTimeSpan = EnhancedTimeSpan.Zero;
             }
             base.OutputResult(Strings.MapiTransactionResultSuccess, enhancedTimeSpan, base.IsRemoteTest);
             base.AddSuccessMonitoringEvent(1000, Strings.TestMailflowSucceeded(fromAddress, toAddress));
             base.AddPerfCounter("Mailflow Latency", perfInstance, enhancedTimeSpan.TotalSeconds);
         }
         else
         {
             EnhancedTimeSpan latency = EnhancedTimeSpan.FromSeconds(0.0);
             base.OutputResult(Strings.MapiTransactionResultFailure, latency, base.IsRemoteTest);
             base.AddErrorMonitoringEvent(1001, Strings.TestMailflowFailed(fromAddress, toAddress, base.Task.ExecutionTimeout));
             base.AddPerfCounter("Mailflow Latency", perfInstance, -1.0);
         }
     }
 }
 private static Binding GetWebServiceBinding(EnhancedTimeSpan timeout)
 {
     if (GetQueueDigestWebServiceImpl.webServiceBinding == null)
     {
         GetQueueDigestWebServiceImpl.webServiceBinding = new NetTcpBinding
         {
             Security =
             {
                 Transport                =
                 {
                     ProtectionLevel      = ProtectionLevel.EncryptAndSign,
                     ClientCredentialType = TcpClientCredentialType.Windows
                 },
                 Message                  =
                 {
                     ClientCredentialType = MessageCredentialType.Windows
                 }
             },
             MaxReceivedMessageSize = (long)((int)ByteQuantifiedSize.FromMB(5UL).ToBytes()),
             OpenTimeout            = timeout,
             CloseTimeout           = timeout,
             SendTimeout            = timeout,
             ReceiveTimeout         = timeout
         };
     }
     return(GetQueueDigestWebServiceImpl.webServiceBinding);
 }
 // Token: 0x060005DE RID: 1502 RVA: 0x0002C928 File Offset: 0x0002AB28
 private void ResolveDeletionInfo()
 {
     if (this.deletionInfo != null)
     {
         return;
     }
     this.deletionInfo = new DumpsterExpirationEnforcer.ExpirationInfoPair
     {
         IsEnabled = false,
         AgeLimit  = EnhancedTimeSpan.MaxValue
     };
     if (base.MailboxDataForTags.AbsoluteLitigationHoldEnabled)
     {
         DumpsterExpirationEnforcer.Tracer.TraceDebug <DumpsterExpirationEnforcer>((long)this.GetHashCode(), "{0}: This user is under litigation hold. This user's dumpster will be skipped.", this);
         this.deletionInfo.IsEnabled = false;
     }
     else
     {
         DumpsterExpirationEnforcer.Tracer.TraceDebug <DumpsterExpirationEnforcer>((long)this.GetHashCode(), "{0}: This user is not under litigation hold. His dumpster will be processed.", this);
         this.deletionInfo.IsEnabled = true;
     }
     if (base.MailboxDataForTags.ElcUserTagInformation.ADUser.UseDatabaseRetentionDefaults)
     {
         DumpsterExpirationEnforcer.Tracer.TraceDebug <DumpsterExpirationEnforcer, EnhancedTimeSpan?>((long)this.GetHashCode(), "{0}: UseDatabaseRetentionDefaults is true. The DB retention period of {1} will be used.", this, base.SysCleanupSubAssistant.DatabaseConfig.DumpsterRetentionPeriod);
         this.deletionInfo.AgeLimit = (base.SysCleanupSubAssistant.DatabaseConfig.DumpsterRetentionPeriod ?? EnhancedTimeSpan.MaxValue);
         if (base.SysCleanupSubAssistant.DatabaseConfig.RetainDeletedItemsUntilBackup)
         {
             EnhancedTimeSpan enhancedTimeSpan = base.MailboxDataForTags.UtcNow - base.SysCleanupSubAssistant.DatabaseConfig.LastFullBackup;
             if (this.deletionInfo.AgeLimit < enhancedTimeSpan)
             {
                 this.deletionInfo.AgeLimit = enhancedTimeSpan;
             }
             DumpsterExpirationEnforcer.Tracer.TraceDebug <DumpsterExpirationEnforcer, EnhancedTimeSpan, EnhancedTimeSpan>((long)this.GetHashCode(), "{0}: DatabaseConfig.RetainDeletedItemsUntilBackup is true. ageLimitFromBackup={1}, nullableAgeLimitForRegularItems is {2}.", this, enhancedTimeSpan, this.deletionInfo.AgeLimit);
         }
     }
     else
     {
         DumpsterExpirationEnforcer.Tracer.TraceDebug <DumpsterExpirationEnforcer, EnhancedTimeSpan>((long)this.GetHashCode(), "{0}: UseDatabaseRetentionDefaults is false. The mailbox retention period of {1} will be used.", this, base.MailboxDataForTags.ElcUserTagInformation.ADUser.RetainDeletedItemsFor);
         this.deletionInfo.AgeLimit = base.MailboxDataForTags.ElcUserTagInformation.ADUser.RetainDeletedItemsFor;
         if (base.MailboxDataForTags.ElcUserTagInformation.ADUser.RetainDeletedItemsUntilBackup)
         {
             EnhancedTimeSpan enhancedTimeSpan2 = base.MailboxDataForTags.UtcNow - base.SysCleanupSubAssistant.DatabaseConfig.LastFullBackup;
             if (this.deletionInfo.AgeLimit < enhancedTimeSpan2)
             {
                 this.deletionInfo.AgeLimit = enhancedTimeSpan2;
             }
             DumpsterExpirationEnforcer.Tracer.TraceDebug <DumpsterExpirationEnforcer, EnhancedTimeSpan, EnhancedTimeSpan>((long)this.GetHashCode(), "{0}: Mailbox.RetainDeletedItemsUntilBackup is true. ageLimitFromBackup={1}, nullableAgeLimitForRegularItems is {2}.", this, enhancedTimeSpan2, this.deletionInfo.AgeLimit);
         }
     }
     if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Global.MultiTenancy.Enabled)
     {
         TimeSpan config = ElcGlobals.Configuration.GetConfig <TimeSpan>("SingleItemRecoveryRetention");
         if (!config.Equals(TimeSpan.Zero))
         {
             DumpsterExpirationEnforcer.Tracer.TraceDebug <DumpsterExpirationEnforcer, TimeSpan>((long)this.GetHashCode(), "{0}: ElcConfigSchema.Setting.SingleItemRecoveryRetention is {1}. Set the mailbox retention period to that value.", this, config);
             this.deletionInfo.AgeLimit = config;
         }
     }
     base.MailboxDataForTags.StatisticsLogEntry.DeletionAgeLimit = this.deletionInfo.AgeLimit.ToString();
 }
 protected void InitializeLagTimes(DatabaseCopy preExistingCopy)
 {
     if (base.Fields["ReplayLagTime"] == null)
     {
         if (preExistingCopy == null)
         {
             this.m_replayLagTime = EnhancedTimeSpan.Parse("00:00:00");
         }
         else
         {
             this.m_replayLagTime = preExistingCopy.ReplayLagTime;
         }
     }
     else
     {
         this.m_replayLagTime = this.ReplayLagTime;
     }
     if (base.Fields["TruncationLagTime"] != null)
     {
         this.m_truncationLagTime = this.TruncationLagTime;
         return;
     }
     if (preExistingCopy == null)
     {
         this.m_truncationLagTime = EnhancedTimeSpan.Parse("00:00:00");
         return;
     }
     this.m_truncationLagTime = preExistingCopy.TruncationLagTime;
 }
        public void PrepareForNewSyncCycle(EnhancedTimeSpan syncInterval)
        {
            this.transientFailureDetails       = new Dictionary <EhfCompanyIdentity, List <EhfTransientFailureInfo> >();
            this.criticalTransientFailureCount = 0;
            this.permanentFailureCount         = 0;
            this.transientFailureCount         = 0;
            ExDateTime             utcNow     = ExDateTime.UtcNow;
            Dictionary <Guid, int> dictionary = new Dictionary <Guid, int>();

            if (utcNow < this.lastSyncTime + 2L * syncInterval)
            {
                foreach (EhfCompanyIdentity ehfCompanyIdentity in this.transientFailuresInCurrentCycle)
                {
                    int num;
                    if (this.transientFailuresHistory.TryGetValue(ehfCompanyIdentity.EhfCompanyGuid, out num))
                    {
                        dictionary.Add(ehfCompanyIdentity.EhfCompanyGuid, num + 1);
                    }
                    else
                    {
                        dictionary.Add(ehfCompanyIdentity.EhfCompanyGuid, 1);
                    }
                }
            }
            this.transientFailuresHistory        = dictionary;
            this.transientFailuresInCurrentCycle = new HashSet <EhfCompanyIdentity>();
            this.lastSyncTime = utcNow;
        }
        private void WaitAndProcessProbeResponses(MapiFolder folder, string fromAddress, Dictionary <string, string> subjectTargets, ExDateTime probeSentTime)
        {
            List <byte[]> list  = new List <byte[]>();
            List <string> list2 = new List <string>();

            for (int i = 0; i < base.Task.ExecutionTimeout; i++)
            {
                foreach (KeyValuePair <string, string> keyValuePair in subjectTargets)
                {
                    if (!string.IsNullOrEmpty(keyValuePair.Value))
                    {
                        using (MapiMessage deliveryReceipt = TestMailFlowHelper.GetDeliveryReceipt(folder, keyValuePair.Key, false))
                        {
                            if (deliveryReceipt != null)
                            {
                                PropValue prop  = deliveryReceipt.GetProp(PropTag.MessageDeliveryTime);
                                PropValue prop2 = deliveryReceipt.GetProp(PropTag.EntryId);
                                PropValue prop3 = deliveryReceipt.GetProp(PropTag.Subject);
                                if (!prop.IsError() && prop.Value != null && prop3.Value != null)
                                {
                                    string text = prop3.Value.ToString();
                                    if (text.StartsWith("RSP: CrossPremiseMailFlowMonitoring-", StringComparison.OrdinalIgnoreCase))
                                    {
                                        EnhancedTimeSpan latency = ((ExDateTime)prop.GetDateTime() > probeSentTime) ? ((ExDateTime)prop.GetDateTime() - probeSentTime) : EnhancedTimeSpan.Zero;
                                        base.OutputResult(Strings.TestMailflowSucceeded(fromAddress, keyValuePair.Value), latency, base.IsRemoteTest);
                                    }
                                    else if (text.StartsWith("Undeliverable: CrossPremiseMailFlowMonitoring-", StringComparison.OrdinalIgnoreCase))
                                    {
                                        EnhancedTimeSpan latency2 = EnhancedTimeSpan.FromSeconds(0.0);
                                        string           info     = (string)deliveryReceipt.GetProp(PropTag.Body).Value;
                                        base.OutputResult(Strings.CrossPremiseProbeNdred(fromAddress, keyValuePair.Value, info), latency2, base.IsRemoteTest);
                                    }
                                    list2.Add(keyValuePair.Key);
                                    list.Add(prop2.GetBytes());
                                }
                            }
                        }
                    }
                }
                foreach (string key in list2)
                {
                    subjectTargets.Remove(key);
                }
                list2.Clear();
                if (subjectTargets.Count == 0)
                {
                    break;
                }
                Thread.Sleep(1000);
            }
            foreach (KeyValuePair <string, string> keyValuePair2 in subjectTargets)
            {
                if (!string.IsNullOrEmpty(keyValuePair2.Value))
                {
                    EnhancedTimeSpan latency3 = EnhancedTimeSpan.FromSeconds(0.0);
                    base.OutputResult(Strings.MapiTransactionResultFailure, latency3, base.IsRemoteTest);
                }
            }
            folder.DeleteMessages(DeleteMessagesFlags.ForceHardDelete, list.ToArray());
        }
Esempio n. 7
0
        internal static void TryGetExistingHoldDurationInStore(IExchangePrincipal exchangePrincipal, string clientString, out Unlimited <EnhancedTimeSpan> existingHoldDuration, out ElcMailboxHelper.ConfigState state, out Exception exception)
        {
            Func <string, KeyValuePair <Unlimited <EnhancedTimeSpan>, ElcMailboxHelper.ConfigState> > valueFunction = delegate(string value)
            {
                Unlimited <EnhancedTimeSpan> key = default(Unlimited <EnhancedTimeSpan>);
                ElcMailboxHelper.ConfigState value2;
                double value3;
                if (string.Compare(value, Globals.UnlimitedHoldDuration, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    key    = Unlimited <EnhancedTimeSpan> .UnlimitedValue;
                    value2 = ElcMailboxHelper.ConfigState.Found;
                }
                else if (double.TryParse(value.ToString(), out value3))
                {
                    EnhancedTimeSpan fromValue = EnhancedTimeSpan.FromMilliseconds(value3);
                    key    = fromValue;
                    value2 = ElcMailboxHelper.ConfigState.Found;
                }
                else
                {
                    value2 = ElcMailboxHelper.ConfigState.Corrupt;
                }
                return(new KeyValuePair <Unlimited <EnhancedTimeSpan>, ElcMailboxHelper.ConfigState>(key, value2));
            };

            ElcMailboxHelper.TryGetExistingValueInStore <Unlimited <EnhancedTimeSpan> >(exchangePrincipal, clientString, "LitigationHoldDuration", valueFunction, out existingHoldDuration, out state, out exception);
        }
Esempio n. 8
0
 public QueueViewerOptions(bool refresh, EnhancedTimeSpan interval, uint size)
 {
     this.AutoRefreshEnabled = refresh;
     this.RefreshInterval    = interval;
     this.PageSize           = size;
     base.ResetChangeTracking();
 }
Esempio n. 9
0
 protected override void InternalProcessRecord()
 {
     if (this.DataObject.IsChanged(AdminAuditLogConfigSchema.AdminAuditLogAgeLimit) && !this.Force)
     {
         EnhancedTimeSpan t;
         if (this.DataObject.AdminAuditLogAgeLimit == EnhancedTimeSpan.Zero)
         {
             if (!base.ShouldContinue(Strings.ConfirmationMessageAdminAuditLogAgeLimitZero(base.CurrentOrgContainerId.ToString())))
             {
                 return;
             }
         }
         else if (this.DataObject.TryGetOriginalValue <EnhancedTimeSpan>(AdminAuditLogConfigSchema.AdminAuditLogAgeLimit, out t))
         {
             EnhancedTimeSpan adminAuditLogAgeLimit = this.DataObject.AdminAuditLogAgeLimit;
             if (t > adminAuditLogAgeLimit && !base.ShouldContinue(Strings.ConfirmationMessageAdminAuditLogAgeLimitSmaller(base.CurrentOrgContainerId.ToString(), adminAuditLogAgeLimit.ToString())))
             {
                 return;
             }
         }
     }
     if (this.IsObjectStateChanged())
     {
         this.WriteWarning(Strings.WarningSetAdminAuditLogConfigDelay(SetAdminAuditLogConfig.AuditConfigSettingsDelayTime.TotalMinutes));
     }
     if (AdminAuditLogHelper.ShouldIssueWarning(base.CurrentOrganizationId))
     {
         this.WriteWarning(Strings.WarningSetAdminAuditLogOnPreE15(base.CurrentOrganizationId.ToString()));
     }
     base.InternalProcessRecord();
     ProvisioningLayer.RefreshProvisioningBroker(this);
 }
Esempio n. 10
0
        public static void SetObjectPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            DataRow       dataRow = dataTable.Rows[0];
            List <string> list    = new List <string>();

            MailboxPropertiesHelper.SaveQuotaProperty(dataRow, null, "IssueWarningQuota", list);
            MailboxPropertiesHelper.SaveQuotaProperty(dataRow, null, "ProhibitSendQuota", list);
            MailboxPropertiesHelper.SaveQuotaProperty(dataRow, null, "ProhibitSendReceiveQuota", list);
            if (DBNull.Value != dataRow["DeletedItemRetention"])
            {
                dataRow["DeletedItemRetention"] = EnhancedTimeSpan.Parse((string)dataRow["DeletedItemRetention"]);
                list.Add("DeletedItemRetention");
            }
            if (DBNull.Value != dataRow["MailboxRetention"])
            {
                dataRow["MailboxRetention"] = EnhancedTimeSpan.Parse((string)dataRow["MailboxRetention"]);
                list.Add("MailboxRetention");
            }
            DatabasePropertiesHelper.SetScheduleProperty(dataRow, "MaintenanceSchedule", list);
            DatabasePropertiesHelper.SetScheduleProperty(dataRow, "QuotaNotificationSchedule", list);
            if (list.Count != 0)
            {
                store.SetModifiedColumns(list);
            }
        }
Esempio n. 11
0
 public ComponentLatencyInfo(LocalizedString componentName, EnhancedTimeSpan componentLatency, int componentSequenceNumber, bool isPending)
 {
     this.componentName           = componentName;
     this.componentLatency        = componentLatency;
     this.isPending               = isPending;
     this.componentSequenceNumber = componentSequenceNumber;
 }
 public override void SaveComponentSettings()
 {
     this.QueueSettings.PageSize           = this.PageSize;
     this.QueueSettings.AutoRefreshEnabled = this.AutoRefreshEnabled;
     this.QueueSettings.RefreshInterval    = EnhancedTimeSpan.FromSeconds((double)this.RefreshInterval);
     base.SaveComponentSettings();
 }
Esempio n. 13
0
        // Token: 0x0600056A RID: 1386 RVA: 0x000200D0 File Offset: 0x0001E2D0
        private void BlockDevice(AutoblockThresholdType autoblockThresholdType)
        {
            AirSyncDiagnostics.TraceInfo <AutoblockThresholdType>(ExTraceGlobals.RequestsTracer, this, "BlockDevice {0}", autoblockThresholdType);
            EnhancedTimeSpan deviceBlockDuration = ADNotificationManager.GetAutoBlockThreshold(autoblockThresholdType).DeviceBlockDuration;
            ExDateTime       utcNow = ExDateTime.UtcNow;

            lock (this.instanceLock)
            {
                if (this.blockTime > utcNow || this.nextUnblockTime < utcNow)
                {
                    this.blockTime       = utcNow;
                    this.nextUnblockTime = utcNow + deviceBlockDuration;
                    this.autoBlockReason = DeviceAccessStateReason.UserAgentsChanges + (int)autoblockThresholdType;
                    this.timeToUpdateAD  = utcNow;
                    this.SaveDeviceBehavior(true);
                    if (deviceBlockDuration != EnhancedTimeSpan.Zero)
                    {
                        AirSyncCounters.AutoBlockedDevices.Increment();
                    }
                    if (this.ProtocolLogger != null)
                    {
                        this.ProtocolLogger.SetValue(ProtocolLoggerData.AutoBlockEvent, autoblockThresholdType.ToString());
                    }
                }
            }
        }
Esempio n. 14
0
        // Token: 0x06000562 RID: 1378 RVA: 0x0001F9A8 File Offset: 0x0001DBA8
        private BackOffValue GetAutoBlockBackOffTimeForSyncCommands()
        {
            int behaviorTypeIncidenceLimit = ADNotificationManager.GetAutoBlockThreshold(AutoblockThresholdType.SyncCommands).BehaviorTypeIncidenceLimit;
            EnhancedTimeSpan behaviorTypeIncidenceDuration = ADNotificationManager.GetAutoBlockThreshold(AutoblockThresholdType.SyncCommands).BehaviorTypeIncidenceDuration;

            if (behaviorTypeIncidenceDuration.TotalSeconds == 0.0)
            {
                return(BackOffValue.NoBackOffValue);
            }
            if (this.syncTimes == null || this.syncTimes.Count == 0 || this.syncTimes.Count <= behaviorTypeIncidenceLimit / 2)
            {
                AirSyncDiagnostics.TraceInfo(ExTraceGlobals.RequestsTracer, this, "GetAutoblockBackOffTime: Skip calculating backOff time.");
                return(new BackOffValue
                {
                    BackOffDuration = -1.0 * behaviorTypeIncidenceDuration.TotalSeconds,
                    BackOffType = BackOffType.Low,
                    BackOffReason = AutoblockThresholdType.SyncCommands.ToString()
                });
            }
            TimeSpan     currentDuration = ExDateTime.UtcNow.Subtract(this.syncTimes[0]);
            BackOffValue backOffValue    = this.CalculateAutoBlockBackOffTime(behaviorTypeIncidenceLimit, behaviorTypeIncidenceDuration, this.syncTimes.Count, currentDuration, AutoblockThresholdType.SyncCommands.ToString());

            AirSyncDiagnostics.TraceInfo <int, double>(ExTraceGlobals.RequestsTracer, this, "GetAutoblockBackOffTime: SyncCommandLimit:{0}, backOffDuration:{1}", behaviorTypeIncidenceLimit, backOffValue.BackOffDuration);
            return(backOffValue);
        }
Esempio n. 15
0
        // Token: 0x06000558 RID: 1368 RVA: 0x0001F11C File Offset: 0x0001D31C
        public void RecordNewUserAgent(string newUserAgent)
        {
            EnhancedTimeSpan behaviorTypeIncidenceDuration = ADNotificationManager.GetAutoBlockThreshold(AutoblockThresholdType.UserAgentsChanges).BehaviorTypeIncidenceDuration;

            lock (this.instanceLock)
            {
                if (newUserAgent != null && !this.userAgentStrings.Contains(newUserAgent))
                {
                    ExDateTime utcNow          = ExDateTime.UtcNow;
                    ExDateTime windowStartTime = utcNow - behaviorTypeIncidenceDuration;
                    DeviceBehavior.ClearOldRecords(windowStartTime, this.userAgentTimes, this.userAgentStrings);
                    this.userAgentTimes.Add(utcNow);
                    this.userAgentStrings.Add(newUserAgent);
                    this.SaveDeviceBehavior(false);
                    int behaviorTypeIncidenceLimit = ADNotificationManager.GetAutoBlockThreshold(AutoblockThresholdType.UserAgentsChanges).BehaviorTypeIncidenceLimit;
                    if (behaviorTypeIncidenceLimit > 0 && this.userAgentTimes.Count > behaviorTypeIncidenceLimit)
                    {
                        this.BlockDevice(AutoblockThresholdType.UserAgentsChanges);
                    }
                    else if (utcNow > this.blockTime && utcNow < this.nextUnblockTime)
                    {
                        this.UnblockDevice();
                    }
                }
            }
        }
Esempio n. 16
0
 internal ReplayLagStatus(bool isLagInEffect, EnhancedTimeSpan configuredLagTime, EnhancedTimeSpan actualLagTime, int lagPercentage, ReplayLagPlayDownReason playDownReason, string disabledReason)
 {
     this.Enabled           = isLagInEffect;
     this.ConfiguredLagTime = configuredLagTime;
     this.ActualLagTime     = actualLagTime;
     this.Percentage        = lagPercentage;
     this.PlayDownReason    = playDownReason;
     this.DisabledReason    = disabledReason;
 }
 public HealthData(EnhancedTimeSpan probeLatency, EnhancedTimeSpan responseLatency, int successNumber, int failedNumber, int pendingNumber, int expiredNumber)
 {
     this.probeLatency    = probeLatency;
     this.responseLatency = responseLatency;
     this.successNumber   = successNumber;
     this.failedNumber    = failedNumber;
     this.pendingNumber   = pendingNumber;
     this.expiredNumber   = expiredNumber;
 }
Esempio n. 18
0
        internal static object RetainDeletedItemsForGetter(IPropertyBag propertyBag)
        {
            int?num = propertyBag[PublicFolderSchema.RetentionAgeLimit] as int?;

            if (num != null)
            {
                return(EnhancedTimeSpan.FromSeconds((double)num.Value));
            }
            return(null);
        }
Esempio n. 19
0
        internal static void ValidateOverrideDuration(EnhancedTimeSpan?duration)
        {
            EnhancedTimeSpan zero = EnhancedTimeSpan.Zero;
            EnhancedTimeSpan t    = EnhancedTimeSpan.FromDays(365.0);

            if ((duration != null && duration.Value <= zero) || (duration != null && duration.Value > t))
            {
                throw new InvalidDurationException(zero.ToString(), t.ToString());
            }
        }
Esempio n. 20
0
        internal static object AgeLimitGetter(IPropertyBag propertyBag)
        {
            int?num = propertyBag[PublicFolderSchema.OverallAgeLimit] as int?;

            if (num != null)
            {
                return(EnhancedTimeSpan.FromSeconds((double)num.Value));
            }
            return(null);
        }
Esempio n. 21
0
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     base.InternalValidate();
     base.ValidateSProcExists("[Exchange2010].[TransportReporting_GetMessageLatency]");
     if (base.Fields.IsModified("SlaTargetTimespan") && (this.SlaTargetTimespan > EnhancedTimeSpan.FromMinutes(5.0) || this.SlaTargetTimespan < EnhancedTimeSpan.FromSeconds(1.0)))
     {
         base.WriteError(new ArgumentException(Strings.OutOfRangeSlaTaget(EnhancedTimeSpan.FromSeconds(1.0).ToString(), EnhancedTimeSpan.FromMinutes(5.0).ToString())), (ErrorCategory)1000, null);
     }
     TaskLogger.LogExit();
 }
        // Token: 0x06000675 RID: 1653 RVA: 0x00031510 File Offset: 0x0002F710
        private bool IsTimeToDie(PropertyArrayProxy itemProperties, EnhancedTimeSpan ageLimit)
        {
            if (ElcGlobals.ExpireDumpsterRightNow)
            {
                return(true);
            }
            object   obj = itemProperties[StoreObjectSchema.LastModifiedTime];
            TimeSpan t   = base.MailboxDataForTags.UtcNow - (DateTime)((ExDateTime)obj).ToUtc();

            return(t >= ageLimit);
        }
Esempio n. 23
0
 public static object ExtractNullableEnhancedTimeSpanFromSeconds(PropValue value, MapiPropertyDefinition propertyDefinition)
 {
     if (typeof(EnhancedTimeSpan?) == propertyDefinition.Type)
     {
         object obj = null;
         if (MapiPropValueConvertor.TryCastValueToExtract(value, typeof(double), out obj))
         {
             return(new EnhancedTimeSpan?(EnhancedTimeSpan.FromSeconds((double)obj)));
         }
     }
     throw MapiPropValueConvertor.ConstructExtractingException(value, propertyDefinition, Strings.ConstantNa);
 }
Esempio n. 24
0
        private void ProcessDatabaseInternal(IADDatabase db, IMonitoringADConfig adConfig)
        {
            if (db.ReplicationType != ReplicationType.Remote)
            {
                ReplayLagManager.Tracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: Database '{0}' is not a replicated database. Skipping this database.", db.Name);
                return;
            }
            IADDatabaseCopy  databaseCopy  = this.GetDatabaseCopy(db, AmServerName.LocalComputerName);
            EnhancedTimeSpan replayLagTime = databaseCopy.ReplayLagTime;

            if (replayLagTime == EnhancedTimeSpan.Zero)
            {
                ReplayLagManager.Tracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: Local copy of Database '{0}' is not a lag copy. Skipping this database.", db.Name);
                return;
            }
            ReplayLagManager.Tracer.TraceDebug <string, EnhancedTimeSpan>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: Local copy of Database '{0}' is a lag copy. Configured lag: {1}. Processing this database.", db.Name, replayLagTime);
            DatabaseAvailabilityValidator databaseAvailabilityValidator = new DatabaseAvailabilityValidator(db, ReplayLagManager.NUM_AVAILABLE_NONLAG_COPIES_MIN, this.m_statusLookup, adConfig, null, true);
            IHealthValidationResult       healthValidationResult        = databaseAvailabilityValidator.Run();
            int num = ReplayLagManager.NUM_AVAILABLE_NONLAG_COPIES_MIN;

            if (healthValidationResult.IsTargetCopyHealthy)
            {
                num++;
                ReplayLagManager.Tracer.TraceDebug <string, int>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: Local lag-copy of Database '{0}' is available. Increasing the minimum available copy count to: {1}", db.Name, num);
            }
            CopyStatusClientCachedEntry targetCopyStatus = healthValidationResult.TargetCopyStatus;

            if (healthValidationResult.HealthyCopiesCount >= num)
            {
                ReplayLagManager.Tracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: Local copy of Database '{0}' has met availability critera. Replay Lag will be re-instated as necessary.", db.Name);
                if (this.m_errorSuppression.ReportSuccess(db.Guid, ReplayLagManager.EnableLagSuppressionWindow))
                {
                    this.EnableReplayLag(db, targetCopyStatus);
                    return;
                }
                ReplayLagManager.Tracer.TraceDebug <string, double>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: '{0}': Skipping EnableReplayLag() due to transient suppression of {1} secs", db.Name, ReplayLagManager.EnableLagSuppressionWindow.TotalSeconds);
                return;
            }
            else
            {
                ReplayLagManager.Tracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: Local copy of Database '{0}' has *NOT* met availability critera. Replay Lag will be played down as necessary.", db.Name);
                string errorMessageWithoutFullStatus = healthValidationResult.ErrorMessageWithoutFullStatus;
                if (this.m_errorSuppression.ReportFailure(db.Guid, ReplayLagManager.DisableLagSuppressionWindow))
                {
                    this.DisableReplayLag(db, targetCopyStatus, errorMessageWithoutFullStatus);
                    return;
                }
                ReplayLagManager.Tracer.TraceDebug <string, double>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: '{0}': Skipping DisableReplayLag() due to transient suppression of {1} secs", db.Name, ReplayLagManager.DisableLagSuppressionWindow.TotalSeconds);
                ReplayCrimsonEvents.RLMDisableReplayLagRequestSuppressed.LogPeriodic <string, string, Guid, string, TimeSpan>(Environment.MachineName, DateTimeHelper.FourHours, db.Name, Environment.MachineName, db.Guid, errorMessageWithoutFullStatus, ReplayLagManager.DisableLagSuppressionWindow);
                return;
            }
        }
Esempio n. 25
0
        public static void OnPrePopImapSetting(string prefix, DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            DataRow dataRow = dataTable.Rows[0];

            if (!DBNull.Value.Equals(dataRow[prefix + "PreAuthenticatedConnectionTimeout"]))
            {
                inputRow[prefix + "PreAuthenticatedConnectionTimeout"] = EnhancedTimeSpan.FromSeconds(Convert.ToDouble(dataRow[prefix + "PreAuthenticatedConnectionTimeout"]));
            }
            if (!DBNull.Value.Equals(dataRow[prefix + "AuthenticatedConnectionTimeout"]))
            {
                inputRow[prefix + "AuthenticatedConnectionTimeout"] = EnhancedTimeSpan.FromSeconds(Convert.ToDouble(dataRow[prefix + "AuthenticatedConnectionTimeout"]));
            }
        }
Esempio n. 26
0
        internal static object MaximumPasswordAgeGetter(IPropertyBag propertyBag)
        {
            long?num = (long?)propertyBag[ADDomainSchema.MaximumPasswordAgeRaw];

            if (num == null)
            {
                return(null);
            }
            if (num.Value == -9223372036854775808L)
            {
                return(EnhancedTimeSpan.Zero);
            }
            return(new EnhancedTimeSpan?(EnhancedTimeSpan.FromTicks(-num.Value)));
        }
        protected override string FormatObject(string format, object arg, IFormatProvider formatProvider)
        {
            EnhancedTimeSpan enhancedTimeSpan = (EnhancedTimeSpan)arg;

            if (enhancedTimeSpan.Days > 0)
            {
                return(Strings.EnhancedTimeSpanDetailedFormat(enhancedTimeSpan.Days, enhancedTimeSpan.Hours, enhancedTimeSpan.Minutes));
            }
            if (enhancedTimeSpan.Hours > 0)
            {
                return(Strings.EnhancedTimeSpanDetailedFormatWithoutDays(enhancedTimeSpan.Hours, enhancedTimeSpan.Minutes));
            }
            return(Strings.EnhancedTimeSpanDetailedFormatWithoutHours(enhancedTimeSpan.Minutes));
        }
        public static void SetObjectPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            DataRow       dataRow = dataTable.Rows[0];
            List <string> list    = new List <string>();

            if (DBNull.Value != inputRow["IssueWarningQuota"] || DBNull.Value != inputRow["ProhibitPostQuota"] || DBNull.Value != inputRow["MaxItemSize"] || DBNull.Value != inputRow["IsStorageQuotasSet"])
            {
                if (DBNull.Value != inputRow["IsStorageQuotasSet"] && (bool)inputRow["IsStorageQuotasSet"])
                {
                    dataRow["IssueWarningQuota"] = Unlimited <ByteQuantifiedSize> .UnlimitedString;
                    dataRow["ProhibitPostQuota"] = Unlimited <ByteQuantifiedSize> .UnlimitedString;
                    dataRow["MaxItemSize"]       = Unlimited <ByteQuantifiedSize> .UnlimitedString;
                }
                MailboxPropertiesHelper.SaveQuotaProperty(dataRow, "IsStorageQuotasSet", "IssueWarningQuota", list);
                MailboxPropertiesHelper.SaveQuotaProperty(dataRow, "IsStorageQuotasSet", "ProhibitPostQuota", list);
                MailboxPropertiesHelper.SaveQuotaProperty(dataRow, "IsStorageQuotasSet", "MaxItemSize", list);
            }
            if (DBNull.Value != inputRow["RetainDeletedItemsFor"] || DBNull.Value != inputRow["IsRetainDeletedItemsForSet"])
            {
                if (DBNull.Value != inputRow["IsRetainDeletedItemsForSet"] && (bool)inputRow["IsRetainDeletedItemsForSet"])
                {
                    dataRow["RetainDeletedItemsFor"] = null;
                }
                else
                {
                    dataRow["RetainDeletedItemsFor"] = EnhancedTimeSpan.Parse((string)dataRow["RetainDeletedItemsFor"]);
                }
                list.Add("RetainDeletedItemsFor");
                list.Add("IsRetainDeletedItemsForSet");
            }
            if (DBNull.Value != inputRow["AgeLimit"] || DBNull.Value != inputRow["IsAgeLimitSet"])
            {
                if (DBNull.Value != inputRow["IsAgeLimitSet"] && (bool)inputRow["IsAgeLimitSet"])
                {
                    dataRow["AgeLimit"] = null;
                }
                else
                {
                    dataRow["AgeLimit"] = EnhancedTimeSpan.Parse((string)dataRow["AgeLimit"]);
                }
                list.Add("AgeLimit");
                list.Add("IsAgeLimitSet");
            }
            MailboxPropertiesHelper.SetMaxSendReceiveSize(inputRow, dataTable, store);
            if (list.Count > 0)
            {
                store.SetModifiedColumns(list);
            }
        }
Esempio n. 29
0
 protected override void InternalValidate()
 {
     base.InternalValidate();
     this.helper.ParseAndValidateIdentity(this.Identity, false);
     if (base.Fields.IsModified("ApplyVersion"))
     {
         MonitoringOverrideHelpers.ValidateApplyVersion(this.ApplyVersion);
     }
     if (base.Fields.IsModified("Duration"))
     {
         MonitoringOverrideHelpers.ValidateOverrideDuration(this.Duration);
         return;
     }
     this.Duration = new EnhancedTimeSpan?(EnhancedTimeSpan.FromDays(365.0));
 }
Esempio n. 30
0
        internal static EnhancedTimeSpan GetTimespanValueFromMultivaluedProperty(string name, IEnumerable <string> property, EnhancedTimeSpan defaultValue)
        {
            string stringValueFromMultivaluedProperty = MultivaluedPropertyAccessors.GetStringValueFromMultivaluedProperty(name, property, null);

            if (string.IsNullOrEmpty(stringValueFromMultivaluedProperty))
            {
                return(defaultValue);
            }
            EnhancedTimeSpan result;

            if (EnhancedTimeSpan.TryParse(stringValueFromMultivaluedProperty, out result))
            {
                return(result);
            }
            return(defaultValue);
        }