Home | Download | Discussion | Help | Site Map | New Posts | Sign in

Latest Site News

Nysha's New Creators for July - posted on 1st Aug 2018 at 9:00 AM
Replies: 8 (Who?), Viewed: 16534 times.
1978 gallons of pancake batter
Original Poster
#1 Old 12th Mar 2011 at 2:42 PM
Default Tools for browsing and decompiling .NET/MONO assemblies
If you want to write scripts for TS3 or alter the core, you'll need a tool to browse and decompile the TS3 core assemblies.

.NET Reflector

Reflector has been the top dog in browsing/decompiling .NET assemblies for years; in fact it's been the only tool for it. As of March 2011 the tool has gone pay with the release of version 7. It now costs $35 and needs to be activated. Information on the activation process is sparse; I only know that the tool gets chained to your computer and that you need to deactivate it to use a registration key on another computer. I don't know if the tool can be activated on multiple computers at the same time.

If you're willing to pay for it and don't mind the activation process, it's definitely a very good and mature tool.

You'll have no problem to find download mirrors for version 6.5 of Reflector, the last free version. Reflector is time-bombed, though, and V6.5 installations will cease to work and delete themselves in May 2011.

ILSpy

ILSpy is a very young tool, 5 weeks at the time I write this to be precise. Yet the progress it made is nothing but impressive. The analyzer doesn't work for me yet, but the decompiling quality is already very good. See second post for an example.

This tool currently has a downside: You can't limit it to .NET 2.0, so you'll find code that won't compile when you limit Visual Studio to .NET 2.0.

Still, I consider ILSpy a reasonable alternative to Reflector already, and if the development continues at a similar pace, it may even become better than Reflector.

Tools that might become alternatives in the future

Monoflector
Last time I checked, Monoflector didn't even have the functionality to open assemblies, so I have no idea what its decompiler is worth.

Announcement for a FOC tool by JetBrains
This tool isn't even available yet, and it remains to be seen what it's worth if it really gets released this year. JetBrains knows their stuff, though, so it might amount to something.

Got something to add?

If you know any other tool(s), please give a link and post your experience with it. Same goes if you have something to say about the listed tools.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
7 users say thanks for this. (Who?)
Advertisement
1978 gallons of pancake batter
Original Poster
#2 Old 12th Mar 2011 at 2:43 PM Last edited by Buzzler : 12th Mar 2011 at 3:10 PM.
Decompilation examples:

Original
Code:
private BookSkill FindSkillBook()
{
    if (!this.ConfigureAvailableSkills())
    {
        return null;
    }
    List<SkillNames> list = HelperMethods.FindSkillsOfInterest(base.Actor).FindAll(delegate(SkillNames names) { return this.mSkillNames.Contains(names); });
    SkillNames skillName;
    if (list.Count > 0)
    {
        skillName = RandomUtil.GetRandomObjectFromList<SkillNames>(list);
    }
    else if (this.mSkillNames.Count > 0)
    {
        skillName = RandomUtil.GetRandomObjectFromList<SkillNames>(this.mSkillNames);
    }
    else
    {
        return null;
    }
    foreach (BookSkill book in this.mSkillBooks)
    {
        BookSkillData data = book.Data as BookSkillData;
        if ((data != null) && (data.SkillGuid == skillName))
        {
            return book;
        }
    }
    return null;
}


Reflector
Code:
private BookSkill FindSkillBook()
{
    SkillNames skillName;
    if (this.ConfigureAvailableSkills())
    {
        List<SkillNames> list = HelperMethods.FindSkillsOfInterest(base.Actor).FindAll(delegate (SkillNames names) {
            return this.mSkillNames.Contains(names);
        });
        if (list.Count > 0x0)
        {
            skillName = RandomUtil.GetRandomObjectFromList<SkillNames>(list);
            goto Label_0057;
        }
        if (this.mSkillNames.Count > 0x0)
        {
            skillName = RandomUtil.GetRandomObjectFromList<SkillNames>(this.mSkillNames);
            goto Label_0057;
        }
    }
    return null;
Label_0057:
    foreach (BookSkill book in this.mSkillBooks)
    {
        BookSkillData data = book.Data as BookSkillData;
        if ((data != null) && (data.SkillGuid == skillName))
        {
            return book;
        }
    }
    return null;
}


ILSpy
Code:
private BookSkill FindSkillBook()
{
	if (!this.ConfigureAvailableSkills())
	{
		return null;
	}
	List<SkillNames> list = HelperMethods.FindSkillsOfInterest(this.Actor).FindAll((SkillNames names) => this.mSkillNames.Contains(names));
	SkillNames randomObjectFromList;
	if (list.Count > 0)
	{
		randomObjectFromList = RandomUtil.GetRandomObjectFromList<SkillNames>(list);
	}
	else
	{
		if (this.mSkillNames.Count <= 0)
		{
			return null;
		}
		randomObjectFromList = RandomUtil.GetRandomObjectFromList<SkillNames>(this.mSkillNames);
	}
	BookSkill bookSkill;
	foreach (BookSkill current in this.mSkillBooks)
	{
		BookSkillData bookSkillData = current.Data as BookSkillData;
		if (bookSkillData != null && bookSkillData.SkillGuid == randomObjectFromList)
		{
			bookSkill = current;
			return bookSkill;
		}
	}
	return null;
	return bookSkill;
}


Evaluation

Reflector
As you can see, Reflector's decompilation utilizes goto calls. It tends to do that now and then, which makes the affected code hard to read. Usually the decompilation is very good, though, and you can see that it had no problem decompiling the anonymous method call in FindAll.

ILSpy
ILSpy managed to decompile without needing goto calls, but it gacked a little on the foreach loop. That code would cause a compiler warning, but it would still compile. ILSpy properly decompiled the anonymous method call in FindAll as well, but it used a lambda expression to do so. That wouldn't compile in a project for TS3, because lamda expressions aren't supported in .NET 2.0, so you'd need to change that if you copy&paste-ed code. On a side note: The EAxian devs don't use delegate calls that much. By the time I write this, I'd see ILSpy's decompilation almost but not entirely on par with Reflector.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Lab Assistant
#3 Old 6th Jun 2011 at 3:36 PM
A quick heads up, Reflector's 6 series received a final update, Reflector 6.8. It's functionally identical to Reflector 6.6, but doesn't have the time bomb anymore. And, while free for previous free Reflector users, it does require registration.
Forum Resident
#4 Old 6th Jun 2011 at 10:12 PM
does it come with an uninstaller? My butt is still chapped from manually uninstalling reflector
when the time bomb went off. I think I'll stick with ilspy, it does what I want it to do, and *only*
what I want it to do.
˙uʍop ǝpᴉsdn ǝɹ,noʎ 'oN
#5 Old 6th Jun 2011 at 10:27 PM
I used ILSpy for a little while , but went back to Reflector, because i missed the way it searched(and other little things).

"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
Lab Assistant
#6 Old 24th Jan 2012 at 7:07 PM
Has anybody used dotPeek .NET decompiler from JetBrains yet I just discovered my version of reflector is not working.
Test Subject
#7 Old 7th Aug 2012 at 4:17 AM
Bumping this thread as I have just spent the last 48hrs playing around with every decompiler I could get my hands on to try and decompile Sims3GameplaySystems.dll in full.

Has anyone ever managed to decompile the core dll's to c# from il code so that it can be rebuilt in visual studio. Every attempt at decompiling leaves the code with some fairly ugly irrecoverable syntax errors, including passing uint var to int vars, etc. Impossible to fix by hand.

Anyone know if this has been done?

I'm trying to avoid messing around with il code, and/or injecting redirects to a mod lib.

Thanks very much for you help in advance, even if it is to tell me I'm dreaming and it can't be done!
Lab Assistant
#8 Old 17th Jun 2013 at 2:15 PM Last edited by Kimsie : 17th Jun 2013 at 2:16 PM. Reason: Typo
Does anybody know whether ILSpy has reached the level of Reflector yet?

Whenever people agree with me, I always feel I must be wrong

- Oscar Wilde
Forum Resident
#9 Old 28th Apr 2014 at 2:32 PM
As far as I'm concerned, ILSpy is _better_ than reflector, by at least $95 and a couple of plug-ins.
But, I can't help wondering what happened after june 3rd, 2012. ILSpy hasn't been updated
since.
Back to top