• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 07:47
CEST 13:47
KST 20:47
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
RSL Season 1 - Final Week2[ASL19] Finals Recap: Standing Tall10HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0
Community News
Firefly given lifetime ban by ESIC following match-fixing investigation14$25,000 Streamerzone StarCraft Pro Series announced6Weekly Cups (June 30 - July 6): Classic Doubles6[BSL20] Non-Korean Championship 4x BSL + 4x China9Flash Announces Hiatus From ASL67
StarCraft 2
General
RSL Season 1 - Final Week Firefly given lifetime ban by ESIC following match-fixing investigation The SCII GOAT: A statistical Evaluation TL Team Map Contest #4: Winners Weekly Cups (June 30 - July 6): Classic Doubles
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament $25,000 Streamerzone StarCraft Pro Series announced FEL Cracov 2025 (July 27) - $8000 live event RSL: Revival, a new crowdfunded tournament series WardiTV Mondays
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion Flash Announces Hiatus From ASL [G] Progamer Settings ASL20 Preliminary Maps
Tourneys
[Megathread] Daily Proleagues [BSL20] Non-Korean Championship 4x BSL + 4x China [BSL20] Grand Finals - Sunday 20:00 CET CSL Xiamen International Invitational
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Path of Exile What do you want from future RTS games? Beyond All Reason
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Positive Thoughts on Setting Up a Dual-Caliber FX
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Stop Killing Games - European Citizens Initiative Things Aren’t Peaceful in Palestine Summer Games Done Quick 2025! Russo-Ukrainian War Thread
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
2024 - 2025 Football Thread Formula 1 Discussion NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Men Take Risks, Women Win Ga…
TrAiDoS
momentary artworks from des…
tankgirl
from making sc maps to makin…
Husyelt
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 592 users

sc2replay-csharp - Open-source C# Parsing Library

Forum Index > SC2 General
Post a Reply
Ascend
Profile Joined July 2010
United States120 Posts
July 13 2011 02:10 GMT
#1
[image loading]

I never made a formal TL post about this library, so better late than never.

SC2Replay-CSharp is an open-source library for assisting developers in parsing information in Starcraft 2 replay files. While a work in progress, it can parse lots of useful information including player, team, match information, and chat logs.

Tested to support replays from 1.1.3-1.3.4, but may work with earlier versions.

Let me emphasize: This is intended for developers.

Latest Version: 1.3
Last Updated: 7/12/2011

Contribute on Github.

Releases can be found in the download section on Github, but I recommend compiling the latest version of the code to ensure the most stability with the latest replays.

Please try to submit bugs on the Github issues page, otherwise feel free to comment, make requests, and critique to your liking. Also let me know if you're using this in a project, I'll add you to the list!

Software using this library

+ Show Spoiler +
* SC2Replay Chat Log Editor ~ Ascend
* SC2 ChatCloud ~ tomatolicious


Changelog:

+ Show Spoiler +
v1.3
* Player teams are more reliable for all matchups.
* SelectedRace added to Player (shows the race the player selected in lobby, including Random)
* Timestamp now reflects the correct time at which the game happened, taking into account Timezones to adjust to proper UTC time.

v1.2
* Fixes issues with Korean text in file names.
* Fixes "replay" appearing in namespaces twice.

v1.1
* Korean player names now parse correctly.
* Korean chat is now parsed correctly.
* Player's BNET IDs and BNET Gateway is now parsed.

v1.0
* Some kind of stable release. I wasn't tracking changes up to this point.


My Other Releases
Starboard - SC2 Caster Scoreboard
SC2Replay Chat Log Editor
SC2 Replay Sync
Caster and Software Developer. Releases: "Starboard" "SC2 Replay Sync" "SC2 Replay Chat Editor" "SC2 C# Replay Parser"
Alabasern
Profile Blog Joined September 2010
United States4005 Posts
July 13 2011 03:26 GMT
#2
Good contribution to the dev community.
Support your esport!
TheAlchemist89
Profile Blog Joined December 2010
160 Posts
July 13 2011 03:29 GMT
#3
Very cool, finally a C# based framework :D

If I can get some spare time I may try to help with this! Thanks for the contribution.
bok
Profile Joined April 2011
Sweden5 Posts
August 02 2011 09:03 GMT
#4
Very nice, had a little look at this just now since I was curious about what information is actually stored in a replay (due to MLG comment about not releasing replays).
The MpqLib you use is it the one made by Magos?
Ascend
Profile Joined July 2010
United States120 Posts
August 05 2011 18:56 GMT
#5
On August 02 2011 18:03 bok wrote:
Very nice, had a little look at this just now since I was curious about what information is actually stored in a replay (due to MLG comment about not releasing replays).
The MpqLib you use is it the one made by Magos?


Yup, although I'd almost like to move away from it. I know some people who wanted to use this library through Mono, and it's not possible with that library. Also, it can't deal with korean characters in paths (UTF8 not supported I suppose) so I've had to make work-arounds to deal with that.
Caster and Software Developer. Releases: "Starboard" "SC2 Replay Sync" "SC2 Replay Chat Editor" "SC2 C# Replay Parser"
Qxz
Profile Joined May 2011
Canada189 Posts
Last Edited: 2011-08-11 15:28:58
August 11 2011 15:23 GMT
#6
Thanks a lot, I was looking for something like this!

EDIT: I'm not too good at bit fiddling, could you explain what this does?

public static long ParseLongValueStruct(BinaryReader reader)
{
long l2 = 0;

for (int k = 0;; k += 7)
{
long l1 = reader.ReadByte();

l2 |= (l1 & 0x7F) << k;

if ((l1 & 0x80) == 0)
{
return (l2 & 1L) > 0L ? -(l2 >> 1) : l2 >> 1;
}
}
}
Ascend
Profile Joined July 2010
United States120 Posts
Last Edited: 2011-08-11 16:25:22
August 11 2011 16:24 GMT
#7
On August 12 2011 00:23 Qxz wrote:
I'm not too good at bit fiddling, could you explain what this does?

Show nested quote +
public static long ParseLongValueStruct(BinaryReader reader)
{
long l2 = 0;

for (int k = 0;; k += 7)
{
long l1 = reader.ReadByte();

l2 |= (l1 & 0x7F) << k;

if ((l1 & 0x80) == 0)
{
return (l2 & 1L) > 0L ? -(l2 >> 1) : l2 >> 1;
}
}
}


The first bit on every byte in a ValueStruct indicates whether there is another byte to be read. If so, the loop continues and the bits are shifted appropriately.
Caster and Software Developer. Releases: "Starboard" "SC2 Replay Sync" "SC2 Replay Chat Editor" "SC2 C# Replay Parser"
Chronald
Profile Joined December 2009
United States619 Posts
August 11 2011 16:26 GMT
#8
You sir a an amazingly massive BAUS!!

This is awesome!!
Got that.
daok911
Profile Joined July 2011
Canada8 Posts
August 30 2011 15:46 GMT
#9
How have you found all those bits stuff that the BinaryReader use? I am interested to participate but I just do not see where to begin
Ascend
Profile Joined July 2010
United States120 Posts
September 06 2011 23:27 GMT
#10
On August 31 2011 00:46 daok911 wrote:
How have you found all those bits stuff that the BinaryReader use? I am interested to participate but I just do not see where to begin


A combination of using hex editors to examine the data, porting code from phpsc2replay, and looking at decompiled SC2Gears code. In other words, it's not exactly easy.
Caster and Software Developer. Releases: "Starboard" "SC2 Replay Sync" "SC2 Replay Chat Editor" "SC2 C# Replay Parser"
Bobbias
Profile Blog Joined March 2008
Canada1373 Posts
September 07 2011 00:16 GMT
#11
Wow, this is awesome. I don't program much, but when I do, it's in C# and I'm always finding that it's a pain to find good libraries in C# sometimes, it's nice to see someone making a good SC2 replay library for it.
Furlqt
Profile Joined July 2011
United States23 Posts
Last Edited: 2012-06-24 04:56:39
June 24 2012 04:50 GMT
#12
I've made a fork of this library. It needs further testing, but as far as I can tell it's solid.

I reverse engineered replay.game.events from scratch, and I added full events parsing for all versions from 1.1.0 onward. The amount of raw data the library now gives from a replay parse is more than SC2Gears. I also separated the translation of version-specific ids to version-independent enum values into a simple data file system, making version upgrades much easier to deal with.

I documented the technical details of the replay.game.events file on the wiki, for anyone who may be interested.

I'll start testing more rigorously tomorrow (I've only ran through one replay for each patch version, and a few more for 1.4.3), as well as implementing any suggestions you may have.
Please log in or register to reply.
Live Events Refresh
RSL Revival
10:00
Season 1: Playoffs Day 5
Clem vs ReynorLIVE!
Crank 1384
Tasteless1068
ComeBackTV 878
IndyStarCraft 150
Rex128
3DClanTV 78
IntoTheiNu 62
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Crank 1384
Tasteless 1068
RotterdaM 174
IndyStarCraft 150
Rex 128
StarCraft: Brood War
Calm 27760
Sea 21692
Rain 5952
Bisu 2907
Jaedong 816
Hyuk 739
Pusan 641
Light 628
firebathero 436
Mini 416
[ Show more ]
Zeus 314
Stork 284
actioN 277
EffOrt 240
Soulkey 206
Backho 183
Hyun 167
ToSsGirL 144
hero 107
Mind 65
Snow 53
JYJ38
sSak 34
Shinee 27
Aegong 26
Sharp 24
JulyZerg 23
Sacsri 22
sorry 21
Icarus 21
Rush 21
sas.Sziky 20
Noble 17
Free 15
ajuk12(nOOB) 13
yabsab 10
Sexy 10
Movie 8
IntoTheRainbow 8
SilentControl 7
Hm[arnc] 6
ivOry 4
Dota 2
Gorgc6926
XaKoH 570
XcaliburYe374
League of Legends
singsing1693
Counter-Strike
x6flipin523
allub243
flusha224
Heroes of the Storm
Khaldor147
Other Games
tarik_tv24977
B2W.Neo807
shahzam655
crisheroes477
DeMusliM413
Fuzer 265
Liquid`RaSZi154
Pyrionflax146
Organizations
Other Games
gamesdonequick27585
StarCraft: Brood War
Kim Chul Min (afreeca) 736
lovetv 8
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 11 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Stunt508
Upcoming Events
OSC
1h 13m
Replay Cast
12h 13m
RSL Revival
22h 13m
Classic vs Cure
FEL
1d 4h
OSC
1d 8h
RSL Revival
1d 22h
FEL
2 days
FEL
2 days
CSO Cup
2 days
BSL20 Non-Korean Champi…
2 days
Bonyth vs QiaoGege
Dewalt vs Fengzi
Hawk vs Zhanhun
Sziky vs Mihu
Mihu vs QiaoGege
Zhanhun vs Sziky
Fengzi vs Hawk
[ Show More ]
Sparkling Tuna Cup
2 days
RSL Revival
2 days
FEL
3 days
BSL20 Non-Korean Champi…
3 days
Bonyth vs Dewalt
QiaoGege vs Dewalt
Hawk vs Bonyth
Sziky vs Fengzi
Mihu vs Zhanhun
QiaoGege vs Zhanhun
Fengzi vs Mihu
Replay Cast
4 days
Replay Cast
6 days
The PondCast
6 days
Liquipedia Results

Completed

Proleague 2025-07-07
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
CSL Xiamen Invitational
CSL Xiamen Invitational: ShowMatche
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
Underdog Cup #2
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.