format: 修正VirtualMachineCodeGenerator生成的代码的格式化问题

pull/30/head
walon 2025-10-16 22:39:04 +08:00
parent c9ea564544
commit 4bdf21349c
3 changed files with 6 additions and 8 deletions

View File

@ -29,7 +29,7 @@ namespace Obfuz.EncryptionVM.Instructions
public override void GenerateDecryptCode(List<string> lines, string indent) public override void GenerateDecryptCode(List<string> lines, string indent)
{ {
lines.Add(indent + $"value = ((value - {_addValue}) ^ salt) - _secretKey[{_opKeyIndex}];"); lines.Add(indent + $"value = ((value - {_addValue}) ^ salt) - _secretKey[{_opKeyIndex}];");
} }
} }
} }

View File

@ -35,7 +35,7 @@ namespace Obfuz.EncryptionVM.Instructions
public override void GenerateEncryptCode(List<string> lines, string indent) public override void GenerateEncryptCode(List<string> 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<string> lines, string indent) public override void GenerateDecryptCode(List<string> lines, string indent)

View File

@ -73,7 +73,7 @@ namespace Obfuz.EncryptionVM
{"); {");
foreach (var opCode in _vm.opCodes) foreach (var opCode in _vm.opCodes)
{ {
lines.Add($@" case {opCode.code}: lines.Add($@" case {opCode.code}:
{{ {{
// {opCode.function.GetType().Name}"); // {opCode.function.GetType().Name}");
AppendEncryptCode(lines, opCode.function); AppendEncryptCode(lines, opCode.function);
@ -82,8 +82,7 @@ namespace Obfuz.EncryptionVM
} }
lines.Add(@" lines.Add(@"
default: default: throw new System.Exception($""Invalid opCode:{opCode}"");
throw new System.Exception($""Invalid opCode:{opCode}"");
} }
}"); }");
} }
@ -97,7 +96,7 @@ namespace Obfuz.EncryptionVM
{"); {");
foreach (var opCode in _vm.opCodes) foreach (var opCode in _vm.opCodes)
{ {
lines.Add($@" case {opCode.code}: lines.Add($@" case {opCode.code}:
{{ {{
// {opCode.function.GetType().Name}"); // {opCode.function.GetType().Name}");
AppendDecryptCode(lines, opCode.function); AppendDecryptCode(lines, opCode.function);
@ -106,8 +105,7 @@ namespace Obfuz.EncryptionVM
} }
lines.Add(@" lines.Add(@"
default: default: throw new System.Exception($""Invalid opCode:{opCode}"");
throw new System.Exception($""Invalid opCode:{opCode}"");
} }
}"); }");
} }