Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            using (ModuleReader mr = new ModuleReader(@"D:\log4net.dll"))
            {
                var module = mr.ReadNetModule();

                DescriptionService <HeaderDescriptionInfo> s = new DescriptionService <HeaderDescriptionInfo>();
                var md = s.GetFieldDescription(module).ToList();

                foreach (var m in md.OrderBy(n => n.HeaderOrderNumber))
                {
                    Console.WriteLine($"HeaderOrderNumber {m.HeaderOrderNumber}");
                    Console.WriteLine($"Header description: {m.Description}");
                    foreach (var hm in m.HeaderMemberDescriptions.OrderBy(n => n.FieldOffset))
                    {
                        Console.WriteLine($"FieldName : {hm.FieldName}");
                        Console.WriteLine($"FieldOffset : {hm.FieldOffset}");
                        Console.WriteLine($"FieldLength : {hm.FieldLength}");
                        Console.WriteLine($"FieldValue : {hm.FieldValue}");
                        Console.Write("Bytes : ");
                        foreach (var b in hm.ValueBytes)
                        {
                            Console.Write($"{b};");
                        }
                        Console.WriteLine();
                        Console.WriteLine($"Description : {hm.Description}");
                        Console.WriteLine(hm.Description);
                    }

                    Console.WriteLine();
                }

                Console.Read();
            }
        }
 public override IEnumerable<HeaderMemberDescriptionInfo> GetPropertyDescriptionInfo<T>(PropertyInfo property, Attribute attribute, T header)
 {
     int dataDirectoriesOffset = GetOffset(attribute);
     var headerDescriptionService = new DescriptionService<HeaderMemberDescriptionInfo>();
     var propertyToGetDescription = property.GetValue(header);
     foreach (var headerDescription in headerDescriptionService.GetFieldDescription(propertyToGetDescription))
     {
         headerDescription.FieldOffset += dataDirectoriesOffset;
         yield return headerDescription;
     }
 }
Ejemplo n.º 3
0
        public override IEnumerable <HeaderDescriptionInfo> GetPropertyDescriptionInfo <T>(PropertyInfo property, Attribute attribute, T header)
        {
            int    headerOrderNumber        = GetOrderNumber(attribute);
            string description              = GetDescription(attribute);
            var    headerDescriptionService = new DescriptionService <HeaderMemberDescriptionInfo>();
            var    propertyToGetDescription = property.GetValue(header);
            IEnumerable <HeaderMemberDescriptionInfo> headerMemberDescriptions = headerDescriptionService.GetFieldDescription(propertyToGetDescription);

            yield return(new HeaderDescriptionInfo
            {
                Description = description,
                HeaderMemberDescriptions = headerMemberDescriptions,
                HeaderOrderNumber = headerOrderNumber,
            });
        }