예제 #1
0
 public PropertyAnalysis(string name, MethodInfo getterInfo, TraceLoggingTypeInfo typeInfo, EventFieldAttribute fieldAttribute)
 {
     this.name           = name;
     this.getterInfo     = getterInfo;
     this.typeInfo       = typeInfo;
     this.fieldAttribute = fieldAttribute;
 }
예제 #2
0
        // Token: 0x06003526 RID: 13606 RVA: 0x000CE2FC File Offset: 0x000CC4FC
        public override void WriteMetadata(TraceLoggingMetadataCollector collector, string name, EventFieldFormat format)
        {
            TraceLoggingMetadataCollector traceLoggingMetadataCollector = collector.AddGroup(name);

            if (this.properties != null)
            {
                foreach (PropertyAnalysis propertyAnalysis in this.properties)
                {
                    EventFieldFormat    format2        = EventFieldFormat.Default;
                    EventFieldAttribute fieldAttribute = propertyAnalysis.fieldAttribute;
                    if (fieldAttribute != null)
                    {
                        traceLoggingMetadataCollector.Tags = fieldAttribute.Tags;
                        format2 = fieldAttribute.Format;
                    }
                    propertyAnalysis.typeInfo.WriteMetadata(traceLoggingMetadataCollector, propertyAnalysis.name, format2);
                }
            }
        }
예제 #3
0
        public TypeAnalysis(Type dataType, EventDataAttribute eventAttrib, List <Type> recursionCheck)
        {
            IEnumerable <PropertyInfo> properties           = Statics.GetProperties(dataType);
            List <PropertyAnalysis>    propertyAnalysisList = new List <PropertyAnalysis>();

            foreach (PropertyInfo propInfo in properties)
            {
                if (!Statics.HasCustomAttribute(propInfo, typeof(EventIgnoreAttribute)) && propInfo.CanRead && propInfo.GetIndexParameters().Length == 0)
                {
                    MethodInfo getMethod = Statics.GetGetMethod(propInfo);
                    if (!(getMethod == (MethodInfo)null) && !getMethod.IsStatic && getMethod.IsPublic)
                    {
                        TraceLoggingTypeInfo typeInfoInstance = Statics.GetTypeInfoInstance(propInfo.PropertyType, recursionCheck);
                        EventFieldAttribute  customAttribute  = Statics.GetCustomAttribute <EventFieldAttribute>(propInfo);
                        string name = customAttribute == null || customAttribute.Name == null ? (Statics.ShouldOverrideFieldName(propInfo.Name) ? typeInfoInstance.Name : propInfo.Name) : customAttribute.Name;
                        propertyAnalysisList.Add(new PropertyAnalysis(name, getMethod, typeInfoInstance, customAttribute));
                    }
                }
            }
            this.properties = propertyAnalysisList.ToArray();
            foreach (PropertyAnalysis property in this.properties)
            {
                TraceLoggingTypeInfo traceLoggingTypeInfo = property.typeInfo;
                this.level    = (EventLevel)Statics.Combine((int)traceLoggingTypeInfo.Level, (int)this.level);
                this.opcode   = (EventOpcode)Statics.Combine((int)traceLoggingTypeInfo.Opcode, (int)this.opcode);
                this.keywords = this.keywords | traceLoggingTypeInfo.Keywords;
                this.tags     = this.tags | traceLoggingTypeInfo.Tags;
            }
            if (eventAttrib != null)
            {
                this.level    = (EventLevel)Statics.Combine((int)eventAttrib.Level, (int)this.level);
                this.opcode   = (EventOpcode)Statics.Combine((int)eventAttrib.Opcode, (int)this.opcode);
                this.keywords = this.keywords | eventAttrib.Keywords;
                this.tags     = this.tags | eventAttrib.Tags;
                this.name     = eventAttrib.Name;
            }
            if (this.name != null)
            {
                return;
            }
            this.name = dataType.Name;
        }
예제 #4
0
        public override void WriteMetadata(TraceLoggingMetadataCollector collector, string name, EventFieldFormat format)
        {
            TraceLoggingMetadataCollector collector1 = collector.AddGroup(name);

            if (this.properties == null)
            {
                return;
            }
            foreach (PropertyAnalysis property in this.properties)
            {
                EventFieldFormat    format1             = EventFieldFormat.Default;
                EventFieldAttribute eventFieldAttribute = property.fieldAttribute;
                if (eventFieldAttribute != null)
                {
                    collector1.Tags = eventFieldAttribute.Tags;
                    format1         = eventFieldAttribute.Format;
                }
                property.typeInfo.WriteMetadata(collector1, property.name, format1);
            }
        }