s2protocol.NET 0.6.6

.NET 6.0
NuGet\Install-Package s2protocol.NET -Version 0.6.6
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.
dotnet add package s2protocol.NET --version 0.6.6
<PackageReference Include="s2protocol.NET" Version="0.6.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add s2protocol.NET --version 0.6.6
#r "nuget: s2protocol.NET, 0.6.6"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install s2protocol.NET as a Cake Addin
#addin nuget:?package=s2protocol.NET&version=0.6.6

// Install s2protocol.NET as a Cake Tool
#tool nuget:?package=s2protocol.NET&version=0.6.6

.NET

Introduction

dotnet 6 wrapper for Blizzards s2protocol for decoding/parsing StarCraft II replays (*.SC2Replay) using IronPython (2.7)

Getting started

Prerequisites

dotnet 6

Installation

dotnet add package IronPython.StdLib --version 2.7.12
dotnet add package s2protocol.NET

Usage

public static readonly string? assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
ReplayDecoder decoder = new(assemblyPath);
Sc2Replay? replay = await decoder.DecodeAsync(pathToSC2Replay);
Console.WriteLine(replay.Header.BaseBuild);

Optional options:

ReplayDecoder decoder = new(assemblyPath);

ReplayDecoderOptions options = new ReplayDecoderOptions()
{
    Details = false,
    Metadata = false,
    MessageEvents = false,
    TrackerEvents = true,
    GameEvents = false,
    AttributeEvets = false
};

CancellationTokenSource cts = new();

Sc2Replay? replay = await decoder.DecodeAsync(pathToSC2Replay, options, cts.Token);
Console.WriteLine(replay.TrackerEvents.SUnitBornEvents.FirstOrDefault());

Multiple replays:

ReplayDecoder decoder = new(assemblyPath);
var folder = "path_to_replay_folder";
List<string> replays = Directory.GetFiles(folder, "*.SC2Replay").ToList();
ReplayDecoderOptions options = new ReplayDecoderOptions() { TrackerEvents = false };
int threads = 8;
CancellationTokenSource cts = new();

int i = 0;
await foreach (var sc2rep in decoder.DecodeParallel(replays, threads, options, cts.Token))
{
    i++;
    Console.WriteLine($"{i} {sc2rep.Details.DateTimeUTC}");
}

Known Limitations / ToDo

GameEvents

STriggerSoundLengthSyncEvent ⇒ no data SControlGroupUpdateEvent ⇒ no mask

ChangeLog

<details open="open"><summary>v0.6.6</summary>

  • Call GC.Collect() in dispose to release file locks
  • Disabled default console-logging
  • Added Test for protocol 88500 (5.0.10)

</details>

<details><summary>v0.6.5</summary>

  • Save full path in FileName

</details>

<details><summary>v0.6.4</summary>

  • Patch 5.0.9 - Protocol 87702

</details>

<details><summary>v0.6.3</summary>

  • Python.StdLib to version 2.7.12
  • JsonIgnore on UnitBorn ↔ UnitDied cycles

</details>

<details><summary>v0.6.2</summary>

  • GameEvents
  • AttributeEvents
  • Tracker-Unit-Events mapping (Born → Died ...)
  • Tracker-Unit-Events UnitIndex from protocol.unit_tag(index, recycle)

</details>

<details><summary>v0.6.1</summary>

  • Fixed some types (nullable/BigInteger/long)
  • Initdata is now available
  • Json de-/serialization

</details>

<details><summary>v0.6.0</summary>

  • Init

</details>

Product Versions
.NET net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.6.6 78 7/31/2022
0.6.5 123 4/23/2022
0.6.4 98 3/17/2022
0.6.3 90 2/20/2022
0.6.2 91 2/7/2022
0.6.1 107 2/4/2022
0.6.0 100 2/2/2022