LeagueReplayParser
C# library which can read some data from a .rofl file, and start a replay in the client. (no longer actively maintained)
Install / Use
/learn @innocenzi/LeagueReplayParserREADME
League Replay Parser
This is a library which allows you to easily parse a League of Legend replay file. Those files are default-located in your documents under League of Legends/Replays folder and have the .rofl (Replay of League) extention.
Getting started
Installation
You will first need to install the library by either downloading it or installing it from NuGet.
Usage
At first, you will need to deal with the League object. It is the object that will give you informations about the installed League of Legends version and which will allow you to start a replay.
League
Initialization
First, instanciate it: League league = new League(@"C:\Riot Games");. It will check if the given repertory exists, and if not, it will throw an IOException.
You may overload League constructor with the replay directory: new League("@C:\Riot Games", @"D:\League\Replays");. By default, your replay directory is in your documents and the library will find it.
Also, League contains properties DefaultRiotDirectory and DefaultReplaysDirectory which contains the default paths for the game and the replays.
Loading replays
Once League is initialized, you will need to load the replays. It is recommended to load them asynchronously just in case you have a slow machine and the parsing take long enough to freeze an eventual UI.
// Async
await league.LoadReplaysAsync();
// Sync
league.LoadReplays();
You can now access all available replays by using league.Replays property.
Starting replays
After getting your Replay object, you will be able to start it thanks to your League instance.
The following code will start all the playable replays in a row.
foreach (Replay replay in league.Replays)
if (replay.CanBePlayed.GetDefaultOrValue(true))
await league.StartReplayAsync(replay);
The nullable bool CanBePlayed property will return true if your League of Legends' version is equal (or lower but this should not happen, right?) to the replay's League version, but will return false if not or null if you never instanciated any League object.
In a simplier way, you can start a replay file by just using league.StartReplayAsync(@"C:\League\Replays\yourReplay.rofl");.
Replay
The Replay object contains some data about your replay file, such as informations about the two teams, their champions, their stuff, level, and other stuff.
// Display purple team informations
foreach (Player player in replay.PurpleTeam.Players)
{
Console.WriteLine();
Console.WriteLine($"› {player.PlayerName} as {player.ChampionName}:");
Console.WriteLine($" Level: {player.Level}");
Console.WriteLine($" KDA: {player.KDA.Kills}/{player.KDA.Deaths}/{player.KDA.Assistances} ({player.KDA.Ratio})");
Console.WriteLine($" Lane: {player.Lane.ToString()}");
Console.WriteLine($" Minion score: {player.MinionScore}");
}
Example code
As an example, this code will display some data from the first available replay file as well as the stats from the wining team.
League league = new League(League.DefaultRiotDirectory);
await league.LoadReplaysAsync(Encoding.UTF8);
Console.WriteLine($"League version: {league.Version}");
Console.WriteLine($"Found {league.Replays.Count} replays.");
if (league.Replays.Count > 0)
{
Replay replay = league.Replays[0];
Console.WriteLine($"Looking out first replay.");
Console.WriteLine($"League version: {replay.GameVersion.ToString()}");
Console.WriteLine($"Game duration: {replay.GameLength.ToString()}");
Console.WriteLine($"Winning team: {replay.WiningTeam.Side.ToString()}");
foreach (Player player in replay.WiningTeam.Players)
{
Console.WriteLine();
Console.WriteLine($"+ {player.PlayerName} as {player.ChampionName}:");
Console.WriteLine($" Level: {player.Level}");
Console.WriteLine($" KDA: {player.KDA.Kills}/{player.KDA.Deaths}/{player.KDA.Assistances} ({player.KDA.Ratio})");
Console.WriteLine($" Lane: {player.Lane}");
Console.WriteLine($" Minion score: {player.MinionScore}");
}
}
To-do
- [ ] Instead of having only one replay directory, add multiple ones.
- [ ] Get more stats and data from the replay file (I'll do that if you ask me).
Related Skills
node-connect
349.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
