From 4bdf21349c80e693f5c7e818b2c32f34660f28f2 Mon Sep 17 00:00:00 2001 From: walon Date: Thu, 16 Oct 2025 22:39:04 +0800 Subject: [PATCH] =?UTF-8?q?format:=20=E4=BF=AE=E6=AD=A3VirtualMachineCodeG?= =?UTF-8?q?enerator=E7=94=9F=E6=88=90=E7=9A=84=E4=BB=A3=E7=A0=81=E7=9A=84?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/EncryptionVM/Instructions/AddInstruction.cs | 2 +- .../EncryptionVM/Instructions/MultipleInstruction.cs | 2 +- Editor/EncryptionVM/VirtualMachineCodeGenerator.cs | 10 ++++------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Editor/EncryptionVM/Instructions/AddInstruction.cs b/Editor/EncryptionVM/Instructions/AddInstruction.cs index 2681fff..7a93633 100644 --- a/Editor/EncryptionVM/Instructions/AddInstruction.cs +++ b/Editor/EncryptionVM/Instructions/AddInstruction.cs @@ -29,7 +29,7 @@ namespace Obfuz.EncryptionVM.Instructions public override void GenerateDecryptCode(List lines, string indent) { - lines.Add(indent + $"value = ((value - {_addValue}) ^ salt) - _secretKey[{_opKeyIndex}];"); + lines.Add(indent + $"value = ((value - {_addValue}) ^ salt) - _secretKey[{_opKeyIndex}];"); } } } diff --git a/Editor/EncryptionVM/Instructions/MultipleInstruction.cs b/Editor/EncryptionVM/Instructions/MultipleInstruction.cs index a788a67..e7f6cd7 100644 --- a/Editor/EncryptionVM/Instructions/MultipleInstruction.cs +++ b/Editor/EncryptionVM/Instructions/MultipleInstruction.cs @@ -35,7 +35,7 @@ namespace Obfuz.EncryptionVM.Instructions public override void GenerateEncryptCode(List lines, string indent) { - lines.Add(indent + $"value = value * {_multiValue} + _secretKey[{_opKeyIndex}] + salt;"); + lines.Add(indent + $"value = value * {_multiValue} + _secretKey[{_opKeyIndex}] + salt;"); } public override void GenerateDecryptCode(List lines, string indent) diff --git a/Editor/EncryptionVM/VirtualMachineCodeGenerator.cs b/Editor/EncryptionVM/VirtualMachineCodeGenerator.cs index f12d368..1662570 100644 --- a/Editor/EncryptionVM/VirtualMachineCodeGenerator.cs +++ b/Editor/EncryptionVM/VirtualMachineCodeGenerator.cs @@ -73,7 +73,7 @@ namespace Obfuz.EncryptionVM {"); foreach (var opCode in _vm.opCodes) { - lines.Add($@" case {opCode.code}: + lines.Add($@" case {opCode.code}: {{ // {opCode.function.GetType().Name}"); AppendEncryptCode(lines, opCode.function); @@ -82,8 +82,7 @@ namespace Obfuz.EncryptionVM } lines.Add(@" - default: - throw new System.Exception($""Invalid opCode:{opCode}""); + default: throw new System.Exception($""Invalid opCode:{opCode}""); } }"); } @@ -97,7 +96,7 @@ namespace Obfuz.EncryptionVM {"); foreach (var opCode in _vm.opCodes) { - lines.Add($@" case {opCode.code}: + lines.Add($@" case {opCode.code}: {{ // {opCode.function.GetType().Name}"); AppendDecryptCode(lines, opCode.function); @@ -106,8 +105,7 @@ namespace Obfuz.EncryptionVM } lines.Add(@" - default: - throw new System.Exception($""Invalid opCode:{opCode}""); + default: throw new System.Exception($""Invalid opCode:{opCode}""); } }"); }