RstbLibrary 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package RstbLibrary --version 1.0.0                
NuGet\Install-Package RstbLibrary -Version 1.0.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="RstbLibrary" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RstbLibrary --version 1.0.0                
#r "nuget: RstbLibrary, 1.0.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.
// Install RstbLibrary as a Cake Addin
#addin nuget:?package=RstbLibrary&version=1.0.0

// Install RstbLibrary as a Cake Tool
#tool nuget:?package=RstbLibrary&version=1.0.0                

Resource Size Table Library

Simple Resource Size Table (RSTB/RESTBL) IO library written in modern C#

License Downloads

Usage

[!NOTE] Rstb and ImmutableRstb support both RSTB (Fixed) and RESTBL (Dynamic) files.

Read

byte[] data = File.ReadAllBytes("ResourceSizeTable.Product.121.rsizetable");
Rstb rstb = Rstb.FromBinary(data);

Read Immutable (Readonly, but much faster)

byte[] data = File.ReadAllBytes("ResourceSizeTable.Product.121.rsizetable");
RevrsReader reader = new(data);
ImmutableRstb rstb = new(ref reader);

Write

/* ... */

using FileStream fs = File.Create("ResourceSizeTable.Product.121.rsizetable");
rstb.WriteBinary(
    // The stream to write into
    fs,

    // Write in LE (uses source by default)
    endianness: Endianness.Little,

    // Write a dynamic Rstb (RESTBL) instead of Fixed (RSTB)
    version: RstbVersion.Dynamic,

    // Remove any extra entries in the OverflowTable to save space
    optimize: true)

To Binary

/* ... */

byte[] outputData = rstb.ToBinary(
    /*
     *  Takes the same arguments as WriteBinary(stream, ...)
     */
);

Benchmarks

[!NOTE] Rstb methods read/write the BotW RSTB (515 KB) and Restbl methods read/write the TotK RESTBL (2,972 KB).

RSTB

Method Mean Error StdDev Gen0 Gen1 Gen2 Allocated
Read 4.907 ms 0.0245 ms 0.0230 ms 195.3125 164.0625 - 3.01 MB
ReadImmutable 8.743 ns 0.0147 ns 0.0115 ns - - - -
Write 1.814 ms 0.0234 ms 0.0219 ms 130.8594 123.0469 123.0469 3.51 MB

RESTBL

Method Mean Error StdDev Gen0 Gen1 Gen2 Allocated
Read 36.337 ms 0.6874 ms 0.8183 ms 1142.8571 928.5714 - 17.39 MB
ReadImmutable 15.353 ns 0.0409 ns 0.0342 ns - - - -
Write 11.625 ms 0.2173 ms 0.1814 ms 578.1250 578.1250 578.1250 16.7 MB

Install

NuGet NuGet

NuGet
Install-Package RstbLibrary
Build From Source
git clone https://github.com/EPD-Libraries/RstbLibrary.git
dotnet build RstbLibrary
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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

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
1.0.2 705 4/6/2024
1.0.1 130 3/16/2024
1.0.0 295 1/15/2024