From b2ba676ec1cadf948f988a7c02c72eeb75356f06 Mon Sep 17 00:00:00 2001 From: walon Date: Sat, 24 May 2025 12:55:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=A8Unity=202019?= =?UTF-8?q?=E4=B8=8A=E7=9A=84=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Editor/ObfusPasses/SymbolObfus/RenameRecordMap.cs | 2 +- com.code-philosophy.obfuz/Editor/Settings/ObfuzSettings.cs | 2 +- com.code-philosophy.obfuz/Editor/Utils/MetaUtil.cs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/com.code-philosophy.obfuz/Editor/ObfusPasses/SymbolObfus/RenameRecordMap.cs b/com.code-philosophy.obfuz/Editor/ObfusPasses/SymbolObfus/RenameRecordMap.cs index 6825fb2..97c5b30 100644 --- a/com.code-philosophy.obfuz/Editor/ObfusPasses/SymbolObfus/RenameRecordMap.cs +++ b/com.code-philosophy.obfuz/Editor/ObfusPasses/SymbolObfus/RenameRecordMap.cs @@ -591,7 +591,7 @@ namespace Obfuz.ObfusPasses.SymbolObfus { status = RenameStatus.Renamed, signature = methodRecord != null ? methodRecord.signature : TypeSigUtil.ComputeMethodDefSignature(firstMethod), - oldName = methodRecord != null ? methodRecord.oldName : firstMethod.Name, + oldName = methodRecord != null ? methodRecord.oldName : (string)firstMethod.Name, newName = newName, }); } diff --git a/com.code-philosophy.obfuz/Editor/Settings/ObfuzSettings.cs b/com.code-philosophy.obfuz/Editor/Settings/ObfuzSettings.cs index 8759996..b137d18 100644 --- a/com.code-philosophy.obfuz/Editor/Settings/ObfuzSettings.cs +++ b/com.code-philosophy.obfuz/Editor/Settings/ObfuzSettings.cs @@ -82,7 +82,7 @@ namespace Obfuz.Settings } else { - s_Instance ??= CreateInstance(); + s_Instance = s_Instance ?? CreateInstance(); } return s_Instance; } diff --git a/com.code-philosophy.obfuz/Editor/Utils/MetaUtil.cs b/com.code-philosophy.obfuz/Editor/Utils/MetaUtil.cs index c22846a..cd0697a 100644 --- a/com.code-philosophy.obfuz/Editor/Utils/MetaUtil.cs +++ b/com.code-philosophy.obfuz/Editor/Utils/MetaUtil.cs @@ -802,7 +802,7 @@ namespace Obfuz.Utils public static ObfuzScope? GetObfuzIgnoreScope(IHasCustomAttribute obj) { - var ca = obj.CustomAttributes.FirstOrDefault(ca => ca.AttributeType.FullName == "Obfuz.ObfuzIgnoreAttribute"); + var ca = obj.CustomAttributes.FirstOrDefault(c => c.AttributeType.FullName == "Obfuz.ObfuzIgnoreAttribute"); if (ca == null) { return null; @@ -816,13 +816,13 @@ namespace Obfuz.Utils TypeDef cur = typeDef; while (cur != null) { - var ca = cur.CustomAttributes?.FirstOrDefault(ca => ca.AttributeType.FullName == "Obfuz.ObfuzIgnoreAttribute"); + var ca = cur.CustomAttributes?.FirstOrDefault(c => c.AttributeType.FullName == "Obfuz.ObfuzIgnoreAttribute"); if (ca != null) { var scope = (ObfuzScope)ca.ConstructorArguments[0].Value; CANamedArgument inheritByNestedTypesArg = ca.GetNamedArgument("InheritByNestedTypes", false); bool inheritByNestedTypes = inheritByNestedTypesArg == null || (bool)inheritByNestedTypesArg.Value; - return cur == typeDef || inheritByNestedTypes ? scope : null; + return cur == typeDef || inheritByNestedTypes ? (ObfuzScope?) scope : null; } cur = cur.DeclaringType; }