Exemple #1
0
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     base.InternalValidate();
     if (base.HasErrors)
     {
         return;
     }
     if (this.LogLocation != null && this.LogLocation.Length > 0)
     {
         List <CalendarLog> list = new List <CalendarLog>();
         foreach (string identity in this.LogLocation)
         {
             list.AddRange(CalendarLog.Parse(identity));
         }
         this.CalendarLogs = list.ToArray();
     }
     else if (this.CalendarLogs.Count <CalendarLog>() == 0)
     {
         base.WriteError(new InvalidADObjectOperationException(Strings.CalendarLogsNotFound), ErrorCategory.InvalidData, null);
     }
     foreach (CalendarLog calendarLog in this.CalendarLogs)
     {
         if (calendarLog.IsFileLink != this.CalendarLogs.First <CalendarLog>().IsFileLink)
         {
             base.WriteError(new InvalidADObjectOperationException(Strings.CalendarAnalysisMixedModeNotSupported), ErrorCategory.InvalidData, null);
         }
     }
     TaskLogger.LogExit();
 }
Exemple #2
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            CalendarLog calendarLog = this.CalendarLogs.FirstOrDefault <CalendarLog>();

            if (calendarLog == null)
            {
                return;
            }
            CalendarDiagnosticAnalyzer calendarDiagnosticAnalyzer;

            if (calendarLog.IsFileLink)
            {
                calendarDiagnosticAnalyzer = new CalendarDiagnosticAnalyzer(null, this.DetailLevel);
            }
            else
            {
                CalendarLogId calendarLogId = calendarLog.Identity as CalendarLogId;
                UriHandler    uriHandler    = new UriHandler(calendarLogId.Uri);
                string        host          = uriHandler.Host;
                SmtpAddress   address       = new SmtpAddress(uriHandler.UserName, host);
                if (!address.IsValidAddress)
                {
                    base.WriteError(new InvalidADObjectOperationException(Strings.Error_InvalidAddress((string)address)), ErrorCategory.InvalidData, null);
                }
                ExchangePrincipal principal = ExchangePrincipal.FromProxyAddress(ADSessionSettings.RootOrgOrSingleTenantFromAcceptedDomainAutoDetect(host), (string)address, RemotingOptions.AllowCrossSite);
                calendarDiagnosticAnalyzer = new CalendarDiagnosticAnalyzer(principal, this.DetailLevel);
            }
            try
            {
                CalendarLog[] array;
                if (!string.IsNullOrEmpty(this.GlobalObjectId))
                {
                    array = (from f in this.CalendarLogs
                             where f.CleanGlobalObjectId == this.GlobalObjectId
                             select f).ToArray <CalendarLog>();
                }
                else
                {
                    array = this.CalendarLogs;
                }
                CalendarLog[] calendarLogs             = array;
                IEnumerable <CalendarLogAnalysis> logs = calendarDiagnosticAnalyzer.AnalyzeLogs(calendarLogs);
                base.WriteObject(CalendarLogAnalysisSerializer.Serialize(logs, this.OutputAs, this.DetailLevel, true));
            }
            catch (InvalidLogCollectionException)
            {
                base.WriteError(new InvalidADObjectOperationException(Strings.Error_MultipleItemsFound), ErrorCategory.InvalidData, null);
            }
            TaskLogger.LogExit();
        }
        internal IEnumerable <CalendarLogAnalysis> AnalyzeLogs(IEnumerable <CalendarLog> calendarLogs)
        {
            CalendarLog calendarLog = calendarLogs.FirstOrDefault <CalendarLog>();
            IEnumerable <CalendarLogAnalysis> enumerable;

            if (calendarLog != null && calendarLog.IsFileLink)
            {
                enumerable = this.LoadMsgLogs(calendarLogs);
            }
            else
            {
                enumerable = this.LoadMailboxLogs(calendarLogs);
            }
            string[] array = null;
            if (!this.VerifyItemCohesion(enumerable, out array))
            {
                throw new InvalidLogCollectionException();
            }
            enumerable.OrderBy((CalendarLogAnalysis f) => f, CalendarLogAnalysis.GetComparer());
            return(this.PerformAnalysis(enumerable));
        }