#1
|
|||
|
|||
Tips for fixing up decompiled .NET code?
I have decompiled a .NET binary with dnSpy and the resulting output has some strange things in it like this
Code:
public HouseType(sbyte id, string name, string unitTeamColor, string buildingTeamColor, [TupleElementNames(new string[] { "type", "teamColor" })] params ValueTuple<string, string>[] overrideTeamColors) { this.ID = id; this.Name = name; this.UnitTeamColor = unitTeamColor; this.BuildingTeamColor = buildingTeamColor; this.OverrideTeamColors = overrideTeamColors.ToDictionary(([TupleElementNames(new string[] { "type", "teamColor" })] ValueTuple<string, string> x) => x.Item1, ([TupleElementNames(new string[] { "type", "teamColor" })] ValueTuple<string, string> x) => x.Item2); } Code:
for (int i = 0; i < array2.Length; i++) { var <>f__AnonymousType = array2[i]; this.plugin.Map.Triggers.Add(<>f__AnonymousType.NewTrigger.Clone()); this.plugin.Map.Triggers.Remove(<>f__AnonymousType.OldTrigger); } Code:
[CompilerGenerated] internal static string <LoadINI>g__indexToType|20_1(IList<string> list, string index) { int num; if (!int.TryParse(index, out num) || num < 0 || num >= list.Count) { return list.First<string>(); } return list[num]; } |
#2
|
||||
|
||||
This is normal code, what do you need to fix ?
Try to familiarize yourself with .NET framework classes, maybe this can help. |
#3
|
|||
|
|||
Turns out that ILSpy is the best decompiler and produced output that had few problems.
|
#4
|
|||
|
|||
The ValueTuple and AnonymousType are just in a really ugly long form syntax. They can be reduced easily. Incidentally it's one reason to avoid them in code designed to be high performance as they can introduce extra generated code. The naming on the compiler generated function can be cleaned up that's the only annoying thing there. As for getting rid of all the compiler generated functions, this is the job of a good decompiler that can manage such refactorings
|
#5
|
||||
|
||||
how to avoid start activation during 30 trial days and after that using an unic code changing next ?
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Dim num As Integer Dim num2 As UInt32 Dim num3 As UInt32 Try If (MySettingsProperty.Settings.Culture.Length > 0) Then Thread.CurrentThread.CurrentUICulture = New CultureInfo(MySettingsProperty.Settings.Culture) End If Catch exception1 As Exception Dim ex As Exception = exception1 ProjectData.SetProjectError(ex) Dim exception As Exception = ex ProjectData.ClearProjectError End Try Me.Localize Me.KSVE = New KSVE4Class Me.KSVE.Initialize(-1281006) Me.KSVE.FindActivation(num, num2, num3) If ((num <> 0) And (num <> &H100)) Then Me.RunActivationApplication MyBase.Close Else Me.voice = New SpeechSynthesizer Me.ComboBox1.Items.Clear Dim voice As InstalledVoice For Each voice In Me.voice.GetInstalledVoices Me.ComboBox1.Items.Add(voice.VoiceInfo.Name) Next If (Me.ComboBox1.Items.Count > 0) Then Me.ComboBox1.SelectedIndex = 0 End If End If End Sub
__________________
Decode and Conquer |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help to fixing API-Calls | Nukacola | General Discussion | 6 | 05-11-2005 16:49 |
Import OS Fixing | MaRKuS-DJM | General Discussion | 31 | 07-16-2004 23:20 |
Fixing an EXE to not call a DLL? | Barry | General Discussion | 11 | 06-03-2004 00:37 |
Problem with fixing IAT | K3nny | General Discussion | 5 | 01-04-2004 19:26 |