Files
Liberium-1.8-Source-Code/Obfuscator.Obfuscator.Mutation2/CharMutations.cs
T

30 lines
802 B
C#
Raw Normal View History

2026-08-27 11:21:58 -06:00
using dnlib.DotNet;
using dnlib.DotNet.Emit;
using Obfuscator.Helper;
namespace Obfuscator.Obfuscator.Mutation2;
public class CharMutations : iMutation
{
public MethodDef Converter { get; set; }
public void Prepare(TypeDef type)
{
MethodDef methodDef = ModuleDefMD.Load(typeof(FuncMutation).Module).ResolveTypeDef(MDToken.ToRID(typeof(FuncMutation).MetadataToken)).FindMethod("CharToInt");
methodDef.Name = Methods.GenerateString();
methodDef.DeclaringType = null;
type.Methods.Add(methodDef);
Converter = methodDef;
}
public void Process(MethodDef method, ref int index)
{
method.Body.Instructions.Insert(++index, new Instruction(OpCodes.Call, Converter));
}
public bool Supported(Instruction instr)
{
return Utils.CheckArithmetic(instr);
}
}