|
|
|
|
@ -143,7 +143,7 @@ namespace ICSharpCode.ILSpy.Metadata
@@ -143,7 +143,7 @@ namespace ICSharpCode.ILSpy.Metadata
|
|
|
|
|
|
|
|
|
|
var descriptor = (PropertyDescriptor)e.PropertyDescriptor; |
|
|
|
|
|
|
|
|
|
if (descriptor.Attributes.OfType<LinkToTableAttribute>().Any()) |
|
|
|
|
if (descriptor.Attributes.OfType<ColumnInfoAttribute>().Any(c => c.Kind == ColumnKind.Token || c.LinkToTable)) |
|
|
|
|
{ |
|
|
|
|
return new DataGridTemplateColumn() { |
|
|
|
|
Header = e.PropertyName, |
|
|
|
|
@ -200,12 +200,12 @@ namespace ICSharpCode.ILSpy.Metadata
@@ -200,12 +200,12 @@ namespace ICSharpCode.ILSpy.Metadata
|
|
|
|
|
string key = descriptor.PropertyType.Name + "Filter"; |
|
|
|
|
column.SetTemplate((ControlTemplate)MetadataTableViews.Instance[key]); |
|
|
|
|
} |
|
|
|
|
var stringFormat = descriptor.Attributes.OfType<StringFormatAttribute>().FirstOrDefault(); |
|
|
|
|
if (stringFormat != null) |
|
|
|
|
var columnInfo = descriptor.Attributes.OfType<ColumnInfoAttribute>().FirstOrDefault(); |
|
|
|
|
if (columnInfo != null) |
|
|
|
|
{ |
|
|
|
|
binding.StringFormat = stringFormat.Format; |
|
|
|
|
binding.StringFormat = columnInfo.Format; |
|
|
|
|
if (!descriptor.PropertyType.IsEnum |
|
|
|
|
&& stringFormat.Format.StartsWith("X", StringComparison.OrdinalIgnoreCase)) |
|
|
|
|
&& columnInfo.Format.StartsWith("X", StringComparison.OrdinalIgnoreCase)) |
|
|
|
|
{ |
|
|
|
|
column.SetTemplate((ControlTemplate)MetadataTableViews.Instance["HexFilter"]); |
|
|
|
|
} |
|
|
|
|
@ -297,20 +297,28 @@ namespace ICSharpCode.ILSpy.Metadata
@@ -297,20 +297,28 @@ namespace ICSharpCode.ILSpy.Metadata
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class StringFormatAttribute : Attribute |
|
|
|
|
enum ColumnKind |
|
|
|
|
{ |
|
|
|
|
HeapOffset, |
|
|
|
|
Token, |
|
|
|
|
Other |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[AttributeUsage(AttributeTargets.Property)] |
|
|
|
|
class ColumnInfoAttribute : Attribute |
|
|
|
|
{ |
|
|
|
|
public string Format { get; } |
|
|
|
|
|
|
|
|
|
public StringFormatAttribute(string format) |
|
|
|
|
public ColumnKind Kind { get; set; } |
|
|
|
|
|
|
|
|
|
public bool LinkToTable { get; set; } |
|
|
|
|
|
|
|
|
|
public ColumnInfoAttribute(string format) |
|
|
|
|
{ |
|
|
|
|
this.Format = format; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class LinkToTableAttribute : Attribute |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[Flags] |
|
|
|
|
internal enum TableMask : ulong |
|
|
|
|
{ |
|
|
|
|
|