示例#1
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();
        }
示例#2
0
        internal static string Serialize(IEnumerable <CalendarLogAnalysis> logs, OutputType outputType, AnalysisDetailLevel detailLevel, bool showAll)
        {
            IEnumerable <PropertyDefinition> propertyMask = showAll ? new List <PropertyDefinition>() : CalendarLogAnalysisSerializer.FindUnchangedProperties(logs);
            LogSerializer logSerializer;

            switch (outputType)
            {
            case OutputType.HTML:
                logSerializer = new HtmlLogSerializer(propertyMask);
                goto IL_42;

            case OutputType.XML:
                logSerializer = new XmlLogSerializer(propertyMask);
                goto IL_42;
            }
            logSerializer = new CsvLogSerializer(propertyMask);
IL_42:
            IEnumerable <PropertyDefinition> properties = AnalysisDetailLevels.GetDisplayProperties(detailLevel).Union(CalendarLogAnalysis.GetDisplayProperties(logs));

            logs.OrderBy((CalendarLogAnalysis f) => f, CalendarLogAnalysis.GetComparer());
            return(logSerializer.Serialize(logs, properties, null));
        }