Nodsoft.WowsReplaysUnpack 3.0.22-beta

This is a prerelease version of Nodsoft.WowsReplaysUnpack.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Nodsoft.WowsReplaysUnpack --version 3.0.22-beta
                    
NuGet\Install-Package Nodsoft.WowsReplaysUnpack -Version 3.0.22-beta
                    
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="Nodsoft.WowsReplaysUnpack" Version="3.0.22-beta" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nodsoft.WowsReplaysUnpack" Version="3.0.22-beta" />
                    
Directory.Packages.props
<PackageReference Include="Nodsoft.WowsReplaysUnpack" />
                    
Project file
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 Nodsoft.WowsReplaysUnpack --version 3.0.22-beta
                    
#r "nuget: Nodsoft.WowsReplaysUnpack, 3.0.22-beta"
                    
#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 Nodsoft.WowsReplaysUnpack@3.0.22-beta
                    
#: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=Nodsoft.WowsReplaysUnpack&version=3.0.22-beta&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Nodsoft.WowsReplaysUnpack&version=3.0.22-beta&prerelease
                    
Install as a Cake Tool

<img align="right" src="logo.png" alt="logo" width="200"/>

WoWS-ReplaysUnpack

A C# file unpacking library for World of Warships Replays, inspired by Monstrofil's replays_unpack.

Information before using the library

The library supports only World of Warships replays starting with version 0.10.10. Trying to use an older replay can result in unexpected errors when processing the replay.

How to install

Install NuGet

Then, install from the package manager console:

PM> Install-Package Nodsoft.WowsReplaysUnpack

Or from the .NET CLI as:

dotnet add package Nodsoft.WowsReplaysUnpack

How to use

Add the service to an IServiceCollection

services.AddWowsReplayUnpacker();

Get the factory, get the unpacker from the factory and call the Unpack method with either a Stream or byte[]

ReplayUnpackerFactory replayUnpackerFactory = serviceProvider.GetService<IReplayUnpackerFactory>();
UnpackedReplay unpackedReplay = replayUnpackerFactory
	.GetUnpacker()
	.Unpack(File.OpenRead("my-replay.wowsreplay"));

Custom Implementations

You can provide custom implementations of certain services.

services.Snippet.AddWowsReplayUnpacker(builder =>
{
	builder.AddReplayController<MyCustomReplayController, MyCustomReplay>();
	builder.WithReplayDataParser<MyCustomReplayDataParser>();
	builder.WithDefinitionLoader<MyCustomDefinitionLoader>();
	builder.WithDefinitionStore<MyCustomDefinitionStore>();
})

DefinitionStore

Responsible for managing, giving access and caching the .def files (used for type and property mapping). Uses the IDefinitionLoader for resolving non-cached files once.

Your custom definition store has to implement IDefinitionStore or extend DefaultDefinitionStore

DefinitionLoader

Responsible for loading the actual definition files.

Your custom definition store has to implement IDefinitionLoader. The default loader is the AssemblyDefinitionLoader.

You can optionally use the FileSystemDefinitionLoader by installing the Nodsoft.WowsReplaysUnpack.FileStore nuget package.

ReplayDataParser

Responsible for parsing the binary packets to the specific network packets.

Your custom replay data parser has to implement IReplayDataParser or extend DefaultReplayParser

ReplayController

Responsible for handling parsed network packets and filling the UnpackedReplay with information.

Your custom replay controller has to implement IReplayController<T> but it is strongly suggested to use ReplayControllerBase<T> where T is your custom replay class. Only one controller can be registered for any replay type.

An example of this is the ExtendedDataController.

To use your custom controller add the replay type to the GetUnpacker() method.

UnpackedReplay unpackedReplay = replayUnpackerFactory
	.GetUnpacker<MyCustomReplay>()
	.Unpack(File.OpenRead("my-replay.wowsreplay"));

CVE Check Only Implementation

In the library you get a custom implementation ready to use for when you only want to check the CVE . CveCheckOnlyController

It skips all network packets except the affected ones.

You can add it with the AddCveCheckController() method and get the unpacker with GetCveCheckUnpacker()

Extend the replay data

When implementing your own controller and extending ReplayControllerBase<T>; The replay class has to extend UnpackedReplay. That way you can add extra properties.

You can see this in action here

Method/Property Subscriptions

When implementing your own controller and extending ReplayControllerBase<T> you can subscribe to EntityMethods and EntityProperty calls by adding a method with an attribute.

You will have to install the Nodsoft.WowsReplaysUnpack.Generators nuget package and add the [ReplayController] attribute to your controller class. This will generate the required logic to make the dynamic subscriptions work.

Methods

MethodSubscription("EntityName", "MethodName")

You have a few extra properties on the attribute to configure how the method will be called: bool IncludeEntity ⇒ When true it will include the Entity entity parameter

bool IncludePacketTime ⇒ When true it will include the float packetTime parameter

bool ParamsAsDictionary ⇒ When true the last paremeter will be Dictionary<string, object?> arguments / When false the parameters have to match the actual packet parameters in order and type exactly. When they don't match you will get an exception telling you the required parameters.

bool Priority ⇒ Defines the order in which methods are called when you have multiple subscriptions on the same method. Smaller = Earlier. Don't use -1.

Example:

[MethodSubscription("Avatar", "onArenaStateReceived")]
public void OnArenaStateReceived(Entity entity, float packetTime, ...)
{
}
Properties

PropertySubscription("EntityName", "PropertyName")

There are no extra properties available and the Entity entity parameter is always there.

Example:

[PropertySubscription("Avatar", "selectedWeapon")]
public void SelectedWeaponChanged(Entity entity, uint selectedWeaponId)
{
}

ExtendedData Library

You can install the Nodsoft.WowsReplaysUnpack.ExtendedData package from nuget to get a ready to use implementation that fills the replay with more information than the default controller.

Currently included in the ExtendedDataReplay:

  • Player Information
  • Chat Messages

How to use

services.AddWowsReplayUnpacker(builder =>
{
	builder.AddExtendedData();
});

ExtendedDataReplay unpackedReplay = replayUnpackerFactory
	.GetExtendedDataUnpacker()
	.Unpack(File.OpenRead("my-replay.wowsreplay"));

Additional Entities

The replay contains a multitude of other entities. If you want to retreive those you have two convenient options we provide.

Option 1 - Extension Methods

// Step 1 - Retreive the entity properties you're interested in
var battleLogicProperties = replay.Entities.Single(e => e.Value.Name == "BattleLogic").Value.Properties;
// Step 2 - Use extension methods to cast the properties to their actual type
battleLogicProperties.GetAsDict("propertyName");
battleLogicProperties.GetAsArr("propertyName");
battleLogicProperties.GetAsValue<short>("propertyName");

An example of this can be seen here in the ManualExtensions method.

Option 2 - Strong Type Serializing

Requires the Nodsoft.WowsReplaysUnpack.Generators nuget package.

// Step 1 - Create a class representing the entity annotated with the SerializableEntity attribute
[SerializableEntity]
public class BattleLogic {
  [DataMember(Name = "state")]
  public State State { get; set; } = null!;
    
    ...
}

// Step 2 - Use extension method on the replay to deserialize the entity
var battleLogic = replay.DeserializeEntity<BattleLogic>("BattleLogic");

For collections only List<T> is currently supported.

The property mapping is case-sensitive. So you either have to name your properties exactly like they are in the entities properties dictionary or use the DataMember attribute.

An example of this can be seen here in the Serializer method.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Nodsoft.WowsReplaysUnpack:

Package Downloads
Nodsoft.WowsReplaysUnpack.ExtendedData

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.36-beta 109 4/7/2026
3.0.35-beta 113 3/12/2026
3.0.34-beta 123 2/13/2026
3.0.33-beta 122 1/15/2026
3.0.32-beta 221 11/27/2025
3.0.31-beta 237 10/30/2025
3.0.30-beta 239 10/2/2025
3.0.29-beta 233 9/4/2025
3.0.28-beta 239 8/21/2025
3.0.27-beta 304 8/7/2025
3.0.26-beta 217 7/10/2025
3.0.25-beta 376 6/12/2025
3.0.24-beta 334 5/15/2025
3.0.23-beta 251 4/3/2025
3.0.22-beta 294 3/6/2025
3.0.21-beta 216 2/6/2025
3.0.20-beta 176 1/9/2025
3.0.19-beta-g9da5bf005d 181 12/26/2024
3.0.19-beta 173 12/26/2024
2.0.14 273 11/28/2024
Loading failed