PDA

View Full Version : .NET - LFSReplayParser - Library to parse LFS replay headers


DarkTimes
6th April 2008, 00:42
LFSReplayParser is a .NET library which parses the headers from Live for Speed multiplayer (http://www.lfs.net/?page=MPR) and singleplayer (http://www.lfs.net/?page=SPR) replay files. It is based on my experience designing the league admin tool LFSPoints.

The library is provided as a Microsoft Visual C# 2008 Express Edition solution, with a short example program, LFSReplayViewer.zip, as a secondary option. You may download the source for both programs below.

It is released under the LGPL open-source license.

AndroidXP
6th April 2008, 00:54
Nice, though you shall receive five trout slaps for using goto :p

mcgas001
6th April 2008, 00:57
Nice, though you shall receive five trout slaps for using goto :p

LOL Where?

Nice work DarkTimes, Certainly something i shall play with! :thumb:

AndroidXP
6th April 2008, 01:02
Well, at least I think he does. Maybe it's a compiler optimization, who knows :tilt:

mcgas001
6th April 2008, 01:05
Well, at least I think he does. Maybe it's a compiler optimization, who knows :tilt:

Been disassembling code now have we? :p

DarkTimes
6th April 2008, 01:06
Hmm, weird. Must be an optimisation by the C# compiler, as I really don't use any goto in it. Funnily enough I was thinking about using a goto for something else the other day, but I couldn't actually remember the syntax for delaring one, as I've genuinely used it that little.

AndroidXP
6th April 2008, 01:09
I've rechecked and yes, it seems to be a compiler optimization. I guess you have a bit of "duplicate code" in many of the switch cases in LfsFileReader.ReadEncodedString(), the compiler seems to put a bunch of labels after the switch to optimize code usage for cases that would use the same or similar parts of code.

E: So only one trout slap for allowing the compiler to use goto in your precious code :p

DarkTimes
6th April 2008, 01:12
Well, I need to get over my weird paranoid complex about posting source-code, so I've uploaded the Visual C# 2008 Express Edition project files. Be gentle, this is a new experience for me. :)

Edit: Also remember it's code mostly hacked from a different program and put together after a few whisky's on a Saturday night. :)

AndroidXP
6th April 2008, 01:27
If you wanted to protect your sources, .NET is in my experience unfortunately a rather bad place to be in general. By using .NET Reflector you can pretty much look at any MSIL based code (.NET dlls and exe files) and get a 99% working copy & pasteable code (in the language you specify; C#, VB.NET... whatever you want). It's so simple any doofus can use it, and it's actually a quite nice tool if you want to learn how MSIL code works. Using the Reflexil addon you can even do simple code manipulations, though they mostly have to be done in IL directly.

Afaik your best bet is trying to use some obfuscators, but they only do what their name suggests, obfuscate the code to make it harder to read, not impossible. :shrug:

You could argue that reverse engineering has always been possible, but it's actually a bit scary once it gets so easy and produces such nice readable code.

traxxion
7th April 2008, 11:10
Holy shit, just one day after I finished my own replay parser I find this thread :schwitz: :banghead:
Good job there though, some interesting solutions for problems I also bumped into! :)

DarkTimes
23rd December 2008, 21:37
edit: irrelevant.

Leandrus
23rd December 2008, 23:35
:wow: This is great. why i haven't seen this thread before :razz:
Excellent Work and Thank you very much :thumb:

DarkTimes
24th December 2008, 19:42
edit: irrelevant.

z0rnd1k3
6th June 2011, 16:10
is it possible to extract setup from .spr files in hotlap mode ? Hex editor wasnt found equal places in two .spr with one setup used in it.

avetere
6th June 2011, 16:18
No it isn't - apart from the info already available - as setup information is encrypted.