Skip to content

SingleFileBundleReader

Namespace: Dotsider.Core.Analysis

Assembly: Dotsider.Core.dll

Reads .NET single-file bundles — detects the bundle signature, parses the manifest header, and extracts individual entries.

public static class SingleFileBundleReader

ObjectSingleFileBundleReader

Detects a single-file bundle and extracts the entry assembly (the app’s own managed code). Uses dotted-name-safe basename matching: for .exe files, strips the extension; for extensionless files, appends .dll to the full filename.

Parameters:

  • bundlePath (String): Path to the potential bundle file.

Returns: Nullable<Byte[], String>>

The entry assembly bytes and name, or null if the file is not a bundle or no entry assembly could be identified.

public static (byte[] Bytes, string Name)? FindEntryAssembly(string bundlePath)

Checks whether the raw bytes contain the .NET single-file bundle signature.

Parameters:

  • data (ReadOnlySpan<Byte>): The raw file bytes.
  • headerOffset (Int64): When this method returns true, contains the byte offset of the bundle header.

Returns: Boolean

true if the signature is found; otherwise false.

public static bool IsBundle(ReadOnlySpan<byte> data, out long headerOffset)

Checks whether the file at filePath is a .NET single-file bundle.

Parameters:

  • filePath (String): Path to the file to inspect.
  • headerOffset (Int64): When this method returns true, contains the byte offset of the bundle header.

Returns: Boolean

true if the file contains the bundle signature; otherwise false.

public static bool IsBundle(string filePath, out long headerOffset)

ReadAssembly(string, BundleManifest, string)

Section titled “ReadAssembly(string, BundleManifest, string)”

Finds and reads an assembly entry by assembly name (without extension).

Parameters:

  • filePath (String): Path to the bundle file.
  • manifest (BundleManifest): The bundle manifest.
  • assemblyName (String): Assembly name without extension (e.g. “System.Runtime”).

Returns: Byte[]

The assembly bytes, or null if not found in the bundle.

public static byte[]? ReadAssembly(string filePath, BundleManifest manifest, string assemblyName)

Reads a specific entry’s raw bytes from the bundle.

Parameters:

Returns: Byte[]

The entry’s bytes, or null if the entry was not found.

public static byte[]? ReadEntry(string filePath, BundleManifest manifest, string entryRelativePath)

Reads the bundle manifest from a stream positioned at the header.

Parameters:

  • stream (Stream): A readable stream positioned at the bundle header offset.

Returns: BundleManifest

The parsed bundle manifest.

public static BundleManifest ReadManifest(Stream stream)

Reads the bundle manifest from the file at filePath.

Parameters:

  • filePath (String): Path to the bundle file.
  • headerOffset (Int64): The byte offset of the bundle header, as returned by Int64%40).

Returns: BundleManifest

The parsed bundle manifest.

public static BundleManifest ReadManifest(string filePath, long headerOffset)