View Single Post
  #1  
Old 06-08-2020, 18:24
jonwil jonwil is offline
VIP
 
Join Date: Feb 2004
Posts: 387
Rept. Given: 2
Rept. Rcvd 21 Times in 9 Posts
Thanks Given: 2
Thanks Rcvd at 65 Times in 34 Posts
jonwil Reputation: 21
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);
		}
and this
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);
				}
and this
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];
		}
Are there any good tutorials on how to fix up such things?
Reply With Quote