ThemModdingHerds.TFHRES 1.3.4

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

// Install ThemModdingHerds.TFHRES as a Cake Tool
#tool nuget:?package=ThemModdingHerds.TFHRES&version=1.3.4                

Them's Fightin' Herds Resource reader/writer

A library for reading/writing .tfhres files from Them's Fightin' Herds

Usage

Getting items

using ThemModdingHerds.Resource;
using ThemModdingHerds.Resource.Data;

Database database = Database.Open(pathToTfhresFile);

// get all CachedImage records
List<CachedImage> images = database.ReadCachedImage();
// read the 20th CachedImage (might return null if the item does not exist)
CacheImage? image = database.ReadCachedImage(20);

Updating items

using ThemModdingHerds.Resource;
using ThemModdingHerds.Resource.Data;

Database database = Database.Open(pathToTfhresFile);

// imagine we got this CachedImage "image" from "database.ReadCachedImage(long)" and it's not null

image.Height = 100; // Change property

database.Update(image); // update one item
database.Update(images); // update a list of items (images is a IEnumable)
database.Upsert(image); // updates if item with same id exists otherwise adds the item

Adding new item(s)

using ThemModdingHerds.Resource;
using ThemModdingHerds.Resource.Data;

Database database = Database.Open(pathToTfhresFile);

// the HiberliteId property isn't required
CachedTextfile textfile = new()
{
    Shortname = "deez nuts",
    SourceFile = "very/cool/path",
    TextData = Encoding.UTF8.GetBytes("hah, gottem")
};

// add item to databse. this also be a list of the same item type
database.Insert(textfile);

Merge Databases

Database result = database.Merge(otherDatabase); // keep in mind it returns a new database, it does not modify the variable
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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.