s2protocol.NET
0.6.12
See the version list below for details.
dotnet add package s2protocol.NET --version 0.6.12
NuGet\Install-Package s2protocol.NET -Version 0.6.12
<PackageReference Include="s2protocol.NET" Version="0.6.12" />
paket add s2protocol.NET --version 0.6.12
#r "nuget: s2protocol.NET, 0.6.12"
// Install s2protocol.NET as a Cake Addin #addin nuget:?package=s2protocol.NET&version=0.6.12 // Install s2protocol.NET as a Cake Tool #tool nuget:?package=s2protocol.NET&version=0.6.12
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
IronPyhton has a known memory leak Issue - try initializing the ReplayDecoder just once and reusing it.
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,
AttributeEvents = 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 decoded = 0;
int errors = 0;
await foreach (DecodeParallelResult decodeResult in decoder.DecodeParallelWithErrorReport(replays, 2, options, cts.Token))
{
if (decodeResult.Sc2Replay == null)
{
Console.WriteLine($"failed decoding replay {decodeResult.ReplayPath}: {decodeResult.Exception}");
errors++;
}
else
{
Console.WriteLine($"{decoded} {decodeResult.Sc2Replay.Details?.DateTimeUTC}");
decoded++;
}
}
Known Limitations / ToDo
GameEvents
STriggerSoundLengthSyncEvent ⇒ no data SControlGroupUpdateEvent ⇒ no mask
ChangeLog
<details open="open"><summary>v0.6.12</summary>
- Protocol 91115
</details>
<details><summary>v0.6.11</summary>
- Protocol 90136
</details>
<details><summary>v0.6.10</summary>
- Protocol 89720
</details>
<details><summary>v0.6.9</summary>
- Protocol 89634
- Fix Gametime to UTC
</details>
<details><summary>v0.6.8</summary>
- Catch UnitIndex BigInteger
- New parallel decoding with ErrorReport: decoder.DecodeParallelWithErrorReport
- Parallel decoding tests
</details>
<details><summary>v0.6.7</summary>
- Catch Currupted Trackerevents
- Protocoll 88500 fix
</details>
<details><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 Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net6.0
- IronPython (>= 2.7.12)
- IronPython.StdLib (>= 2.7.12)
- Microsoft.Extensions.Logging (>= 6.0.0)
- Microsoft.Extensions.Logging.Console (>= 6.0.0)
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.8.2 | 119 | 7/17/2024 |
0.8.1 | 154 | 4/3/2024 |
0.8.0 | 125 | 4/2/2024 |
0.8.0-rc1.0 | 189 | 11/1/2023 |
0.6.12 | 515 | 10/4/2023 |
0.6.11 | 687 | 4/24/2023 |
0.6.10 | 780 | 2/1/2023 |
0.6.9 | 832 | 1/24/2023 |
0.6.8 | 865 | 11/3/2022 |
0.6.7 | 833 | 10/27/2022 |
0.6.6 | 891 | 7/31/2022 |
0.6.5 | 951 | 4/23/2022 |
0.6.4 | 941 | 3/17/2022 |
0.6.3 | 900 | 2/20/2022 |
0.6.2 | 964 | 2/7/2022 |
0.6.1 | 950 | 2/4/2022 |
0.6.0 | 909 | 2/2/2022 |