コード例 #1
0
        public byte[]? GenerateEventMetadata(EventMetadata eventMetadata)
        {
            ParameterInfo[]      parameters  = eventMetadata.Parameters;
            EventParameterInfo[] eventParams = new EventParameterInfo[parameters.Length];
            for (int i = 0; i < parameters.Length; i++)
            {
                eventParams[i].SetInfo(parameters[i].Name !, parameters[i].ParameterType);
            }

            return(GenerateMetadata(
                       eventMetadata.Descriptor.EventId,
                       eventMetadata.Name,
                       eventMetadata.Descriptor.Keywords,
                       eventMetadata.Descriptor.Level,
                       eventMetadata.Descriptor.Version,
                       eventParams));
        }
コード例 #2
0
        public byte[]? GenerateEventMetadata(EventMetadata eventMetadata)
        {
            ParameterInfo[]      parameters  = eventMetadata.Parameters;
            EventParameterInfo[] eventParams = new EventParameterInfo[parameters.Length];
            for (int i = 0; i < parameters.Length; i++)
            {
                EventParameterInfo.GetTypeInfoFromType(parameters[i].ParameterType, out TraceLoggingTypeInfo? paramTypeInfo);
                eventParams[i].SetInfo(parameters[i].Name !, parameters[i].ParameterType, paramTypeInfo);
            }

            return(GenerateMetadata(
                       eventMetadata.Descriptor.EventId,
                       eventMetadata.Name,
                       eventMetadata.Descriptor.Keywords,
                       eventMetadata.Descriptor.Level,
                       eventMetadata.Descriptor.Version,
                       (EventOpcode)eventMetadata.Descriptor.Opcode,
                       eventParams));
        }
コード例 #3
0
        public byte[]? GenerateEventMetadata(
            int eventId,
            string eventName,
            EventKeywords keywords,
            EventLevel level,
            uint version,
            TraceLoggingEventTypes eventTypes)
        {
            TraceLoggingTypeInfo[] typeInfos = eventTypes.typeInfos;
            string[]? paramNames = eventTypes.paramNames;
            EventParameterInfo[] eventParams = new EventParameterInfo[typeInfos.Length];
            for (int i = 0; i < typeInfos.Length; i++)
            {
                string paramName = string.Empty;
                if (paramNames != null)
                {
                    paramName = paramNames[i];
                }
                eventParams[i].SetInfo(paramName, typeInfos[i].DataType, typeInfos[i]);
            }

            return(GenerateMetadata(eventId, eventName, (long)keywords, (uint)level, version, eventParams));
        }