Linear 0.5.0

dotnet add package Linear --version 0.5.0
                    
NuGet\Install-Package Linear -Version 0.5.0
                    
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="Linear" Version="0.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Linear" Version="0.5.0" />
                    
Directory.Packages.props
<PackageReference Include="Linear" />
                    
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 Linear --version 0.5.0
                    
#r "nuget: Linear, 0.5.0"
                    
#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 Linear@0.5.0
                    
#: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=Linear&version=0.5.0
                    
Install as a Cake Addin
#tool nuget:?package=Linear&version=0.5.0
                    
Install as a Cake Tool

Linear

NuGet .NET Core

Linear file structure ingest library

This library uses structure specification files to read structured data from files.

The command-line program lyn provides a simple means for using a structure file to lay out an input file and dump its outputs.

Installation: dotnet tool install -g lyn

Usage: lyn export <structureFile> <inputFile> <outputDir> LinearParser.g4 For structure file examples, see the sample folder. Also check the parser grammar file which has comments for significant elements.

ANTLR4 generates the structure file parser.

Writing structure files

Example
// Structure files follow a simple format.
// For lyn command-line programs, a 'main' struct is needed.
main {
    // '`' means deserialize. Type is taken from type marker intb.
    intb numEntries `0x4;

    // Plain array of 'file' objects starting at 0x10, numEntries elements.
    file[numEntries] entries 0x10;
}

// Structure named 'file' with raw size 0x8 (used in plain arrays)
file 0x8 {
    // Can use explicit deserializer name to get
    // data with 'intb' deserializer at offset 0.
    var offsetChunk intb`0;

    intb length `0x4;

    // Variable depending on offsetChunk.
    int offset (offsetChunk * 0x800);

    // Call registered function 'log' with another call to 'format' (uses string.Format).
    // $i is a replacement for the array index.
    $call log(format("Entry {0} offset {1} length {2}", $i, offset, length));

    // Export content using the 'data' (direct) exporter.
    // Format name (again using string.Format).
    // $a is a replacement for the absolute position of the structure in the stream.
    $output data [offset - $a, length] format("{0:D6}.dat", $i);
}
Ranges

Some deserializers like string and string16 need a range instead of an offset.

These ranges are expressed as [<sourceOffset>..<endOffsetExclusive>] and [<sourceOffset>, <length>]

Standard deserializers
Type Description
buf Byte buffer
byte 8-bit unsigned integer
ushort 16-bit unsigned integer (LE)
uint 32-bit unsigned integer (LE)
ulong 64-bit unsigned integer (LE
sbyte 8-bit signed integer
short 16-bit signed integer (LE)
int 32-bit signed integer (LE)
long 64-bit signed integer (LE)
byteb 8-bit unsigned integer (BE)
ushortb 16-bit unsigned integer (BE)
uintb 32-bit unsigned integer (BE)
ulongb 64-bit unsigned integer (BE)
sbyteb 8-bit signed integer (BE)
shortb 16-bit signed integer (BE)
intb 32-bit signed integer (BE)
longb 64-bit signed integer (BE)
float 32-bit floating point
double 64-bit floating point
string UTF-8 string
cstring Null-terminated UTF-8 string
string16 UTF-16 string
cstring16 Null-terminated UTF-16 string
Standard methods
Method Description
void log(string message) Prints message
string format(string format, params object[] formatArgs) Gets formatted output
buf and(buf source, lambda l) (1) Applies AND
buf and(buf source, byte key) (1) Applies AND
buf or(buf source, lambda l) (1) Applies OR
buf or(buf source, byte key) (1) Applies OR
buf xor(buf source, lambda l) (1) Applies XOR
buf xor(buf source, byte key) (1) Applies XOR

(1) Available replacements: $$i index, $$v value

Standard replacements
  • $length
    • Length of array element (only available in plain arrays or extended pointer arrays)
  • $a
    • Absolute offset of structure in stream
  • $i
    • Index of array element (only available in array context)
  • $p / $parent
    • Parent structure (for referencing parent members with '.')
  • $u / $unique
    • Unique integer (sequential, for generating output IDs)
Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.5.0 50 2/6/2026
0.4.0 49 2/6/2026
0.3.0 10,058 11/12/2020
0.2.3 588 7/18/2020
0.2.2 626 7/17/2020
0.2.1 636 7/17/2020
0.2.0 585 7/17/2020
0.1.0 580 7/16/2020