Пример #1
0
		public MethodBodyOptions(MethodDef method) {
			this.CodeType = method.CodeType;
			if (method.MethodBody is CilBody) {
				var headerRva = method.RVA;
				var headerFileOffset = (FileOffset)method.Module.ToFileOffset((uint)headerRva);
				var rva = (RVA)((uint)headerRva + method.Body.HeaderSize);
				var fileOffset = (FileOffset)((long)headerFileOffset + method.Body.HeaderSize);
				this.CilBodyOptions = new CilBodyOptions((CilBody)method.MethodBody, headerRva, headerFileOffset, rva, fileOffset);
				this.BodyType = MethodBodyType.Cil;
			}
			else if (method.MethodBody is NativeMethodBody) {
				this.NativeMethodBodyOptions = new NativeMethodBodyOptions((NativeMethodBody)method.MethodBody);
				this.BodyType = MethodBodyType.Native;
			}
			else
				this.BodyType = MethodBodyType.None;
		}