Example #1
0
        public bool CanNavigateTo(ILInstructionInfo instruction)
        {
            switch (instruction.OperandType)
            {
            case OperandType.InlineMethod:
                return(true);

            default:
                return(false);
            }
        }
Example #2
0
 private void RegisterJumpFromLine(ILInstructionInfo other)
 {
     if (other == this)
     {
         return;
     }
     if (jumpsFromOtherLines.Contains(other))
     {
         return;
     }
     jumpsFromOtherLines.Add(other);
 }
Example #3
0
        private void RegisterJumpToLine(ILInstructionInfo other)
        {
            if (other == this)
            {
                return;
            }
            if (jumpsToOtherLines.Contains(other))
            {
                return;
            }
            jumpsToOtherLines.Add(other);

            var instructionCode = this.instruction.Code.ToString().ToLowerInvariant();

            this.IsConditionalBranch = instructionCode.Contains("true") || instructionCode.Contains("false");
            this.Is_BrIfTrue         = IsConditionalBranch && instructionCode.Contains("true");
        }
Example #4
0
        public void TryNavigateTo(ILInstructionInfo instruction)
        {
            Debug.Log("CLICKED " + instruction.Line);
            switch (instruction.OperandType)
            {
            case OperandType.InlineMethod:
                if (instruction.Operand is MethodInfo method)
                {
                    var type       = method.ReflectedType;
                    var methodName = method.GetSignature(false);
                    Debug.Log(("TryNavigate to " + type?.FullName + " : " + methodName + "\n" + type?.AssemblyQualifiedName).I());
                    // selecting assembly is not just the namespace
                    // like System.Collections.Generic is in System.Core Assembly -> so we would need a dictionary with all the types and their fullname
                    // for all assemblies to really make sure we can navigate there
                    var assemblyId = type?.Assembly.FullName;
                    if (!SelectAssembly(assemblyId))
                    {
                        Debug.Log("could not find assembly at " + assemblyId);
                        return;
                    }

                    var typeId = type?.Namespace + "." + type?.Name;
                    if (!SelectType(typeId))
                    {
                        Debug.Log("Could not find type at " + typeId);
                        return;
                    }

                    if (!SelectMethod(methodName))
                    {
                        Debug.Log("Could not find method at " + methodName);
                        return;
                    }

                    SaveNavigation();
                }

                break;
            }
        }