ApplePartitionMapReader 1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package ApplePartitionMapReader --version 1.0.0
NuGet\Install-Package ApplePartitionMapReader -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="ApplePartitionMapReader" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ApplePartitionMapReader" Version="1.0.0" />
<PackageReference Include="ApplePartitionMapReader" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ApplePartitionMapReader --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ApplePartitionMapReader, 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.
#:package ApplePartitionMapReader@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ApplePartitionMapReader&version=1.0.0
#tool nuget:?package=ApplePartitionMapReader&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ApplePartitionMapReader
ApplePartitionMapReader is a lightweight .NET library for reading Apple Partition Maps from classic Macintosh disk images. It provides a simple API to detect partition maps, enumerate partitions, and access partition metadata.
Features
- Detect Apple Partition Maps in disk images
- Enumerate all partitions with detailed metadata
- Access partition properties: name, type, start block, block count, status flags
- Strongly-typed status flags with
ApplePartitionMapStatusenum - High-performance parsing using stack-allocated buffers
Installation
Install from NuGet:
dotnet add package ApplePartitionMapReader
Or reference the project directly:
dotnet add reference ../src/ApplePartitionMapReader.csproj
Quick Start Example
using ApplePartitionMapReader;
// Open a disk image containing an Apple Partition Map
using var stream = File.OpenRead("disk.iso");
// Check if the stream contains an Apple Partition Map
if (ApplePartitionMap.IsApplePartitionMap(stream, 0))
{
var map = new ApplePartitionMap(stream, 0);
// Enumerate all partitions
foreach (var partition in map.Entries)
{
Console.WriteLine($"Name: {partition.Name}");
Console.WriteLine($"Type: {partition.Type}");
Console.WriteLine($"Start: {partition.PartitionStartBlock}");
Console.WriteLine($"Size: {partition.PartitionBlockCount} blocks");
Console.WriteLine($"Status: {partition.StatusFlags}");
Console.WriteLine();
}
// Or access by index
var firstPartition = map[0];
Console.WriteLine($"First partition: {firstPartition.Name}");
}
API Overview
ApplePartitionMap
ApplePartitionMap(Stream stream, int volumeStartOffset): Constructs a partition map reader from a seekable, readable stream at the specified offset.static bool IsApplePartitionMap(Stream stream, int volumeStartOffset): Checks if the stream contains a valid Apple Partition Map at the given offset.IEnumerable<ApplePartitionMapEntry> Entries: Enumerates all partition entries in the map.ApplePartitionMapEntry this[int index]: Gets the partition entry at the specified index.
ApplePartitionMapEntry
Represents a single partition in the map with the following properties:
| Property | Type | Description |
|---|---|---|
Signature |
ushort |
Partition signature (0x504D = 'PM') |
MapEntryCount |
uint |
Total number of entries in the partition map |
Name |
String32 |
Partition name |
Type |
String32 |
Partition type (e.g., Apple_HFS, Apple_Driver) |
PartitionStartBlock |
uint |
First block of the partition |
PartitionBlockCount |
uint |
Number of blocks in the partition |
DataStartBlock |
uint |
First logical block of data area |
DataBlockCount |
uint |
Number of blocks in data area |
StatusFlags |
ApplePartitionMapStatus |
Partition status flags |
BootCodeStartBlock |
uint |
First logical block of boot code |
BootCodeBlockCount |
uint |
Size of boot code in bytes |
BootCodeAddress |
uint |
Boot code load address |
BootCodeEntryPoint |
uint |
Boot code entry point |
BootCodeChecksum |
uint |
Boot code checksum |
ProcessorType |
String16 |
Processor type (e.g., "68000") |
ApplePartitionMapStatus
Flags enum representing partition status:
| Flag | Value | Description |
|---|---|---|
Valid |
0x00000001 | Entry is valid |
Allocated |
0x00000002 | Entry is allocated |
InUse |
0x00000004 | Entry in use |
Bootable |
0x00000008 | Contains boot information |
Readable |
0x00000010 | Partition is readable |
Writable |
0x00000020 | Partition is writable |
BootCodePositionIndependent |
0x00000040 | Boot code is position independent |
OSSpecific1 |
0x00000080 | OS-specific flag |
ChainCompatibleDriver |
0x00000100 | Contains chain-compatible driver |
RealDriver |
0x00000200 | Contains a real driver |
ChainDriver |
0x00000400 | Contains a chain driver |
AutoMount |
0x40000000 | Automatically mount at startup |
StartupPartition |
0x80000000 | The startup partition |
Common Partition Types
| Type | Description |
|---|---|
Apple_partition_map |
The partition map itself |
Apple_Driver |
Device driver partition |
Apple_Driver43 |
SCSI driver partition |
Apple_HFS |
HFS filesystem partition |
Apple_Free |
Free/unused space |
Apple_Scratch |
Scratch partition |
License
MIT License - see LICENSE for details.
Related Projects
- AppleDiskImageReader - Reader for Apple II universal disk (.2mg) images
- AppleIIDiskReader - Reader for Apple II DOS 3.3 disk (.dsk) images
- ProDosVolumeReader - Reader for ProDOS (.po) volumes
- WozDiskImageReader - Reader for WOZ (.woz) disk images
- DiskCopyReader - Reader for Disk Copy 4.2 (.dc42) images
- MfsReader - Reader for MFS (Macintosh File System) volumes
- HfsReader - Reader for HFS (Hierarchical File System) volumes
- ResourceForkReader - Reader for Macintosh resource forks
- BinaryIIReader - Reader for Binary II (.bny, .bxy) archives
- StuffItReader - Reader for StuffIt (.sit) archives
- ShrinkItReader - Reader for ShrinkIt (.shk, .sdk) archives
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.