private TripleObject BuildFromTriple(Instruction fromInstruction, string fromInstanceOwnerKey, MethodDefinition parentMethod) { var tripleObj = new TripleObject(); tripleObj.Instruction = fromInstruction; var fromObjectType = InstructionKeyService.GetFromObjectType(fromInstruction); tripleObj.ObjectType = fromObjectType; if (fromObjectType == ObjectType.Argument) { int fromArgumentIndex = (int)DecompilerService.GetPosition(fromInstruction); tripleObj.ObjectKey = InstructionKeyService.GetObjectKey(fromInstruction, fromObjectType, parentMethod, fromArgumentIndex); } else { tripleObj.ObjectKey = InstructionKeyService.GetObjectKey(fromInstruction, fromObjectType, parentMethod); } tripleObj.InstructionKey = InstructionKeyService.GetInstructionKey(fromInstruction, parentMethod); tripleObj.OwnerTypeCategory = InstructionKeyService.GetTypeCategory(fromInstruction); tripleObj.OwnerTypeKey = InstructionKeyService.GetTypeKey(fromInstruction); tripleObj.InheritsFromConcreteClass = InstructionKeyService.GetConcreteInheritance(fromInstruction); tripleObj.InstanceOwnerKey = fromInstanceOwnerKey; return(tripleObj); }
private TripleObject BuildToTriple(Instruction toInstruction, string toInstanceOwnerKey, MethodDefinition parentMethod, int?toArgumentCounter = null) { var tripleObj = new TripleObject(); tripleObj.Instruction = toInstruction; var toObjectType = InstructionKeyService.GetToObjectType(toInstruction); tripleObj.ObjectType = toObjectType; tripleObj.InstanceOwnerKey = toInstanceOwnerKey; if (toObjectType == ObjectType.Argument) { var methodCallReference = (MethodReference)toInstruction.Operand; tripleObj.ObjectKey = InstructionKeyService.GetObjectKey(toInstruction, toObjectType, methodCallReference, toArgumentCounter.Value); } else { tripleObj.ObjectKey = InstructionKeyService.GetObjectKey(toInstruction, toObjectType, parentMethod); } tripleObj.InstructionKey = InstructionKeyService.GetInstructionKey(toInstruction, parentMethod); tripleObj.OwnerTypeCategory = InstructionKeyService.GetTypeCategory(toInstruction); tripleObj.OwnerTypeKey = InstructionKeyService.GetTypeKey(toInstruction); tripleObj.InheritsFromConcreteClass = InstructionKeyService.GetConcreteInheritance(toInstruction); return(tripleObj); }