public TimelinePostprocessorOutput(LogSourcePostprocessorDeserializationParams p, IEntitiesComparer entitiesComparer, ILogPartTokenFactories logPartTokenFactories)
        {
            this.logSource = p.LogSource;

            if (!p.Reader.ReadToFollowing("root"))
            {
                throw new FormatException();
            }
            etag.Read(p.Reader);

            var eventsDeserializer = new EventsDeserializer(TextLogEventTrigger.DeserializerFunction);
            var events             = new List <Event>();

            foreach (var elt in p.Reader.ReadChildrenElements())
            {
                if (eventsDeserializer.TryDeserialize(elt, out var evt))
                {
                    events.Add(evt);
                }
                else if (logPartTokenFactories.TryReadLogPartToken(elt, out var tmp))
                {
                    this.rotatedLogPartToken = tmp;
                }
                p.Cancellation.ThrowIfCancellationRequested();
            }
            this.timelineEvents = events.AsReadOnly();
        }
        public TimelinePostprocessorOutput(XDocument doc, ILogSource logSource, IEntitiesComparer entitiesComparer, ILogPartTokenFactory rotatedLogPartFactory)
        {
            this.logSource = logSource;
            var eventsDeserializer = new EventsDeserializer(TextLogEventTrigger.DeserializerFunction);

            this.timelineEvents      = eventsDeserializer.Deserialize(doc.Root).ToList().AsReadOnly();
            this.rotatedLogPartToken = rotatedLogPartFactory.SafeDeserializeLogPartToken(doc.Root);
        }
Esempio n. 3
0
        public SequenceDiagramPostprocessorOutput(LogSourcePostprocessorDeserializationParams p, ILogPartTokenFactory rotatedLogPartFactory)
        {
            this.logSource = p.LogSource;
            var reader = p.Reader;

            events              = new List <M.Event>();
            timelineComments    = new List <TLBlock.Event>();
            stateComments       = new List <SIBlock.Event>();
            rotatedLogPartToken = new NullLogPartToken();

            if (!reader.ReadToFollowing("root"))
            {
                throw new FormatException();
            }
            etag.Read(reader);

            if (reader.ReadToFollowing(messagingEventsElementName))
            {
                var eventsDeserializer = new M.EventsDeserializer(TextLogEventTrigger.DeserializerFunction);
                foreach (var elt in reader.ReadChildrenElements())
                {
                    if (eventsDeserializer.TryDeserialize(elt, out var evt))
                    {
                        events.Add(evt);
                    }
                }
            }
            if (reader.ReadToFollowing(timelineCommentsElementName))
            {
                var eventsDeserializer = new TLBlock.EventsDeserializer(TextLogEventTrigger.DeserializerFunction);
                foreach (var elt in reader.ReadChildrenElements())
                {
                    if (eventsDeserializer.TryDeserialize(elt, out var evt))
                    {
                        timelineComments.Add(evt);
                    }
                }
            }
            if (reader.ReadToFollowing(stateCommentsElementName))
            {
                var eventsDeserializer = new SIBlock.EventsDeserializer(TextLogEventTrigger.DeserializerFunction);
                foreach (var elt in reader.ReadChildrenElements())
                {
                    if (eventsDeserializer.TryDeserialize(elt, out var evt))
                    {
                        stateComments.Add(evt);
                    }
                }
            }
        }