NdsForge.NET 1.0.1
Read, validate, edit, compare, and build Nintendo DS and DSi images from .NET
Loading...
Searching...
No Matches
NdsForge.NdsImageEditor Class Referencesealed

Collects explicit image changes and saves them without mutating the source. More...

Public Member Functions

NdsImageEditor ReplaceFile (string path, ReadOnlySpan< byte > contents)
 Replaces a named NitroFS file.
NdsImageEditor ReplaceFile (NdsFile file, ReadOnlySpan< byte > contents)
 Replaces a named NitroFS file.
NdsImageEditor ReplaceAllocation (int fileId, ReadOnlySpan< byte > contents)
 Replaces any FAT allocation, including an unnamed overlay payload.
bool Revert (int fileId)
 Removes a pending replacement while leaving the source allocation unchanged.
NdsImageEditor ReplaceBanner (NdsBanner banner)
 Replaces or adds the menu banner.
NdsImageEditor RepairHeaderCrc ()
 Selects only the common header checksum for repair; other damaged checksums remain untouched.
NdsImageEditor RepairNintendoLogoCrc ()
 Selects the dedicated logo checksum and the dependent common header checksum for repair.
NdsImageEditor RepairBannerCrcs ()
 Replaces the current banner with a copy whose version-defined CRC slots are repaired in place.
NdsImageEditor RepairSecureAreaCrc (NdsKey1KeyTable keyTable)
 Selects secure-area CRC repair after the explicit KEY1 table proves whether source bytes are encrypted or reconstructs the encrypted checksum representation from a decrypted dump.
async ValueTask< NdsSaveResult > SaveAsync (string path, NdsWriteOptions? options=null, CancellationToken cancellationToken=default)
 Saves to a new or atomically replaced filesystem path.
async ValueTask< NdsSaveResult > SaveAsync (Stream destination, NdsWriteOptions? options=null, CancellationToken cancellationToken=default)
 Saves to a distinct caller-owned readable, writable, seekable stream.

Properties

NdsHeaderEdit Header [get]
 Gets editable identity and card-control header fields.
IReadOnlyList< NdsFileChange > Changes [get]
 Gets pending changes in ascending FAT file-ID order.
NdsEditPlan Plan [get]
 Snapshots all pending semantic changes and named repairs for review before a destination is opened.

Detailed Description

Collects explicit image changes and saves them without mutating the source.

Definition at line 6 of file NdsImageEditor.cs.

Member Function Documentation

◆ RepairBannerCrcs()

NdsImageEditor NdsForge.NdsImageEditor.RepairBannerCrcs ( )
inline

Replaces the current banner with a copy whose version-defined CRC slots are repaired in place.

Returns
This editor.
Exceptions
InvalidOperationExceptionThe source contains no banner to repair.

Definition at line 112 of file NdsImageEditor.cs.

◆ RepairHeaderCrc()

NdsImageEditor NdsForge.NdsImageEditor.RepairHeaderCrc ( )
inline

Selects only the common header checksum for repair; other damaged checksums remain untouched.

Returns
This editor.

Definition at line 95 of file NdsImageEditor.cs.

◆ RepairNintendoLogoCrc()

NdsImageEditor NdsForge.NdsImageEditor.RepairNintendoLogoCrc ( )
inline

Selects the dedicated logo checksum and the dependent common header checksum for repair.

Returns
This editor.

Definition at line 103 of file NdsImageEditor.cs.

◆ RepairSecureAreaCrc()

NdsImageEditor NdsForge.NdsImageEditor.RepairSecureAreaCrc ( NdsKey1KeyTable keyTable)
inline

Selects secure-area CRC repair after the explicit KEY1 table proves whether source bytes are encrypted or reconstructs the encrypted checksum representation from a decrypted dump.

Parameters
keyTableComplete caller-authorized KEY1 seed schedule.
Returns
This editor.
Exceptions
InvalidOperationExceptionThe interval is absent, malformed, unrecognized, or not checksumable.

Definition at line 128 of file NdsImageEditor.cs.

◆ ReplaceAllocation()

NdsImageEditor NdsForge.NdsImageEditor.ReplaceAllocation ( int fileId,
ReadOnlySpan< byte > contents )
inline

Replaces any FAT allocation, including an unnamed overlay payload.

Parameters
fileIdThe stable FAT file ID.
contentsThe replacement bytes, copied immediately.
Returns
This editor for fluent composition.

Definition at line 66 of file NdsImageEditor.cs.

◆ ReplaceBanner()

NdsImageEditor NdsForge.NdsImageEditor.ReplaceBanner ( NdsBanner banner)
inline

Replaces or adds the menu banner.

Parameters
bannerThe checksummed banner to write.
Returns
This editor.

Definition at line 86 of file NdsImageEditor.cs.

◆ ReplaceFile() [1/2]

NdsImageEditor NdsForge.NdsImageEditor.ReplaceFile ( NdsFile file,
ReadOnlySpan< byte > contents )
inline

Replaces a named NitroFS file.

Parameters
fileA file belonging to the source image.
contentsThe replacement bytes, copied immediately.
Returns
This editor for fluent composition.

Definition at line 50 of file NdsImageEditor.cs.

◆ ReplaceFile() [2/2]

NdsImageEditor NdsForge.NdsImageEditor.ReplaceFile ( string path,
ReadOnlySpan< byte > contents )
inline

Replaces a named NitroFS file.

Parameters
pathThe canonical or root-relative NitroFS path.
contentsThe replacement bytes, copied immediately.
Returns
This editor for fluent composition.

Definition at line 43 of file NdsImageEditor.cs.

◆ Revert()

bool NdsForge.NdsImageEditor.Revert ( int fileId)
inline

Removes a pending replacement while leaving the source allocation unchanged.

Parameters
fileIdThe FAT file ID.
Returns
Whether a pending change was removed.

Definition at line 81 of file NdsImageEditor.cs.

◆ SaveAsync() [1/2]

async ValueTask< NdsSaveResult > NdsForge.NdsImageEditor.SaveAsync ( Stream destination,
NdsWriteOptions? options = null,
CancellationToken cancellationToken = default )
inline

Saves to a distinct caller-owned readable, writable, seekable stream.

Parameters
destinationThe destination stream, which is left open.
optionsOptional save policies.
cancellationTokenA token used to cancel copying or verification.
Returns
A summary of the completed save.

Definition at line 197 of file NdsImageEditor.cs.

◆ SaveAsync() [2/2]

async ValueTask< NdsSaveResult > NdsForge.NdsImageEditor.SaveAsync ( string path,
NdsWriteOptions? options = null,
CancellationToken cancellationToken = default )
inline

Saves to a new or atomically replaced filesystem path.

Parameters
pathThe destination image path.
optionsOptional save policies.
cancellationTokenA token used to cancel copying or verification.
Returns
A summary of the completed save.

Definition at line 147 of file NdsImageEditor.cs.

Property Documentation

◆ Changes

IReadOnlyList<NdsFileChange> NdsForge.NdsImageEditor.Changes
get

Gets pending changes in ascending FAT file-ID order.

Definition at line 31 of file NdsImageEditor.cs.

◆ Header

NdsHeaderEdit NdsForge.NdsImageEditor.Header
get

Gets editable identity and card-control header fields.

Definition at line 28 of file NdsImageEditor.cs.

◆ Plan

NdsEditPlan NdsForge.NdsImageEditor.Plan
get

Snapshots all pending semantic changes and named repairs for review before a destination is opened.

Definition at line 37 of file NdsImageEditor.cs.


The documentation for this class was generated from the following file: