示例#1
0
        private static TraceLoggingTypeInfo[] MakeArray(Type[] types)
        {
            if (types is null)
            {
                throw new ArgumentNullException(nameof(types));
            }

            var recursionCheck = new List <Type>(types.Length);
            var result         = new TraceLoggingTypeInfo[types.Length];

            for (int i = 0; i < types.Length; i++)
            {
                result[i] = TraceLoggingTypeInfo.GetInstance(types[i], recursionCheck);
            }

            return(result);
        }
示例#2
0
        private static TraceLoggingTypeInfo[] MakeArray(System.Reflection.ParameterInfo[] paramInfos)
        {
            if (paramInfos is null)
            {
                throw new ArgumentNullException(nameof(paramInfos));
            }

            var recursionCheck = new List <Type>(paramInfos.Length);
            var result         = new TraceLoggingTypeInfo[paramInfos.Length];

            for (int i = 0; i < paramInfos.Length; ++i)
            {
                result[i] = TraceLoggingTypeInfo.GetInstance(paramInfos[i].ParameterType, recursionCheck);
            }

            return(result);
        }
示例#3
0
        public KeyValuePairTypeInfo(List <Type> recursionCheck)
        {
            this.keyInfo = TraceLoggingTypeInfo <K> .GetInstance(recursionCheck);

            this.valueInfo = TraceLoggingTypeInfo <V> .GetInstance(recursionCheck);
        }
示例#4
0
        public TypeAnalysis(
            Type dataType,
            EventDataAttribute?eventAttrib,
            List <Type> recursionCheck)
        {
            var propertyList = new List <PropertyAnalysis>();

            foreach (PropertyInfo propertyInfo in dataType.GetProperties())
            {
                if (Statics.HasCustomAttribute(propertyInfo, typeof(EventIgnoreAttribute)))
                {
                    continue;
                }

                if (!propertyInfo.CanRead ||
                    propertyInfo.GetIndexParameters().Length != 0)
                {
                    continue;
                }

                MethodInfo?getterInfo = propertyInfo.GetGetMethod();
                if (getterInfo == null)
                {
                    continue;
                }

                if (getterInfo.IsStatic || !getterInfo.IsPublic)
                {
                    continue;
                }

                Type propertyType     = propertyInfo.PropertyType;
                var  propertyTypeInfo = TraceLoggingTypeInfo.GetInstance(propertyType, recursionCheck);
                EventFieldAttribute?fieldAttribute = Statics.GetCustomAttribute <EventFieldAttribute>(propertyInfo);

                string propertyName =
                    fieldAttribute != null && fieldAttribute.Name != null
                    ? fieldAttribute.Name
                    : Statics.ShouldOverrideFieldName(propertyInfo.Name)
                    ? propertyTypeInfo.Name
                    : propertyInfo.Name;
                propertyList.Add(new PropertyAnalysis(
                                     propertyName,
                                     propertyInfo,
                                     propertyTypeInfo,
                                     fieldAttribute));
            }

            this.properties = propertyList.ToArray();

            foreach (PropertyAnalysis property in this.properties)
            {
                TraceLoggingTypeInfo typeInfo = property.typeInfo;
                this.level     = (EventLevel)Statics.Combine((int)typeInfo.Level, (int)this.level);
                this.opcode    = (EventOpcode)Statics.Combine((int)typeInfo.Opcode, (int)this.opcode);
                this.keywords |= typeInfo.Keywords;
                this.tags     |= typeInfo.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 |= eventAttrib.Keywords;
                this.tags     |= eventAttrib.Tags;
                this.name      = eventAttrib.Name;
            }

            this.name ??= dataType.Name;
        }
示例#5
0
 private static TraceLoggingTypeInfo <DataType> InitInstance()
 {
     return(TraceLoggingTypeInfo <DataType> .GetInstance(new List <Type>()));
 }
示例#6
0
 // Token: 0x060035D3 RID: 13779 RVA: 0x000CF0E3 File Offset: 0x000CD2E3
 public NullableTypeInfo(List <Type> recursionCheck)
 {
     this.valueInfo = TraceLoggingTypeInfo <T> .GetInstance(recursionCheck);
 }