From d4133f1e8a023272d67bd38d5c03e51f77721428 Mon Sep 17 00:00:00 2001 From: walon Date: Wed, 23 Jul 2025 19:34:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E4=B8=8D=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E7=9A=84=E5=AF=B9NUnit.Framework=E7=9A=84=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/EncryptionVM/Instructions/MultipleInstruction.cs | 5 ++--- Editor/GarbageCodeGeneration/ConfigGarbageCodeGenerator.cs | 6 +----- Editor/GarbageCodeGeneration/UIGarbageCodeGenerator.cs | 6 +----- Editor/ObfusPasses/CallObfus/DelegateProxyAllocator.cs | 3 +-- Editor/ObfusPasses/ConstEncrypt/DefaultConstEncryptor.cs | 2 +- Editor/ObfusPasses/SymbolObfus/RenameRecordMap.cs | 2 +- Editor/Utils/BurstCompileComputeCache.cs | 1 - Editor/Utils/MathUtil.cs | 3 +-- 8 files changed, 8 insertions(+), 20 deletions(-) diff --git a/Editor/EncryptionVM/Instructions/MultipleInstruction.cs b/Editor/EncryptionVM/Instructions/MultipleInstruction.cs index cfc0df3..a788a67 100644 --- a/Editor/EncryptionVM/Instructions/MultipleInstruction.cs +++ b/Editor/EncryptionVM/Instructions/MultipleInstruction.cs @@ -1,5 +1,4 @@ -using NUnit.Framework; -using Obfuz.Utils; +using Obfuz.Utils; using System.Collections.Generic; namespace Obfuz.EncryptionVM.Instructions @@ -21,7 +20,7 @@ namespace Obfuz.EncryptionVM.Instructions private void Verify() { int a = 1122334; - Assert.AreEqual(a, a * _multiValue * _revertMultiValue); + UnityEngine.Assertions.Assert.AreEqual(a, a * _multiValue * _revertMultiValue); } public override int Encrypt(int value, int[] secretKey, int salt) diff --git a/Editor/GarbageCodeGeneration/ConfigGarbageCodeGenerator.cs b/Editor/GarbageCodeGeneration/ConfigGarbageCodeGenerator.cs index 9351adb..06a7aeb 100644 --- a/Editor/GarbageCodeGeneration/ConfigGarbageCodeGenerator.cs +++ b/Editor/GarbageCodeGeneration/ConfigGarbageCodeGenerator.cs @@ -1,9 +1,5 @@ -using dnlib.DotNet; -using NUnit.Framework; -using Obfuz.Settings; -using Obfuz.Utils; +using Obfuz.Utils; using System; -using System.Collections; using System.Linq; using System.Text; diff --git a/Editor/GarbageCodeGeneration/UIGarbageCodeGenerator.cs b/Editor/GarbageCodeGeneration/UIGarbageCodeGenerator.cs index 8bb80b6..7287dce 100644 --- a/Editor/GarbageCodeGeneration/UIGarbageCodeGenerator.cs +++ b/Editor/GarbageCodeGeneration/UIGarbageCodeGenerator.cs @@ -1,9 +1,5 @@ -using dnlib.DotNet; -using NUnit.Framework; -using Obfuz.Settings; -using Obfuz.Utils; +using Obfuz.Utils; using System; -using System.Collections; using System.Linq; using System.Text; diff --git a/Editor/ObfusPasses/CallObfus/DelegateProxyAllocator.cs b/Editor/ObfusPasses/CallObfus/DelegateProxyAllocator.cs index d96dce1..7b9b6e0 100644 --- a/Editor/ObfusPasses/CallObfus/DelegateProxyAllocator.cs +++ b/Editor/ObfusPasses/CallObfus/DelegateProxyAllocator.cs @@ -1,6 +1,5 @@ using dnlib.DotNet; using dnlib.DotNet.Emit; -using NUnit.Framework; using Obfuz.Data; using Obfuz.Emit; using Obfuz.Settings; @@ -221,7 +220,7 @@ namespace Obfuz.ObfusPasses.CallObfus ins.Add(Instruction.Create(OpCodes.Ldnull)); ins.Add(Instruction.Create(OpCodes.Ldftn, ci.proxyMethod)); MethodDef ctor = ci.delegateType.FindMethod(".ctor"); - Assert.NotNull(ctor, $"Delegate type {ci.delegateType.FullName} does not have a constructor."); + UnityEngine.Assertions.Assert.IsNotNull(ctor, $"Delegate type {ci.delegateType.FullName} does not have a constructor."); ins.Add(Instruction.Create(OpCodes.Newobj, ctor)); ins.Add(Instruction.Create(OpCodes.Stelem_Ref)); ++index; diff --git a/Editor/ObfusPasses/ConstEncrypt/DefaultConstEncryptor.cs b/Editor/ObfusPasses/ConstEncrypt/DefaultConstEncryptor.cs index 917d114..04d00de 100644 --- a/Editor/ObfusPasses/ConstEncrypt/DefaultConstEncryptor.cs +++ b/Editor/ObfusPasses/ConstEncrypt/DefaultConstEncryptor.cs @@ -1,12 +1,12 @@ using dnlib.DotNet; using dnlib.DotNet.Emit; -using NUnit.Framework; using Obfuz.Data; using Obfuz.Emit; using Obfuz.Settings; using Obfuz.Utils; using System.Collections.Generic; using System.Text; +using UnityEngine.Assertions; namespace Obfuz.ObfusPasses.ConstEncrypt { diff --git a/Editor/ObfusPasses/SymbolObfus/RenameRecordMap.cs b/Editor/ObfusPasses/SymbolObfus/RenameRecordMap.cs index 068b8cc..6548695 100644 --- a/Editor/ObfusPasses/SymbolObfus/RenameRecordMap.cs +++ b/Editor/ObfusPasses/SymbolObfus/RenameRecordMap.cs @@ -1,5 +1,4 @@ using dnlib.DotNet; -using NUnit.Framework; using Obfuz.Utils; using System; using System.Collections.Generic; @@ -7,6 +6,7 @@ using System.IO; using System.Linq; using System.Xml; using UnityEngine; +using UnityEngine.Assertions; namespace Obfuz.ObfusPasses.SymbolObfus { diff --git a/Editor/Utils/BurstCompileComputeCache.cs b/Editor/Utils/BurstCompileComputeCache.cs index fb25a3b..f2f2288 100644 --- a/Editor/Utils/BurstCompileComputeCache.cs +++ b/Editor/Utils/BurstCompileComputeCache.cs @@ -1,5 +1,4 @@ using dnlib.DotNet; -using NUnit.Framework; using System.Collections.Generic; namespace Obfuz.Utils diff --git a/Editor/Utils/MathUtil.cs b/Editor/Utils/MathUtil.cs index d2d2e3f..dad6d2e 100644 --- a/Editor/Utils/MathUtil.cs +++ b/Editor/Utils/MathUtil.cs @@ -1,5 +1,4 @@ -using NUnit.Framework; -using System; +using System; namespace Obfuz.Utils {