From b38becf84aad186da34a949c9b0a993629327d39 Mon Sep 17 00:00:00 2001 From: walon Date: Fri, 6 Jun 2025 20:28:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9MonoPInvokeCallbackAttribute=E3=80=81Z?= =?UTF-8?q?lua.LuaInvokeAttribute=E3=80=81Zlua.LuaCallbackAttribute?= =?UTF-8?q?=E3=80=81ZluaLuaMarshalAsAttribute=E7=A6=81=E7=94=A8=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=AC=A6=E5=8F=B7=E6=B7=B7=E6=B7=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/ConstValues.cs | 6 ++++++ .../SymbolObfus/Policies/SystemRenamePolicy.cs | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Editor/ConstValues.cs b/Editor/ConstValues.cs index 19d6012..efd1ada 100644 --- a/Editor/ConstValues.cs +++ b/Editor/ConstValues.cs @@ -13,5 +13,11 @@ public const string EncryptFieldAttributeFullName = "Obfuz.EncryptFieldAttribute"; public const string EmbeddedAttributeFullName = "Microsoft.CodeAnalysis.EmbeddedAttribute"; + + public const string MonoPInvokeCallbackAttributeName = "MonoPInvokeCallbackAttribute"; + + public const string ZluaLuaInvokeAttributeFullName = "Zlua.LuaInvokeAttribute"; + public const string ZluaLuaCallbackAttributeFullName = "Zlua.LuaCallbackAttribute"; + public const string ZluaLuaMarshalAsAttributeFullName = "Zlua.LuaMarshalAsAttribute"; } } diff --git a/Editor/ObfusPasses/SymbolObfus/Policies/SystemRenamePolicy.cs b/Editor/ObfusPasses/SymbolObfus/Policies/SystemRenamePolicy.cs index 1d05bcd..f2ba1bb 100644 --- a/Editor/ObfusPasses/SymbolObfus/Policies/SystemRenamePolicy.cs +++ b/Editor/ObfusPasses/SymbolObfus/Policies/SystemRenamePolicy.cs @@ -2,6 +2,7 @@ using Obfuz.Editor; using Obfuz.Utils; using System.Collections.Generic; +using System.Linq; namespace Obfuz.ObfusPasses.SymbolObfus.Policies { @@ -14,17 +15,26 @@ namespace Obfuz.ObfusPasses.SymbolObfus.Policies _obfuzIgnoreScopeComputeCache = obfuzIgnoreScopeComputeCache; } - private readonly HashSet _fullIgnoreTypeNames = new HashSet + private readonly HashSet _fullIgnoreTypeFullNames = new HashSet { ConstValues.ObfuzIgnoreAttributeFullName, ConstValues.ObfuzScopeFullName, ConstValues.EncryptFieldAttributeFullName, ConstValues.EmbeddedAttributeFullName, + ConstValues.ZluaLuaInvokeAttributeFullName, + ConstValues.ZluaLuaCallbackAttributeFullName, + ConstValues.ZluaLuaMarshalAsAttributeFullName, + }; + + + private readonly HashSet _fullIgnoreTypeNames = new HashSet + { + ConstValues.MonoPInvokeCallbackAttributeName, }; private bool IsFullIgnoreObfuscatedType(TypeDef typeDef) { - return _fullIgnoreTypeNames.Contains(typeDef.FullName) || MetaUtil.HasMicrosoftCodeAnalysisEmbeddedAttribute(typeDef); + return _fullIgnoreTypeFullNames.Contains(typeDef.FullName) || _fullIgnoreTypeNames.Contains(typeDef.Name) || MetaUtil.HasMicrosoftCodeAnalysisEmbeddedAttribute(typeDef); } public override bool NeedRename(TypeDef typeDef)