Example #1
0
		public MethodIL GetMethodBody(int num)
		{
			MethodIL il = null;
			if (img == null) return il;
			MDStream tabs = Streams["#~"] as MDStream;
			TablesHeap tabsHeap = tabs.Heap as TablesHeap;
			if (tabsHeap.HasMethod) {
				MDTable methods = tabsHeap[TableId.Method];
				if (methods == null) return il;
				MethodRow row = methods[num] as MethodRow;
				if (row == null) return il;
				BinaryReader reader = img.reader;
				reader.BaseStream.Position = img.RVAToVA(row.RVA);
				il = new MethodIL();
				il.Read(reader);
			}
			return il;
		}