Code Clean Up

main
walon 2025-08-03 12:37:44 +08:00
parent f5c2fe94ea
commit d52a9e7016
18 changed files with 11 additions and 36 deletions

View File

@ -1,6 +1,4 @@
using System.Text;
namespace Obfuz.Editor
namespace Obfuz.Editor
{
public static class ConstValues
{

View File

@ -5,7 +5,6 @@ using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using UnityEngine.Assertions;

View File

@ -3,7 +3,6 @@ using dnlib.DotNet.Emit;
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using UnityEngine.Assertions;

View File

@ -1,10 +1,6 @@
using Obfuz.Settings;
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Obfuz.GarbageCodeGeneration

View File

@ -1,5 +1,4 @@
using Obfuz.Settings;
using Obfuz.Utils;
using Obfuz.Utils;
namespace Obfuz.GarbageCodeGeneration
{

View File

@ -52,9 +52,9 @@ namespace Obfuz.ObfusPasses.CallObfus
switch (mode)
{
case ProxyMode.Dispatch:
return new DispatchProxyObfuscator(ctx.moduleEntityManager);
return new DispatchProxyObfuscator(ctx.moduleEntityManager);
case ProxyMode.Delegate:
return new DelegateProxyObfuscator(ctx.moduleEntityManager);
return new DelegateProxyObfuscator(ctx.moduleEntityManager);
default:
throw new System.NotSupportedException($"Unsupported proxy mode: {mode}");
}

View File

@ -2,7 +2,6 @@
using dnlib.DotNet.Emit;
using Obfuz.Data;
using Obfuz.Emit;
using Obfuz.Settings;
using Obfuz.Utils;
using System;
using System.Collections.Generic;
@ -64,7 +63,7 @@ namespace Obfuz.ObfusPasses.CallObfus
{
return typeName;
}
for (int i = 0; ;i++)
for (int i = 0; ; i++)
{
typeName = $"$Obfuz$Delegate_{hashCode}_{i}";
if (_allocatedDelegateNames.Add(typeName))

View File

@ -1,8 +1,6 @@
using dnlib.DotNet;
using dnlib.DotNet.Emit;
using Obfuz.Data;
using Obfuz.Emit;
using Obfuz.Settings;
using Obfuz.Utils;
using System.Collections.Generic;
using System.Linq;

View File

@ -2,7 +2,6 @@
using dnlib.DotNet.Emit;
using Obfuz.Data;
using Obfuz.Emit;
using Obfuz.Settings;
using Obfuz.Utils;
using System.Collections.Generic;

View File

@ -1,5 +1,4 @@
using dnlib.DotNet;
using UnityEngine;
namespace Obfuz.ObfusPasses.ControlFlowObfus
{

View File

@ -1,5 +1,4 @@
using dnlib.DotNet;
using Obfuz.Emit;
namespace Obfuz.ObfusPasses.ControlFlowObfus
{

View File

@ -328,7 +328,7 @@ namespace Obfuz.ObfusPasses.ControlFlowObfus
BlockGroup group = to.group;
group.basicBlocks.Insert(group.basicBlocks.IndexOf(to), saveLocalBasicBlock);
group.switchMachineCases.Add(new SwitchMachineCase { index = -1, prepareBlock = saveLocalBasicBlock, targetBlock = to});
group.switchMachineCases.Add(new SwitchMachineCase { index = -1, prepareBlock = saveLocalBasicBlock, targetBlock = to });
saveLocalBasicBlock.instructions.Add(Instruction.Create(OpCodes.Ldsfld, (FieldDef)null));
saveLocalBasicBlock.instructions.Add(Instruction.Create(OpCodes.Stloc, GlobalSwitchIndexLocal));
saveLocalBasicBlock.instructions.Add(Instruction.Create(OpCodes.Br, group.switchMachineEntryInst));
@ -359,7 +359,7 @@ namespace Obfuz.ObfusPasses.ControlFlowObfus
{
Dictionary<Instruction, BasicBlockInfo> inst2bb = BuildInstructionToBasicBlockInfoDic();
InsertSwitchMachineBasicBlockForGroup(rootGroup, inst2bb);
InsertSwitchMachineBasicBlockForGroup(rootGroup, inst2bb);
}
private void ShuffleBasicBlocks0(List<BasicBlockInfo> bbs)
@ -368,7 +368,7 @@ namespace Obfuz.ObfusPasses.ControlFlowObfus
{
return;
}
var subBlocksExcludeFirstLast = bbs.GetRange(1, bbs.Count - 2);
var blocksInputArgsCountZero = new List<BasicBlockInfo>();

View File

@ -1,6 +1,5 @@
using dnlib.DotNet;
using Obfuz.Conf;
using Obfuz.Utils;
using System.Collections.Generic;
using System.Xml;

View File

@ -1,10 +1,7 @@
using dnlib.DotNet;
using dnlib.DotNet.Emit;
using Obfuz.Settings;
using Obfuz.Utils;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace Obfuz.ObfusPasses.RemoveConstField
{

View File

@ -1,6 +1,4 @@
using System.Text;
namespace Obfuz.ObfusPasses.SymbolObfus.NameMakers
namespace Obfuz.ObfusPasses.SymbolObfus.NameMakers
{
public class DebugNameMaker : NameMakerBase
{

View File

@ -1,14 +1,11 @@
using dnlib.DotNet;
using dnlib.DotNet.Emit;
using dnlib.DotNet.PolymorphicWriter.Utilities;
using NUnit.Framework;
using Obfuz.Emit;
using Obfuz.Settings;
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using UnityEngine;
using FieldAttributes = dnlib.DotNet.FieldAttributes;
@ -224,6 +221,6 @@ namespace Obfuz.ObfusPasses.Watermark
AddWaterMarkILSequences(module, encryptionScope, watermarkInfo);
}
}
}

View File

@ -1,5 +1,4 @@
using dnlib.DotNet;
using Obfuz.Data;
using Obfuz.Emit;
using Obfuz.Utils;
using System.Collections.Generic;

View File

@ -122,7 +122,7 @@ namespace Obfuz
searchPaths.Add("Managed/UnityEngine");
}
var resultPaths = new List<string>();
var resultPaths = new List<string>();
foreach (var path in searchPaths)
{
string candidatePath1 = Path.Combine(applicationContentsPath, path);