![]() |
VOOZH | about |
dotnet add package GBX.NET --version 2.4.2
NuGet\Install-Package GBX.NET -Version 2.4.2
<PackageReference Include="GBX.NET" Version="2.4.2" />
<PackageVersion Include="GBX.NET" Version="2.4.2" />Directory.Packages.props
<PackageReference Include="GBX.NET" />Project file
paket add GBX.NET --version 2.4.2
#r "nuget: GBX.NET, 2.4.2"
#:package GBX.NET@2.4.2
#addin nuget:?package=GBX.NET&version=2.4.2Install as a Cake Addin
#tool nuget:?package=GBX.NET&version=2.4.2Install as a Cake Tool
A general purpose library for Gbx files - data from Nadeo games like Trackmania or Shootmania, written in C#/.NET. It supports high performance serialization and deserialization of 400+ Gbx classes.
For more details, see the main README.
Due to the recently paced evolution of .NET, framework support has been limited only to a few ones compared to GBX.NET 1:
You can still use GBX.NET 2 on the old .NET Framework, but the performance of the library could be degraded.
These examples expect you to have
<ImplicitUsings>enable</ImplicitUsings>. If this does not work for you, addusing System.Linq;at the top.
Additional package GBX.NET.LZO is required in this example.
using GBX.NET;
using GBX.NET.Engines.Game;
using GBX.NET.LZO;
Gbx.LZO = new Lzo();
var map = Gbx.ParseNode<CGameCtnChallenge>("Path/To/My.Map.Gbx");
foreach (var block in map.GetBlocks().GroupBy(x => x.Name))
{
Console.WriteLine($"{block.Key}: {block.Count()}");
}
using GBX.NET;
using GBX.NET.Engines.Game;
using GBX.NET.LZO;
var map = Gbx.ParseHeaderNode<CGameCtnChallenge>("Path/To/My.Map.Gbx");
Console.WriteLine(map.MapName);
Console.WriteLine(map.Xml);
Header contains a lot less information than the full node.
using GBX.NET;
using GBX.NET.Engines.Game;
using GBX.NET.LZO;
Gbx.LZO = new Lzo();
var gbx = Gbx.Parse<CGameCtnChallenge>("Path/To/My.Map.Gbx");
var map = gbx.Node; // See Clarity section for more info
map.MapName = "My new map name";
gbx.Save("Path/To/MyNew.Map.Gbx");
The trick here is that the Gbx properties are saved in the gbx object variable (Gbx class).
If you were to go with ParseNode in this case, this would not work for TMF and older games, but it is still possible if you specify the Gbx parameters in the Save method:
map.Save("Path/To/MyNew.Map.Gbx", new()
{
PackDescVersion = 2 // Latest known PackDesc version in TMF
});
For TMS or TMN ESWC, you would have to specify ClassIdRemapMode for example:
map.Save("Path/To/MyNew.Map.Gbx", new()
{
ClassIdRemapMode = ClassIdRemapMode.Id2006
PackDescVersion = 1
});
These save parameters depend on the game of choice, but since Trackmania 2, this does not matter.
Additional package GBX.NET.LZO is required in this example.
This example shows how you can retrieve ghost objects from multiple different types of Gbx:
using GBX.NET;
using GBX.NET.Engines.Game;
using GBX.NET.LZO;
Gbx.LZO = new Lzo();
var node = Gbx.ParseNode("Path/To/My.Gbx");
var ghost = node switch
{
CGameCtnReplayRecord replay => replay.GetGhosts().FirstOrDefault(),
CGameCtnMediaClip clip => clip.GetGhosts().FirstOrDefault(),
CGameCtnGhost g => g,
_ => null
};
if (ghost is null)
{
Console.WriteLine("This Gbx file does not have any ghost.");
}
else
{
Console.WriteLine("Time: {0}", ghost.RaceTime);
}
Using pattern matching with non-generic Parse methods is a safer approach (no exceptions on different Gbx types), but less trim-friendly.
In case you only need the most basic information about many of the most common Gbx files (maps, replays, items, ...), do not read the full Gbx file, but only the header part. It is a great performance benefit for disk scans.
using GBX.NET;
using GBX.NET.Engines.Game;
foreach (var filePath in Directory.EnumerateFiles("Path/To/My/Directory", "*.Replay.Gbx", SearchOption.AllDirectories))
{
try
{
DisplayBasicReplayInfo(filePath);
}
catch (Exception ex)
{
Console.WriteLine($"Gbx exception occurred {Path.GetFileName(filePath)}: {ex}");
}
}
void DisplayBasicReplayInfo(string filePath)
{
var nodeHeader = Gbx.ParseHeaderNode(filePath);
if (nodeHeader is CGameCtnReplayRecord replay)
{
Console.WriteLine($"{replay.MapInfo}: {replay.Time}");
}
}
Some of the common types to start with (a lot more are supported):
| Latest extension | Class | Can read | Can write | Other extension/s |
|---|---|---|---|---|
| Map.Gbx | CGameCtnChallenge | Yes | Yes | Challenge.Gbx |
| Replay.Gbx | CGameCtnReplayRecord | Yes | No | |
| Ghost.Gbx | CGameCtnGhost | Yes | Yes | |
| Clip.Gbx | CGameCtnMediaClip | Yes | Yes | |
| Item.Gbx | CGameItemModel | Yes | Yes | Block.Gbx |
| Mat.Gbx | CPlugMaterialUserInst | Yes | Yes | |
| Mesh.Gbx | CPlugSolid2Model | Yes | Yes | |
| Shape.Gbx | CPlugSurface | Yes | Yes | |
| Macroblock.Gbx | CGameCtnMacroBlockInfo | Yes | Yes | |
| Profile.Gbx | CGamePlayerProfile / CGameUserProfile | Yes | Yes | |
| SystemConfig.Gbx | CSystemConfig | Yes | Yes | |
| ScriptCache.Gbx | CScriptTraitsMetadata | Yes | Yes | |
| Scores.Gbx | CGamePlayerScore | Yes | Yes |
Many essential Gbx files from many games are supported:
GBX.NET library (this package) is MIT Licensed.
However, if you would use GBX.NET.LZO package with it (which is usually required), you'd need to follow the GNU GPL v3 License. See License section on the main README for more details.
Without these people, this project wouldn't be what it is today (ordered by impact):
And many thanks to every bug reporter!
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on GBX.NET:
| Package | Downloads |
|---|---|
|
GBX.NET.LZO
An LZO compression plugin for GBX.NET to allow de/serialization of compressed Gbx bodies. This official implementation uses lzo 2.10 from NativeSharpLzo and minilzo 2.06 port by zzattack. |
|
|
GBX.NET.Imaging
Provides extensions for image handling in GBX.NET (GDI+, Windows only). |
|
|
GBX.NET.PAK
Support for reading Pak (NadeoPak) package files, integrated with GBX.NET. |
|
|
GBX.NET.Tool
Base library for creating rich tools for different environments with GBX.NET. |
|
|
ManiaAPI.NadeoAPI.Extensions.Gbx
Extension methods of Nadeo API for GBX.NET features. Part of the ManiaAPI.NET library set. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.4.2 | 1,416 | 4/11/2026 |
| 2.4.1 | 728 | 4/4/2026 |
| 2.4.0 | 1,392 | 4/4/2026 |
| 2.3.4 | 671 | 2/19/2026 |
| 2.3.3 | 584 | 2/6/2026 |
| 2.3.2 | 1,533 | 1/31/2026 |
| 2.3.1 | 637 | 1/28/2026 |
| 2.3.0 | 2,264 | 1/6/2026 |
| 2.2.2 | 1,856 | 9/12/2025 |
| 2.2.1 | 1,322 | 7/18/2025 |
| 2.2.0 | 795 | 6/28/2025 |
| 1.2.13 | 392 | 3/18/2026 |
| 1.2.12 | 538 | 1/28/2026 |
| 1.2.11 | 573 | 1/12/2026 |
| 1.2.10 | 780 | 12/16/2025 |
| 1.2.9 | 937 | 11/7/2024 |
| 1.2.8 | 770 | 11/7/2024 |