public static void ApplyProjection(MethodDefinition method, MethodDefinitionProjection projection) { if (projection != null) { MethodDefinitionTreatment treatment = projection.Treatment; if ((treatment & MethodDefinitionTreatment.Dispose) != 0) { method.Name = "Dispose"; } if ((treatment & MethodDefinitionTreatment.Abstract) != 0) { method.Attributes |= MethodAttributes.Abstract; } if ((treatment & MethodDefinitionTreatment.Private) != 0) { method.Attributes = ((method.Attributes & ~MethodAttributes.MemberAccessMask) | MethodAttributes.Private); } if ((treatment & MethodDefinitionTreatment.Public) != 0) { method.Attributes = ((method.Attributes & ~MethodAttributes.MemberAccessMask) | MethodAttributes.Public); } if ((treatment & MethodDefinitionTreatment.Runtime) != 0) { method.ImplAttributes |= MethodImplAttributes.CodeTypeMask; } if ((treatment & MethodDefinitionTreatment.InternalCall) != 0) { method.ImplAttributes |= MethodImplAttributes.InternalCall; } method.WindowsRuntimeProjection = projection; } }
public static MethodDefinitionProjection RemoveProjection(MethodDefinition method) { if (!method.IsWindowsRuntimeProjection) { return(null); } MethodDefinitionProjection windowsRuntimeProjection = method.WindowsRuntimeProjection; method.WindowsRuntimeProjection = null; method.Attributes = windowsRuntimeProjection.Attributes; method.ImplAttributes = windowsRuntimeProjection.ImplAttributes; method.Name = windowsRuntimeProjection.Name; return(windowsRuntimeProjection); }
public static void ApplyProjection(MethodDefinition method, MethodDefinitionProjection projection) { if (projection == null) { return; } var treatment = projection.Treatment; if ((treatment & MethodDefinitionTreatment.Abstract) != 0) { method.Attributes |= MethodAttributes.Abstract; } if ((treatment & MethodDefinitionTreatment.Private) != 0) { method.Attributes = (method.Attributes & ~MethodAttributes.MemberAccessMask) | MethodAttributes.Private; } if ((treatment & MethodDefinitionTreatment.Public) != 0) { method.Attributes = (method.Attributes & ~MethodAttributes.MemberAccessMask) | MethodAttributes.Public; } if ((treatment & MethodDefinitionTreatment.Runtime) != 0) { method.ImplAttributes |= MethodImplAttributes.Runtime; } if ((treatment & MethodDefinitionTreatment.InternalCall) != 0) { method.ImplAttributes |= MethodImplAttributes.InternalCall; } method.WindowsRuntimeProjection = projection; }
public static void ApplyProjection(MethodDefinition method, MethodDefinitionProjection projection) { if (projection == null) return; var treatment = projection.Treatment; if ((treatment & MethodDefinitionTreatment.Abstract) != 0) method.Attributes |= MethodAttributes.Abstract; if ((treatment & MethodDefinitionTreatment.Private) != 0) method.Attributes = (method.Attributes & ~MethodAttributes.MemberAccessMask) | MethodAttributes.Private; if ((treatment & MethodDefinitionTreatment.Public) != 0) method.Attributes = (method.Attributes & ~MethodAttributes.MemberAccessMask) | MethodAttributes.Public; if ((treatment & MethodDefinitionTreatment.Runtime) != 0) method.ImplAttributes |= MethodImplAttributes.Runtime; if ((treatment & MethodDefinitionTreatment.InternalCall) != 0) method.ImplAttributes |= MethodImplAttributes.InternalCall; method.WindowsRuntimeProjection = projection; }