mirror of
https://github.com/AssetRipper/Cpp2IL.git
synced 2026-11-13 04:26:33 -10:00
25 lines
831 B
C#
25 lines
831 B
C#
using AsmResolver.DotNet;
|
|
using AsmResolver.PE.DotNet.Cil;
|
|
using AssetRipper.CIL;
|
|
using Cpp2IL.Core.Model.Contexts;
|
|
|
|
namespace Cpp2IL.Core.OutputFormats;
|
|
|
|
public class AsmResolverDllOutputFormatThrowNull : AsmResolverDllOutputFormat
|
|
{
|
|
public override string OutputFormatId => "dll_throw_null";
|
|
|
|
public override string OutputFormatName => "DLL files with method bodies containing throw null";
|
|
|
|
protected override void FillMethodBody(MethodDefinition methodDefinition, MethodAnalysisContext methodContext)
|
|
{
|
|
if (methodDefinition.IsManagedMethodWithBody())
|
|
{
|
|
methodDefinition.CilMethodBody = new();
|
|
var instructions = methodDefinition.CilMethodBody.Instructions;
|
|
instructions.Add(CilOpCodes.Ldnull);
|
|
instructions.Add(CilOpCodes.Throw);
|
|
}
|
|
}
|
|
}
|