MapWizard.BeatmapParser
1.0.5
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 MapWizard.BeatmapParser --version 1.0.5
NuGet\Install-Package MapWizard.BeatmapParser -Version 1.0.5
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="MapWizard.BeatmapParser" Version="1.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MapWizard.BeatmapParser" Version="1.0.5" />
<PackageReference Include="MapWizard.BeatmapParser" />
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 MapWizard.BeatmapParser --version 1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MapWizard.BeatmapParser, 1.0.5"
#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 MapWizard.BeatmapParser@1.0.5
#: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=MapWizard.BeatmapParser&version=1.0.5
#tool nuget:?package=MapWizard.BeatmapParser&version=1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
BeatmapParser
A lightweight C# library for decoding, editing, and re-encoding osu! .osu beatmap files. It models every major section of the file format so you can inspect or programmatically modify metadata, timing information, events, colours, and hit objects before writing the map back to disk.
Features
- Parses osu! file format versions 14 and 128 into strongly typed section objects (
General,Metadata,Difficulty,TimingPoints,HitObjects, etc.). - Encodes a
Beatmapback to a valid.osudocument viaBeatmap.Encode(). - Section helpers to query timing points, BPM, volume, backgrounds, and specific hit objects.
- Nullability-aware API so optional sections (Editor, Colours, TimingPoints) are easy to detect and guard against.
- Pure library design with no runtime dependencies outside the .NET SDK.
Requirements
- .NET SDK 10.0 (preview) or newer. The project’s
TargetFrameworkisnet10.0; earlier SDKs will fail to restore/build.
Getting Started
Get it from NuGet:
dotnet add package MapWizard.BeatmapParser --version 1.0.0
Usage
Decode an existing beatmap
using System.IO;
using BeatmapParser;
var beatmap = Beatmap.Decode(new FileInfo("/maps/example.osu"));
Console.WriteLine($"Title: {beatmap.MetadataSection.Title}");
Console.WriteLine($"HP: {beatmap.DifficultySection.HPDrainRate}");
Inspect timing and events
var bpm = beatmap.GetBpmAt(45_000);
var volume = beatmap.GetVolumeAt(60_000);
var bg = beatmap.GetBackgroundFilename();
Console.WriteLine($"BPM @45s: {bpm}, Volume @60s: {volume}%, Background: {bg}");
Modify and re-encode
beatmap.GeneralSection.AudioFilename = "remix.mp3";
beatmap.MetadataSection.Version = "Hard";
beatmap.SetBackgroundFileName("cool-bg.jpg");
var newContents = beatmap.Encode();
File.WriteAllText("/maps/example-remix.osu", newContents);
Decoding from raw text
If you already have the .osu contents loaded, call Beatmap.Decode(string beatmapString) instead of the FileInfo overload.
Project Structure
Beatmap.cs– entry point withBeatmap.Decode/Beatmap.Encodeplus convenience helpers.Sections/– strongly typed representations for each numbered section in an osu! file.HitObjects/– models for circles, sliders, spinners, mania holds, and helper classes to work with curve points and samples.TimingPoints/– handling for inherited/uninherited timing points and BPM/volume calculations.Events/&Colours/– storyboard primitives and combo colour definitions.
Development Workflow
dotnet buildcompiles the library.dotnet testruns the unit tests inBeatmapParser.Tests.- Keep changes targeting
.NET 10unless theBeatmapParser.csprojis updated to multi-target.
Contributing
- Fork and branch from
main. - Keep PRs focused; add/adjust section decoders with accompanying unit tests where possible.
- Run
dotnet buildanddotnet testbefore submitting. - Document new public APIs and update this README with additional usage notes if appropriate.
Roadmap & Known Limitations
- Encoding is only guaranteed for format versions 14 and 128.
License
MIT
| 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 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 is compatible. 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.
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
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.