ChunkL 1.2.1

dotnet add package ChunkL --version 1.2.1
                    
NuGet\Install-Package ChunkL -Version 1.2.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ChunkL" Version="1.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ChunkL" Version="1.2.1" />
                    
Directory.Packages.props
<PackageReference Include="ChunkL" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ChunkL --version 1.2.1
                    
#r "nuget: ChunkL, 1.2.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ChunkL@1.2.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ChunkL&version=1.2.1
                    
Install as a Cake Addin
#tool nuget:?package=ChunkL&version=1.2.1
                    
Install as a Cake Tool

ChunkL (.NET)

The .NET library parses ChunkL (.chunkl) files into a syntax tree, reports diagnostics, and writes the tree back to ChunkL.

Install

Add the ChunkL NuGet package:

dotnet add package ChunkL

Usage

using System;
using ChunkL;

// Parse a .chunkl file from disk.
var result = ChunkLParser.Parse("CGameCtnBlock.chunkl");

if (!result.Success)
{
    foreach (var diagnostic in result.Diagnostics)
    {
        Console.Error.WriteLine(diagnostic);
    }
    return;
}

var file = result.File!;
Console.WriteLine($"{file.Header.ClassName} ({file.Header.ClassId})");
var source = ChunkLParser.Write(file);

Use ChunkLParser.ParseSource(string) for source text or ChunkLParser.Parse(Stream) for a stream. Check Success and Diagnostics before using File.

The syntax tree includes constructors, properties with ordered accessors, and is patterns. Boolean and and or parse as logical operators and are written as && and ||; pattern operators retain their keyword spelling. The writer preserves declaration order so writing a file does not change inline default initialization order.

Semantic analysis

Use ChunkLParser.Analyze(file) after parsing to resolve shared fields and check local semantic rules:

var analysis = ChunkLParser.Analyze(file);
foreach (var diagnostic in analysis.Diagnostics)
{
    Console.Error.WriteLine(diagnostic);
}

foreach (var field in analysis.Class.InlineDefaults)
{
    Console.WriteLine($"{field.Name}: {ChunkLParser.WriteExpression(field.DefaultValue!)}");
}

Check analysis.Success before using the model. Class.Fields contains one member per name, its resolved storage type, and all declarations with their original wire types. Class.InlineDefaults lists defaults once in source order and omits fields directly assigned by the constructor. ConstructorAssignments lists the subsequent assignments, including assignments to properties. Named archives have their own field scopes. Archives also reports RequiresExternalVersion, including self archives and versions read through a local base archive.

Analysis reports conflicting declarations or defaults, invalid property reads and writes, recursive accessors, incompatible known primitive results, and chunk version blocks without a version source. Parsing and semantic analysis report diagnostics separately so tools can also work with incomplete layouts.

The library provides syntax and initialization metadata. Consumers apply type defaults, evaluate expressions and property accessors, create fresh empty values, and serialize binary data. External type compatibility, constructors, inherited class members, and caller-supplied archive versions require the consuming tool's context. GetDeclarationsInSourceOrder() exposes the order used by the writer and analyzer. TypeReference.ArrayCounts preserves each array dimension's optional count; ArrayDimensions and FixedArrayCount remain available.

Build and test

dotnet build
dotnet test

License

Licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on ChunkL:

Repository Stars
BigBang1112/gbx-net
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.
Version Downloads Last Updated
1.2.1 55 10/4/2026
1.2.0 55 10/2/2026
1.1.0 136 9/28/2026
1.0.0 141 7/7/2026
0.7.6 2,079 12/17/2025
0.7.5 969 5/23/2025
0.7.4 164 5/23/2025
0.7.3 2,074 6/29/2024
0.7.2 659 3/24/2024
0.7.1 334 3/3/2024
0.7.0 253 3/3/2024
0.6.1 293 2/25/2024
0.6.0 250 2/25/2024
0.5.0 292 2/15/2024
0.4.0 251 2/3/2024
0.3.2 305 1/11/2024
0.3.1 248 1/10/2024
0.3.0 235 1/10/2024
0.2.0 268 1/3/2024
0.1.2 279 12/30/2023
Loading failed

- Added dot support for member access
- Removed colon-colon support