From 27a11f6811af34dd26f255758f955fdd05683734 Mon Sep 17 00:00:00 2001 From: walon Date: Mon, 5 May 2025 10:33:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=85=8D=E7=BD=AE=E9=A1=B9?= =?UTF-8?q?=20useConsistentNamespaceObfuscation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/ObfusPasses/SymbolObfus/SymbolRename.cs | 4 +++- Editor/Settings/SymbolObfusSettings.cs | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Editor/ObfusPasses/SymbolObfus/SymbolRename.cs b/Editor/ObfusPasses/SymbolObfus/SymbolRename.cs index e127aaf..894124d 100644 --- a/Editor/ObfusPasses/SymbolObfus/SymbolRename.cs +++ b/Editor/ObfusPasses/SymbolObfus/SymbolRename.cs @@ -28,6 +28,7 @@ namespace Obfuz.ObfusPasses.SymbolObfus public List referenceMeAssemblies; } + private readonly bool _useConsistentNamespaceObfuscation; private readonly List _obfuscationRuleFiles; private readonly string _mappingXmlPath; @@ -54,6 +55,7 @@ namespace Obfuz.ObfusPasses.SymbolObfus public SymbolRename(SymbolObfusSettings settings) { + _useConsistentNamespaceObfuscation = settings.useConsistentNamespaceObfuscation; _mappingXmlPath = settings.mappingFile; _obfuscationRuleFiles = settings.ruleFiles.ToList(); _renameRecordMap = new RenameRecordMap(settings.mappingFile); @@ -625,7 +627,7 @@ namespace Obfuz.ObfusPasses.SymbolObfus } else { - newNamespace = _nameMaker.GetNewNamespace(type, oldNamespace, true); + newNamespace = _nameMaker.GetNewNamespace(type, oldNamespace, _useConsistentNamespaceObfuscation); newName = _nameMaker.GetNewName(type, oldName); } diff --git a/Editor/Settings/SymbolObfusSettings.cs b/Editor/Settings/SymbolObfusSettings.cs index bc65ee0..f3db0b7 100644 --- a/Editor/Settings/SymbolObfusSettings.cs +++ b/Editor/Settings/SymbolObfusSettings.cs @@ -12,8 +12,12 @@ namespace Obfuz.Settings { public bool debug; + [Tooltip("prefix for obfuscated name to avoid name confliction with original name")] public string obfuscatedNamePrefix = "$"; + [Tooltip("obfuscate same namespace to same name")] + public bool useConsistentNamespaceObfuscation = true; + [Tooltip("path of mapping.xml")] public string mappingFile = "Assets/Obfuz/SymbolObfus/mapping.xml";