Chorizite.DatReaderWriter.Extensions
1.0.0
See the version list below for details.
dotnet add package Chorizite.DatReaderWriter.Extensions --version 1.0.0
NuGet\Install-Package Chorizite.DatReaderWriter.Extensions -Version 1.0.0
<PackageReference Include="Chorizite.DatReaderWriter.Extensions" Version="1.0.0" />
<PackageVersion Include="Chorizite.DatReaderWriter.Extensions" Version="1.0.0" />
<PackageReference Include="Chorizite.DatReaderWriter.Extensions" />
paket add Chorizite.DatReaderWriter.Extensions --version 1.0.0
#r "nuget: Chorizite.DatReaderWriter.Extensions, 1.0.0"
#:package Chorizite.DatReaderWriter.Extensions@1.0.0
#addin nuget:?package=Chorizite.DatReaderWriter.Extensions&version=1.0.0
#tool nuget:?package=Chorizite.DatReaderWriter.Extensions&version=1.0.0
DatReaderWriter.Extensions
DatReaderWriter.Extensions
Table of Contents
Features
- Targets
net8.0
Installation
Install the Chorizite.DatReaderWriter.Extensions package from NuGet:
dotnet add package Chorizite.DatReaderWriter.Extensions
DatEasyWriter
Initializing DatEasyWriter
You can initialize DatEasyWriter pointing to a directory containing your portal/cell/local.dat files, or use an existing DatCollection.
using DatReaderWriter.Extensions;
using DatReaderWriter.Options;
// From directory
using var writer = new DatEasyWriter("C:\\Turbine\\Asheron's Call");
// With options (e.g. auto-increment iterations)
var options = new DatEasyWriterOptions { IncreaseIterations = true };
using var writerWithOptions = new DatEasyWriter("C:\\Turbine\\Asheron's Call", options);
Managing Titles
DatEasyWriter provides high-level helpers for managing character titles (adding, updating, removing). These methods handle the underlying EnumMapper and StringTable updates for you.
// Add a new title (Enum ID is auto-generated)
var newTitleIdResult = writer.AddTitle("My Legendary Title");
if (newTitleIdResult.Success) {
Console.WriteLine($"Added title with ID: {newTitleIdResult.Value}");
}
// Add a title with a specific Enum ID
writer.AddTitle("Another Title", "ID_CharacterTitle_AnotherTitle");
// Update a title by ID
writer.UpdateTitle(newTitleIdResult.Value, "My Updated Legendary Title");
// Update a title by string match
writer.UpdateTitle("My Updated Legendary Title", "My Final Title");
// Remove a title by ID
writer.RemoveTitle(newTitleIdResult.Value);
// Remove a title by string
writer.RemoveTitle("My Final Title");
Generic Database Operations
You can easily get and save DBObj files using the generic helpers.
// Get a file (e.g. a LandBlock 0xFFFF0000)
var result = writer.Get<LandBlock>(0xFFFF0000);
if (result.Success) {
var landBlock = result.Value;
// Modify landBlock...
// Save it back. If IncreaseIterations is true, the iteration count will update.
writer.Save(landBlock);
}
Accessing Mappers and String Tables
DatEasyWriter.GetEnumMapper(EnumMapperType): Helper to fetch a specific EnumMapper.DatEasyWriter.GetStringTable(StringTableType): Helper to fetch a specific StringTable.
Extensions
RenderSurface Extensions
Extensions for RenderSurface (textures) to easily replace or export image data.
using DatReaderWriter.Extensions.DBObjs;
// Replace a texture with a PNG/BMP/etc on disk
var renderSurface = writer.Get<RenderSurface>(0x06001234).Value;
// Replace and optionally resize to match original dimensions
renderSurface.ReplaceWith("path/to/new_texture.png", shouldResize: true);
writer.Save(renderSurface);
// Export a texture to a file
renderSurface.SaveToImageFile("path/to/extracted_texture.png", writer);
// Get raw RGBA bytes
byte[] rgbaBytes = renderSurface.ToRgba8(writer);
Other Extensions
DBObj.GetDatFileType(): Returns theDatFileType(Portal, Cell, Local) a genericDBObjbelongs to.string.ComputeHash(): Computes the Asheron's Call specific hash of a string (useful for StringTables).
Contributing
We welcome contributions from the community! If you would like to contribute to DatReaderWriter, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Make your changes.
- Commit your changes (
git commit -am 'Add some feature'). - Push to the branch (
git push origin feature-branch). - Create a new Pull Request.
License
This project is licensed under the MIT License. See the LICENSE.txt file for details.
| Product | Versions 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 was computed. 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. |
-
net8.0
- BCnEncoder.Net (>= 2.2.1)
- BCnEncoder.Net.ImageSharp (>= 1.1.2)
- Chorizite.DatReaderWriter (>= 2.0.0)
- SixLabors.ImageSharp (>= 3.1.12)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
**Full Changelog**: https://github.com/Chorizite/DatReaderWriter.Extensions/commits/release/1.0.0