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)