C# Class Patchwork.Engine.Utility.CecilHelper

Helper methods (mainly extension methods) for working with Cecil and .NET reflection classes. Some are publically visible.
Show file Open project: GregRos/Patchwork

Public Properties

Property Type Description
PatchworkMetadataString string

Public Methods

Method Description
Clone ( this definition ) : AssemblyDefinition

Returns a reloaded clone of the assembly by serializing it and loading it from memory.

CloneReference ( this methodDef ) : FieldReference

Returns another reference to the same field.

CloneReference ( this methodRef ) : MethodReference

Creates another refernece to the same method.

GetAssemblyMetadataString ( this assembly ) : string

Returns a human-readable metadata string that describes the specified Cecil assembly definition.

SerializeAssembly ( this definition ) : byte[]

Serializes the assembly by writing it into a memory stream.

SetAccessibility ( this method, Accessibility newAccessibility ) : void

Sets the accessibility attributes of this member to the desired C#-like accessibility.

Private Methods

Method Description
GetAccessbility ( this memberDef ) : Accessibility

Gets the C#-like accessbility of this member.

GetAccessibilityDynamic ( dynamic whatever ) : Accessibility
GetAssemblyMetadataString ( string fullName, string path ) : string

Returns the metadata string that describes the assembly in the specified location, expected to have the specified full name.

SetAccessibilityDynamic ( dynamic whatever, Accessibility newAccessibility ) : void

Method Details

Clone() public static method

Returns a reloaded clone of the assembly by serializing it and loading it from memory.
public static Clone ( this definition ) : AssemblyDefinition
definition this The assembly definition.
return Mono.Cecil.AssemblyDefinition

CloneReference() public static method

Returns another reference to the same field.
public static CloneReference ( this methodDef ) : FieldReference
methodDef this The field reference.
return Mono.Cecil.FieldReference

CloneReference() public static method

Creates another refernece to the same method.
public static CloneReference ( this methodRef ) : MethodReference
methodRef this The method reference.
return Mono.Cecil.MethodReference

GetAssemblyMetadataString() public static method

Returns a human-readable metadata string that describes the specified Cecil assembly definition.
public static GetAssemblyMetadataString ( this assembly ) : string
assembly this The assembly.
return string

SerializeAssembly() public static method

Serializes the assembly by writing it into a memory stream.
public static SerializeAssembly ( this definition ) : byte[]
definition this The assembly definition.
return byte[]

SetAccessibility() public static method

Sets the accessibility attributes of this member to the desired C#-like accessibility.
public static SetAccessibility ( this method, Accessibility newAccessibility ) : void
method this The method.
newAccessibility Accessibility The new accessibility.
return void

Property Details

PatchworkMetadataString public static property

Contains the metadata string of the executing Patchwork.Engine assembly, as determined by the GetAssemblyMetadataString(Mono.Cecil.AssemblyDefinition) method.
public static string PatchworkMetadataString
return string