mirror of
https://github.com/ZuneDev/ZuneUIXTools.git
synced 2026-07-27 13:11:59 -07:00
Use switch
This commit is contained in:
@@ -92,23 +92,24 @@ public class Decompiler
|
||||
{
|
||||
var instruction = methodBody[i];
|
||||
|
||||
if (instruction.OpCode is OpCode.PushConstant)
|
||||
switch (instruction.OpCode)
|
||||
{
|
||||
case OpCode.PushConstant:
|
||||
var constant = _context.GetConstant(instruction.Operands.First());
|
||||
stack.Push(constant);
|
||||
}
|
||||
else if (instruction.OpCode is OpCode.PushNull)
|
||||
{
|
||||
break;
|
||||
|
||||
case OpCode.PushNull:
|
||||
stack.Push(null);
|
||||
}
|
||||
else if (instruction.OpCode is OpCode.ConstructObject)
|
||||
{
|
||||
break;
|
||||
|
||||
case OpCode.ConstructObject:
|
||||
var type = _context.GetImportedType(instruction.Operands.ElementAt(0));
|
||||
var xObj = new XElement(_context.GetXName(type));
|
||||
stack.Push(new IrisObject(xObj, type));
|
||||
}
|
||||
else if (instruction.OpCode is OpCode.MethodInvokeStatic)
|
||||
{
|
||||
break;
|
||||
|
||||
case OpCode.MethodInvokeStatic:
|
||||
var method = _context.GetImportedMethod(instruction.Operands.First());
|
||||
|
||||
int parameterCount = method.ParameterTypes.Length;
|
||||
@@ -119,31 +120,32 @@ public class Decompiler
|
||||
var callExpression = new IrisMethodCallExpression(method, null, parameters.Select(IrisExpression.ToExpression));
|
||||
|
||||
stack.Push(callExpression);
|
||||
}
|
||||
else if (instruction.OpCode is OpCode.PropertyInitialize)
|
||||
{
|
||||
break;
|
||||
|
||||
case OpCode.PropertyInitialize:
|
||||
var property = _context.GetImportedProperty(instruction.Operands.ElementAt(0));
|
||||
var value = stack.Pop();
|
||||
var propValue = stack.Pop();
|
||||
|
||||
var target = stack.Pop();
|
||||
var xTarget = (XElement)ToXmlFriendlyObject(target);
|
||||
|
||||
PropertyAssignOnXElement(xTarget, property, IrisObject.Create(value, property.PropertyType, _context));
|
||||
PropertyAssignOnXElement(xTarget, property, IrisObject.Create(propValue, property.PropertyType, _context));
|
||||
|
||||
stack.Push(new IrisObject(xTarget, property.Owner));
|
||||
}
|
||||
else if (instruction.OpCode is OpCode.PropertyDictionaryAdd)
|
||||
{
|
||||
break;
|
||||
|
||||
case OpCode.PropertyDictionaryAdd:
|
||||
var targetProperty = _context.GetImportedProperty(instruction.Operands.ElementAt(0));
|
||||
|
||||
var keyReference = instruction.Operands.ElementAt(1);
|
||||
var key = _context.GetConstant(keyReference).Value.ToString();
|
||||
|
||||
var value = stack.Pop();
|
||||
var dictValue = stack.Pop();
|
||||
|
||||
var targetInstance = stack.Peek() as XElement;
|
||||
|
||||
PropertyDictionaryAddOnXElement(targetInstance, targetProperty, IrisObject.Create(value, null, _context), key);
|
||||
PropertyDictionaryAddOnXElement(targetInstance, targetProperty, IrisObject.Create(dictValue, null, _context), key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user