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());
        }
 public override void SaveComponentSettings()
 {
     this.QueueSettings.PageSize           = this.PageSize;
     this.QueueSettings.AutoRefreshEnabled = this.AutoRefreshEnabled;
     this.QueueSettings.RefreshInterval    = EnhancedTimeSpan.FromSeconds((double)this.RefreshInterval);
     base.SaveComponentSettings();
 }
 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);
         }
     }
 }
Пример #4
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);
        }
Пример #5
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);
        }
Пример #6
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();
 }
Пример #7
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);
 }
Пример #8
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"]));
            }
        }
Пример #9
0
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     if (!base.Fields.IsModified("IgnoreTimeout"))
     {
         this.IgnoreTimeout = false;
     }
     if (!base.Fields.IsModified("MaximumWaitTime"))
     {
         this.MaximumWaitTime = EnhancedTimeSpan.FromMinutes(15.0);
     }
     if (!base.Fields.IsModified("MaxWaitTimeForRunningState"))
     {
         this.MaxWaitTimeForRunningState = EnhancedTimeSpan.FromSeconds(20.0);
     }
     base.InternalValidate();
     TaskLogger.LogExit();
 }
Пример #10
0
        public static string FromTimeSpan(this string span, TimeUnit factor)
        {
            if (string.IsNullOrWhiteSpace(span))
            {
                throw new ArgumentNullException("span");
            }
            if (factor < TimeUnit.Second || factor > TimeUnit.Day)
            {
                throw new ArgumentOutOfRangeException("factor");
            }
            string result;

            try
            {
                switch (factor)
                {
                case TimeUnit.Second:
                    result = EnhancedTimeSpan.FromSeconds(Math.Round(Convert.ToDouble(span), 0)).ToString();
                    break;

                case TimeUnit.Minute:
                    result = EnhancedTimeSpan.FromSeconds(Math.Round(Convert.ToDouble(span) * 60.0, 0)).ToString();
                    break;

                case TimeUnit.Hour:
                    result = EnhancedTimeSpan.FromSeconds(Math.Round(Convert.ToDouble(span) * 3600.0, 0)).ToString();
                    break;

                default:
                    result = EnhancedTimeSpan.FromSeconds(Math.Round(Convert.ToDouble(span) * 86400.0, 0)).ToString();
                    break;
                }
            }
            catch (FormatException)
            {
                throw new ArgumentException("String '" + span + "' is not of the expected number format.");
            }
            catch (OverflowException)
            {
                throw new ArgumentException("String '" + span + "' is outside the allowable numeric range.");
            }
            return(result);
        }
        private void commandOptions_Execute(object sender, EventArgs e)
        {
            QueueViewerOptions queueViewerOptions = new QueueViewerOptions(this.AutoRefreshEnabled, EnhancedTimeSpan.FromSeconds((double)this.RefreshInterval), (uint)this.PageSize);
            DataContext        context            = new DataContext(new ExchangeDataHandler
            {
                DataSource = queueViewerOptions
            });

            using (PropertyPageDialog propertyPageDialog = new PropertyPageDialog(new QueueViewerPropertyPage
            {
                Context = context
            }))
            {
                propertyPageDialog.LinkIsDirtyToOkEnabled = true;
                if (this.ShowDialog(propertyPageDialog) == DialogResult.OK)
                {
                    this.AutoRefreshEnabled = queueViewerOptions.AutoRefreshEnabled;
                    this.RefreshInterval    = (int)queueViewerOptions.RefreshInterval.TotalSeconds;
                    this.PageSize           = (int)queueViewerOptions.PageSize;
                }
            }
        }
        // Token: 0x06000EF1 RID: 3825 RVA: 0x00058A20 File Offset: 0x00056C20
        public override void Invoke()
        {
            PublicFolderAssistantLogger publicFolderAssistantLogger = null;

            try
            {
                publicFolderAssistantLogger = new PublicFolderAssistantLogger(this.publicFolderSession);
                using (Folder folder = PublicFolderItemProcessor.xsoFactory.BindToFolder(this.publicFolderSession, this.publicFolderSession.GetPublicFolderRootId()) as Folder)
                {
                    using (QueryResult queryResult = folder.FolderQuery(FolderQueryFlags.DeepTraversal | FolderQueryFlags.NoNotifications, null, null, PublicFolderItemProcessor.FolderRec.PropertiesToLoad))
                    {
                        for (;;)
                        {
                            object[][] rows = queryResult.GetRows(100);
                            if (rows.Length <= 0)
                            {
                                break;
                            }
                            foreach (object[] properties in rows)
                            {
                                PublicFolderItemProcessor.FolderRec folderRec = new PublicFolderItemProcessor.FolderRec(this.publicFolderSession, properties);
                                if (folderRec.FolderId != null && !folderRec.FolderId.Equals(this.publicFolderSession.GetTombstonesRootFolderId()))
                                {
                                    if ((folderRec.FolderId.Equals(this.publicFolderSession.GetAsyncDeleteStateFolderId()) || folderRec.IsDumpsterFolder) && folderRec.SubfolderCount > 0 && this.publicFolderSession.IsPrimaryHierarchySession)
                                    {
                                        int?retentionAgeLimit = folderRec.RetentionAgeLimit;
                                        if (retentionAgeLimit == null && this.Organization.DefaultPublicFolderDeletedItemRetention != null)
                                        {
                                            retentionAgeLimit = new int?((int)this.Organization.DefaultPublicFolderDeletedItemRetention.Value.TotalSeconds);
                                        }
                                        if (retentionAgeLimit != null)
                                        {
                                            this.HardDeleteSubFolders(folderRec, this.now.Subtract(EnhancedTimeSpan.FromSeconds((double)retentionAgeLimit.Value)), publicFolderAssistantLogger);
                                        }
                                    }
                                    if (folderRec.TotalItemCount != 0)
                                    {
                                        if (folderRec.ContentMailboxGuid != this.publicFolderSession.MailboxGuid)
                                        {
                                            ExDateTime?lastMovedTimeStamp = folderRec.LastMovedTimeStamp;
                                            if (lastMovedTimeStamp != null)
                                            {
                                                int?   num          = new int?((int)this.Organization.DefaultPublicFolderMovedItemRetention.Value.TotalSeconds);
                                                double totalSeconds = this.now.Subtract(lastMovedTimeStamp.Value).TotalSeconds;
                                                int?   num2         = num;
                                                if (totalSeconds >= (double)num2.GetValueOrDefault() && num2 != null)
                                                {
                                                    this.HardDeleteItems(folderRec, ExDateTime.MaxValue, publicFolderAssistantLogger, "PublicFolderContentsFromMove");
                                                }
                                            }
                                        }
                                        else if (folderRec.IsDumpsterFolder)
                                        {
                                            int?retentionAgeLimit2 = folderRec.RetentionAgeLimit;
                                            if (retentionAgeLimit2 == null && this.Organization.DefaultPublicFolderDeletedItemRetention != null)
                                            {
                                                retentionAgeLimit2 = new int?((int)this.Organization.DefaultPublicFolderDeletedItemRetention.Value.TotalSeconds);
                                            }
                                            if (retentionAgeLimit2 != null)
                                            {
                                                this.HardDeleteItems(folderRec, this.now.Subtract(EnhancedTimeSpan.FromSeconds((double)retentionAgeLimit2.Value)), publicFolderAssistantLogger, "PublicFolderDeletedItemExpiration");
                                            }
                                        }
                                        else
                                        {
                                            int?overallAgeLimit = folderRec.OverallAgeLimit;
                                            if (overallAgeLimit == null && this.Organization.DefaultPublicFolderAgeLimit != null)
                                            {
                                                overallAgeLimit = new int?((int)this.Organization.DefaultPublicFolderAgeLimit.Value.TotalSeconds);
                                            }
                                            if (overallAgeLimit != null && folderRec.DumpsterId != null)
                                            {
                                                this.SoftDeleteItems(folderRec, this.now.Subtract(EnhancedTimeSpan.FromSeconds((double)overallAgeLimit.Value)), publicFolderAssistantLogger);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                publicFolderAssistantLogger.TrySave();
            }
            catch (StoragePermanentException ex)
            {
                if (publicFolderAssistantLogger != null)
                {
                    publicFolderAssistantLogger.ReportError("Error occurred while processing items", ex);
                    publicFolderAssistantLogger.TrySave();
                }
                else
                {
                    PublicFolderAssistantLogger.LogOnServer(ex);
                }
            }
            catch (StorageTransientException ex2)
            {
                if (publicFolderAssistantLogger != null)
                {
                    publicFolderAssistantLogger.ReportError("Error occurred while processing items", ex2);
                    publicFolderAssistantLogger.TrySave();
                }
                else
                {
                    PublicFolderAssistantLogger.LogOnServer(ex2);
                }
            }
            catch (Exception ex3)
            {
                if (publicFolderAssistantLogger != null)
                {
                    publicFolderAssistantLogger.ReportError("Error occurred while processing items", ex3);
                    publicFolderAssistantLogger.TrySave();
                }
                else
                {
                    PublicFolderAssistantLogger.LogOnServer(ex3);
                }
                throw;
            }
            finally
            {
                if (publicFolderAssistantLogger != null)
                {
                    publicFolderAssistantLogger.Dispose();
                    publicFolderAssistantLogger = null;
                }
            }
        }
Пример #13
0
 protected override object ParseObject(string s, IFormatProvider provider)
 {
     return(EnhancedTimeSpan.FromSeconds((double)long.Parse(s)));
 }