From d06caf5e38765b7ca25a9c4dea5f2ed3aa569745 Mon Sep 17 00:00:00 2001 From: walon Date: Fri, 23 May 2025 11:09:27 +0800 Subject: [PATCH] =?UTF-8?q?change:=20SecretSettings.secretKeyOutputPath?= =?UTF-8?q?=E6=8B=86=E4=B8=BAstaticSecretKeyOutputPath=E5=92=8CdynamicSecr?= =?UTF-8?q?etKeyOutputPath=EF=BC=8C=E6=96=B9=E4=BE=BF=E5=8D=95=E7=8B=AC?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E6=AF=8F=E4=B8=AAkey=E7=9A=84=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- com.code-philosophy.obfuz/Editor/ObfuscatorBuilder.cs | 4 ++-- .../Editor/Settings/ObfuzSettings.cs | 1 - .../Editor/Settings/SecretSettings.cs | 11 +++++------ com.code-philosophy.obfuz/Editor/Unity/ObfuzMenu.cs | 8 ++++---- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/com.code-philosophy.obfuz/Editor/ObfuscatorBuilder.cs b/com.code-philosophy.obfuz/Editor/ObfuscatorBuilder.cs index e5f2c19..16be3e9 100644 --- a/com.code-philosophy.obfuz/Editor/ObfuscatorBuilder.cs +++ b/com.code-philosophy.obfuz/Editor/ObfuscatorBuilder.cs @@ -224,9 +224,9 @@ namespace Obfuz { _buildTarget = target, _defaultStaticSecretKey = settings.secretSettings.defaultStaticSecretKey, - _defaultStaticSecretKeyOutputPath = settings.secretSettings.DefaultStaticSecretKeyOutputPath, + _defaultStaticSecretKeyOutputPath = settings.secretSettings.staticSecretKeyOutputPath, _defaultDynamicSecretKey = settings.secretSettings.defaultDynamicSecretKey, - _defaultDynamicSecretKeyOutputPath = settings.secretSettings.DefaultDynamicSecretKeyOutputPath, + _defaultDynamicSecretKeyOutputPath = settings.secretSettings.dynamicSecretKeyOutputPath, _assembliesUsingDynamicSecretKeys = settings.secretSettings.assembliesUsingDynamicSecretKeys.ToList(), _randomSeed = settings.secretSettings.randomSeed, _encryptionVmGenerationSecretKey = settings.encryptionVMSettings.codeGenerationSecretKey, diff --git a/com.code-philosophy.obfuz/Editor/Settings/ObfuzSettings.cs b/com.code-philosophy.obfuz/Editor/Settings/ObfuzSettings.cs index bb0f649..cd8379d 100644 --- a/com.code-philosophy.obfuz/Editor/Settings/ObfuzSettings.cs +++ b/com.code-philosophy.obfuz/Editor/Settings/ObfuzSettings.cs @@ -93,7 +93,6 @@ namespace Obfuz.Settings { if (!s_Instance) { - Debug.LogError("Cannot save ScriptableSingleton: no instance!"); return; } diff --git a/com.code-philosophy.obfuz/Editor/Settings/SecretSettings.cs b/com.code-philosophy.obfuz/Editor/Settings/SecretSettings.cs index 09c2143..4ed4212 100644 --- a/com.code-philosophy.obfuz/Editor/Settings/SecretSettings.cs +++ b/com.code-philosophy.obfuz/Editor/Settings/SecretSettings.cs @@ -14,17 +14,16 @@ namespace Obfuz.Settings [Tooltip("default dynamic secret key")] public string defaultDynamicSecretKey = "Code Philosophy-Dynamic"; - [Tooltip("secret key output path")] - public string secretKeyOutputPath = $"Assets/Resources/Obfuz"; + [Tooltip("default static secret key output path")] + public string staticSecretKeyOutputPath = $"Assets/Resources/Obfuz/defaultStaticSecretKey.bytes"; + + [Tooltip("default dynamic secret key output path")] + public string dynamicSecretKeyOutputPath = $"Assets/Resources/Obfuz/defaultDynamicSecretKey.bytes"; [Tooltip("random seed")] public int randomSeed = 0; [Tooltip("name of assemblies those use dynamic secret key")] public string[] assembliesUsingDynamicSecretKeys; - - public string DefaultStaticSecretKeyOutputPath => Path.Combine(secretKeyOutputPath, "defaultStaticSecretKey.bytes"); - - public string DefaultDynamicSecretKeyOutputPath => Path.Combine(secretKeyOutputPath, "defaultDynamicSecretKey.bytes"); } } diff --git a/com.code-philosophy.obfuz/Editor/Unity/ObfuzMenu.cs b/com.code-philosophy.obfuz/Editor/Unity/ObfuzMenu.cs index d0162c3..ee2b219 100644 --- a/com.code-philosophy.obfuz/Editor/Unity/ObfuzMenu.cs +++ b/com.code-philosophy.obfuz/Editor/Unity/ObfuzMenu.cs @@ -28,11 +28,11 @@ namespace Obfuz.Unity SecretSettings settings = ObfuzSettings.Instance.secretSettings; var staticSecretBytes = KeyGenerator.GenerateKey(settings.defaultStaticSecretKey, VirtualMachine.SecretKeyLength); - SaveKey(staticSecretBytes, settings.DefaultStaticSecretKeyOutputPath); - Debug.Log($"Save static secret key to {settings.DefaultStaticSecretKeyOutputPath}"); + SaveKey(staticSecretBytes, settings.staticSecretKeyOutputPath); + Debug.Log($"Save static secret key to {settings.staticSecretKeyOutputPath}"); var dynamicSecretBytes = KeyGenerator.GenerateKey(settings.defaultDynamicSecretKey, VirtualMachine.SecretKeyLength); - SaveKey(dynamicSecretBytes, settings.DefaultDynamicSecretKeyOutputPath); - Debug.Log($"Save dynamic secret key to {settings.DefaultDynamicSecretKeyOutputPath}"); + SaveKey(dynamicSecretBytes, settings.dynamicSecretKeyOutputPath); + Debug.Log($"Save dynamic secret key to {settings.dynamicSecretKeyOutputPath}"); AssetDatabase.Refresh(); }