GBX.NET 0.10.0

Open-source GBX format parser library with writing possibilities for .NET.

Suggested Alternatives

GBX.NET 0.11.0

There is a newer version of this package available.
See the version list below for details.
Install-Package GBX.NET -Version 0.10.0
dotnet add package GBX.NET --version 0.10.0
<PackageReference Include="GBX.NET" Version="0.10.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GBX.NET --version 0.10.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: GBX.NET, 0.10.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install GBX.NET as a Cake Addin
#addin nuget:?package=GBX.NET&version=0.10.0

// Install GBX.NET as a Cake Tool
#tool nuget:?package=GBX.NET&version=0.10.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

To parse a GBX with a known type:

var gbx = GameBox.Parse<CGameCtnChallenge>("MyMap.Map.Gbx");
// Node data is available in gbx.MainNode

To parse a GBX with an unknown type (method 1):

var gbx = GameBox.Parse("MyMap.Map.Gbx");

if (gbx is GameBox<CGameCtnChallenge> gbxMap)
{
    var map = gbxMap.MainNode;
    
    // Node data is available in map
}
else if (gbx is GameBox<CGameCtnReplayRecord> gbxReplay)
{
    var replay = gbxReplay.MainNode;
    
    // Node data is available in replay
}

To parse a GBX with an unknown type (method 2):

var gbx = GameBox.Parse("MyMap.Map.Gbx");

if (gbx.TryNode(out CGameCtnChallenge map))
{
    // Node data is available in map
}
else if (gbx.TryNode(out CGameCtnReplayRecord replay))
{
    // Node data is available in replay
}

To save changes of the parsed GBX file:

var gbx = GameBox.Parse("MyMap.Map.Gbx");

if (gbx is GameBox<CGameCtnChallenge> gbxMap)
{
    // Do changes with CGameCtnChallenge

    gbxMap.Save("MyMap.Map.Gbx"); // Can be also a new file
}
else if (gbx is GameBox<CGameCtnGhost> gbxGhost)
{
    // Do changes with CGameCtnGhost

    gbxGhost.Save("MyGhost.Ghost.Gbx"); // Can be also a new file
}

gbx.Save(); // will throw an error
// GameBox with unspecified/unknown type can't be currently written back

To save any supported Node to a GBX file:

var gbxReplay = GameBox.Parse<CGameCtnReplayRecord>("MyReplay.Replay.Gbx");
CGameCtnReplayRecord replay = gbxReplay.MainNode;

foreach (CGameCtnGhost ghost in replay.Ghosts)
{
    var gbxGhost = new GameBox<CGameCtnGhost>(ghost); // Create a GameBox<T> with the Node object
    gbxGhost.Save("MyExtractedGhost.Ghost.Gbx"); // Save the new GameBox object to a GBX file
}

To parse a GBX with a known type:

var gbx = GameBox.Parse<CGameCtnChallenge>("MyMap.Map.Gbx");
// Node data is available in gbx.MainNode

To parse a GBX with an unknown type (method 1):

var gbx = GameBox.Parse("MyMap.Map.Gbx");

if (gbx is GameBox<CGameCtnChallenge> gbxMap)
{
    var map = gbxMap.MainNode;
    
    // Node data is available in map
}
else if (gbx is GameBox<CGameCtnReplayRecord> gbxReplay)
{
    var replay = gbxReplay.MainNode;
    
    // Node data is available in replay
}

To parse a GBX with an unknown type (method 2):

var gbx = GameBox.Parse("MyMap.Map.Gbx");

if (gbx.TryNode(out CGameCtnChallenge map))
{
    // Node data is available in map
}
else if (gbx.TryNode(out CGameCtnReplayRecord replay))
{
    // Node data is available in replay
}

To save changes of the parsed GBX file:

var gbx = GameBox.Parse("MyMap.Map.Gbx");

if (gbx is GameBox<CGameCtnChallenge> gbxMap)
{
    // Do changes with CGameCtnChallenge

    gbxMap.Save("MyMap.Map.Gbx"); // Can be also a new file
}
else if (gbx is GameBox<CGameCtnGhost> gbxGhost)
{
    // Do changes with CGameCtnGhost

    gbxGhost.Save("MyGhost.Ghost.Gbx"); // Can be also a new file
}

gbx.Save(); // will throw an error
// GameBox with unspecified/unknown type can't be currently written back

To save any supported Node to a GBX file:

var gbxReplay = GameBox.Parse<CGameCtnReplayRecord>("MyReplay.Replay.Gbx");
CGameCtnReplayRecord replay = gbxReplay.MainNode;

foreach (CGameCtnGhost ghost in replay.Ghosts)
{
    var gbxGhost = new GameBox<CGameCtnGhost>(ghost); // Create a GameBox<T> with the Node object
    gbxGhost.Save("MyExtractedGhost.Ghost.Gbx"); // Save the new GameBox object to a GBX file
}

Release Notes

LZO transfered to GBX.NET.LZO library with 64bit saving, TM2020 ghost data, member renames, wider input support.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on GBX.NET:

Package Downloads
GBX.NET.Json
A wrapper for better JSON serialization of GBX, useful for comparing data.
GBX.NET.Imaging
A wrapper for handling images inside GBX files.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
0.12.0 59 8/26/2021
0.11.0 199 6/25/2021
0.10.2 413 6/6/2021
0.10.1 350 6/5/2021
0.10.0 325 6/1/2021
0.9.0.1 91 3/5/2021
0.9.0 214 3/4/2021
0.9.0-rc 201 2/28/2021
0.8.0 85 1/29/2021
0.8.0-rc2 225 1/20/2021
0.8.0-rc 221 1/19/2021
0.7.0 228 1/4/2021
0.6.3 320 1/1/2021
0.6.2 299 12/22/2020
0.6.1 212 12/21/2020
0.6.0 236 12/15/2020
0.5.4 304 12/10/2020
0.5.3 281 11/22/2020
0.4.1 286 11/11/2020