简体   繁体   English

如何使ILspy C#反编译结果具有更好的格式?

[英]how to make ILspy c# decompile result have better format?

ILspy is a amazing tool, but when I use it decompile dll, I have result like this: ILspy是一个了不起的工具,但是当我使用它反编译dll时,结果如下:

this.lastOrientation = base.get_Orientation();

but what it should be is like this: 但是应该是这样的:

this.lastOrientation = base.Orientation;

how can I get the better result? 如何获得更好的结果?

more examples like this: 更多类似的例子:

It shall be: 应为:

battery_logo.Visibility = System.Windows.Visibility.Visible;

but what we get is: 但是我们得到的是:

battery_logo.set_Visibility(System.Windows.Visibility.Visible);

When we build will get error like: 当我们建立时会得到类似的错误:

'System.Windows.UIElement.Visibility.set': cannot explicitly call operator or accessor

There is a bug report here: https://github.com/icsharpcode/ILSpy/issues/380 这里有一个错误报告: https : //github.com/icsharpcode/ILSpy/issues/380

Someone wrote: 有人写道:

It turns out the issue was related to missing dependency assembly an the base type. 事实证明,该问题与缺少依赖程序集和基本类型有关。 I no longer see that issue. 我不再看到那个问题。 I am stymied on some obfuscated code though, not sure if you'd be interested in helping me work through that but I'd sure appreciate the help. 不过,我受困于一些混淆的代码,不确定您是否有兴趣帮助我完成这些工作,但我一定会感谢您的帮助。

You said that you are decompiling an app for Windows Phone. 您说您正在反编译Windows Phone的应用程序。 What you could try is loading the referenced assemblies of Windows Phone in ILSpy 您可以尝试在ILSpy中加载Windows Phone的引用程序集

ILspy is a amazing tool, but when I use it decompile dll, I have result like this: ILspy是一个了不起的工具,但是当我使用它反编译dll时,结果如下:

 this.lastOrientation = base.get_Orientation(); 

but what it should be is like this: 但是应该是这样的:

 this.lastOrientation = base.Orientation; 

Orientation is probably a property and Properties in c# are actually kind of syntactic sugar and they internally simply translated to getter & setter methods under the hood - This is why you see the decompiled code as if it was a call to a method and a read of a regular property. Orientation可能是一个属性,而c#中的属性实际上是一种语法糖,它们在内部被简单地转换为幕后的getter和setter方法-这就是为什么您将反编译后的代码看作是对方法的调用并读取了普通财产。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM