format: 修正VirtualMachineCodeGenerator生成的代码的格式化问题
parent
c9ea564544
commit
4bdf21349c
|
|
@ -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}];");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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}"");
|
|
||||||
}
|
}
|
||||||
}");
|
}");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue