Beispiel #1
0
 internal BuilderState(Builder builder)
 {
     graph       = builder.graph;
     classDef    = builder.classDef;
     fieldDef    = builder.fieldDef;
     methodDef   = builder.methodDef;
     instruction = builder.instruction;
 }
Beispiel #2
0
            public void analyze(Instruction instruction, Builder.BuilderState builderState)
            {
                if (instruction.Operand == null)
                {
                    return;
                }

                var opcode  = instruction.OpCode;
                var operand = instruction.Operand;

                if (fieldLoadedLast == true)
                {
                    // var operandFieldDef = (FieldDefinition)operand;
                    // var fieldType = operandFieldDef.FieldType;

                    ClassGraph graph = builderState.graph;
                    Edge       edge  = new Edge(builderState.classDef.FullName, fieldNodeID, new KeyValuePair <string, string>(operand.ToString(), "This is from somewhere else!"));
                    graph.AddEdge(edge);

                    fieldLoadedLast = false;
                    fieldNodeID     = "";
                }

                if (opcode.Name == DotnetConstants.OPCODE_LDFLD &&
                    operand.GetType() == typeof(Mono.Cecil.FieldDefinition))
                {
                    var operandFieldDef = (FieldDefinition)operand;
                    var fieldType       = operandFieldDef.FieldType;
                    var nodeID          = fieldType.FullName;

                    fieldNodeID     = nodeID;
                    fieldLoadedLast = true;

                    t.SetColor(ConsoleColor.White);
                    t.DebugPrint("AnalysisPasses.FindNodeUsageInstructionPass -- field loaded:", fieldType.FullName);
                    t.ResetColor();
                }
            }
Beispiel #3
0
 public Builder(string fileName = "Assembly-CSharp.dll")
 {
     assemblyName = fileName;
     graph        = new ClassGraph();
 }