public TypeRewriteContext(AssemblyRewriteContext assemblyContext, TypeDefinition originalType, TypeDefinition newType) { AssemblyContext = assemblyContext ?? throw new ArgumentNullException(nameof(assemblyContext)); OriginalType = originalType; NewType = newType ?? throw new ArgumentNullException(nameof(newType)); if (OriginalType == null) { return; } OriginalNameWasObfuscated = OriginalType.Name != NewType.Name; if (OriginalNameWasObfuscated) { NewType.CustomAttributes.Add(new CustomAttribute(assemblyContext.Imports.ObfuscatedNameAttributeCtor) { ConstructorArguments = { new CustomAttributeArgument(assemblyContext.Imports.String, originalType.FullName) } }); } if (!OriginalType.IsValueType) { ComputedTypeSpecifics = TypeSpecifics.ReferenceType; } else if (OriginalType.IsEnum) { ComputedTypeSpecifics = TypeSpecifics.BlittableStruct; } else if (OriginalType.HasGenericParameters) { ComputedTypeSpecifics = TypeSpecifics.NonBlittableStruct; // not reference type, covered by first if } }
public int GetColumnImageIndex(PropertyDescriptor property, TypeSpecifics specifics) { var r = wrapped.GetColumnImageIndex(property, specifics); var ev = CustomColumnImageIndex; if (ev != null) { var e = new CustomColumnImageIndexEventArgs(property, specifics, r); ev(this, e); r = e.Index; } return r; }
public int GetColumnImageIndex(PropertyDescriptor property, TypeSpecifics specifics) { var r = wrapped.GetColumnImageIndex(property, specifics); var ev = CustomColumnImageIndex; if (ev != null) { var e = new CustomColumnImageIndexEventArgs(property, specifics, r); ev(this, e); r = e.Index; } return(r); }
public TypeRewriteContext(AssemblyRewriteContext assemblyContext, TypeDefinition originalType, TypeDefinition newType) { AssemblyContext = assemblyContext ?? throw new ArgumentNullException(nameof(assemblyContext)); OriginalType = originalType; NewType = newType ?? throw new ArgumentNullException(nameof(newType)); if (OriginalType == null) { return; } OriginalNameWasObfuscated = OriginalType.Name != NewType.Name; if (!OriginalType.IsValueType) { ComputedTypeSpecifics = TypeSpecifics.ReferenceType; } else if (OriginalType.IsEnum) { ComputedTypeSpecifics = TypeSpecifics.BlittableStruct; } }
public int GetDataSourceImageIndex(object dataSource, TypeSpecifics specifics) { return(wrapped.GetDataSourceImageIndex(dataSource, specifics)); }
public int GetDataSourceImageIndex(object dataSource, TypeSpecifics specifics) { return wrapped.GetDataSourceImageIndex(dataSource, specifics); }
public CustomColumnImageIndexEventArgs(PropertyDescriptor property, TypeSpecifics specifics, int index) { this.Property = property; this.Specifics = specifics; this.Index = index; }
public CustomColumnImageIndexEventArgs(PropertyDescriptor property, TypeSpecifics specifics, int index) { this.Property = property; this.Specifics = specifics; this.Index = index; }