示例#1
0
		internal DecompilationContext (MethodBody body, ControlFlowGraph cfg)
		{
			this.body = body;
			this.method = body.Method;
			this.variables = CloneCollection (body.Variables);
			this.cfg = cfg;
		}
		static int GetBlockId (ControlFlowGraph cfg, InstructionBlock block)
		{
			return ((IList<InstructionBlock>) cfg.Blocks).IndexOf (block) + 1;
		}
		public static string ToString (ControlFlowGraph cfg)
		{
			StringWriter writer = new StringWriter ();
			FormatControlFlowGraph (writer, cfg);
			return writer.ToString ();
		}
		protected void RunTestCase (string name)
		{
			MethodDefinition method = LoadTestCaseMethod (name);
			ControlFlowGraph cfg = ControlFlowGraph.Create (method);
			Assert.AreEqual (Normalize (LoadExpectedControlFlowString (name)), Normalize (ToString (cfg)));
		}
 	public void add_Nodes(TreeNode treeNode, ControlFlowGraph controlFlowGraph)
 	{
 		foreach(var block in controlFlowGraph.Blocks)
 		{
 			var nodeText = string.Format("Block #{0}", block.Index);
 			tvDirectoriesAndFiles.add_Node(treeNode,nodeText,block,true);
 		}
 	}