public bool Equals(EventSourceManifest other)
 {
     return(this.providerGuid.Equals(other.providerGuid) &&
            this.format == other.format &&
            this.majorVersion == other.majorVersion &&
            this.minorVersion == other.minorVersion &&
            this.magic == other.magic &&
            this.totalChunks == other.totalChunks);
 }
Example #2
0
        private static unsafe EventSourceManifest CreateEventSourceManifest(Guid providerGuid, Dictionary <Guid, EventSourceManifest> cache, EVENT_RECORD *eventRecord, EventRecordReader eventRecordReader)
        {
            // EventSource Schema events have the following signature:
            // { byte Format, byte MajorVersion, byte MinorVersion, byte Magic, ushort TotalChunks, ushort ChunkNumber } == 8 bytes, followed by the XML schema
            if (eventRecord->UserDataLength <= 8)
            {
                return(null);
            }

            var    format       = eventRecordReader.ReadUInt8();
            var    majorVersion = eventRecordReader.ReadUInt8();
            var    minorVersion = eventRecordReader.ReadUInt8();
            var    magic        = eventRecordReader.ReadUInt8();
            ushort totalChunks  = eventRecordReader.ReadUInt16();
            ushort chunkNumber  = eventRecordReader.ReadUInt16();

            if (!(format == 1 && magic == 0x5B))
            {
                return(null);
            }

            EventSourceManifest manifest;

            if (!cache.TryGetValue(providerGuid, out manifest))
            {
                manifest = new EventSourceManifest(eventRecord->ProviderId, format, majorVersion, minorVersion, magic, totalChunks);
                cache.Add(providerGuid, manifest);
            }

            // if manifest is complete, maybe the data changed? ideally version should have changed
            // this is essentially a reset
            if (manifest.IsComplete && chunkNumber == 0)
            {
                cache[providerGuid] = manifest;
            }

            string schemaChunk = eventRecordReader.ReadAnsiString();

            manifest.AddChunk(schemaChunk);

            return(manifest);
        }
 public bool Equals(EventSourceManifest other)
 {
     return this.providerGuid.Equals(other.providerGuid)
            && this.format == other.format
            && this.majorVersion == other.majorVersion
            && this.minorVersion == other.minorVersion
            && this.magic == other.magic
            && this.totalChunks == other.totalChunks;
 }