Tx.Bond.BinaryEtwParser.ParseV1 C# (CSharp) Method

ParseV1() private static method

private static ParseV1 ( Tx.Windows.EtwNativeEvent etwNativeEvent ) : Envelope
etwNativeEvent Tx.Windows.EtwNativeEvent
return System.Reactive.Envelope
        private static Envelope ParseV1(EtwNativeEvent etwNativeEvent)
        {
            // EventId is one. This is a log written using EventSource Byte Array logging support.
            // Reading like this ensures that if exception is thrown, we know what failed
            long occurenceFileTimeUtc = etwNativeEvent.ReadInt64();
            long receiveFileTimeUtc = etwNativeEvent.ReadInt64();
            string protocol = etwNativeEvent.ReadUnicodeString();
            string source = etwNativeEvent.ReadUnicodeString();
            string manifestId = etwNativeEvent.ReadUnicodeString();
            uint eventPayloadLength = etwNativeEvent.ReadUInt32(); // There is a side-effect being used here with the binary length.
            etwNativeEvent.ReadInt32(); // EventSource based byte array writer actually stores the byte array length here. Skip 4 bytes to account for it.
            byte[] eventPayload = etwNativeEvent.ReadBytes();

            return new Envelope(
                occurenceFileTimeUtc >= 0
                    ? DateTimeOffset.FromFileTime(occurenceFileTimeUtc)
                    : DateTimeOffset.MinValue,
                receiveFileTimeUtc >= 0
                    ? DateTimeOffset.FromFileTime(receiveFileTimeUtc)
                    : DateTimeOffset.MinValue,
                protocol,
                source,
                manifestId,
                eventPayload,
                null);
        }