2025-06-22 19:33:28 +08:00
|
|
|
|
using dnlib.DotNet;
|
|
|
|
|
using UnityEngine;
|
2025-06-22 10:39:57 +08:00
|
|
|
|
|
|
|
|
|
namespace Obfuz.ObfusPasses.ControlFlowObfus
|
|
|
|
|
{
|
|
|
|
|
class DefaultObfuscator : ObfuscatorBase
|
|
|
|
|
{
|
2025-06-22 19:33:28 +08:00
|
|
|
|
public override bool Obfuscate(MethodDef method, ObfusMethodContext ctx)
|
2025-06-22 10:39:57 +08:00
|
|
|
|
{
|
2025-06-22 19:33:28 +08:00
|
|
|
|
//Debug.Log($"Obfuscating method: {method.FullName} with ControlFlowObfusPass");
|
|
|
|
|
var mcfc = new MethodControlFlowCalculator(method, ctx.CreateRandom(), ctx.constFieldAllocator, ctx.minInstructionCountOfBasicBlockToObfuscate);
|
|
|
|
|
if (!mcfc.TryObfus())
|
|
|
|
|
{
|
2025-06-28 20:38:27 +08:00
|
|
|
|
//Debug.LogWarning($"not obfuscate method: {method.FullName}");
|
2025-06-22 19:33:28 +08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
2025-06-22 10:39:57 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|