Hsu.Formats.Replay
2026.7.13
dotnet add package Hsu.Formats.Replay --version 2026.7.13
NuGet\Install-Package Hsu.Formats.Replay -Version 2026.7.13
<PackageReference Include="Hsu.Formats.Replay" Version="2026.7.13" />
<PackageVersion Include="Hsu.Formats.Replay" Version="2026.7.13" />
<PackageReference Include="Hsu.Formats.Replay" />
paket add Hsu.Formats.Replay --version 2026.7.13
#r "nuget: Hsu.Formats.Replay, 2026.7.13"
#:package Hsu.Formats.Replay@2026.7.13
#addin nuget:?package=Hsu.Formats.Replay&version=2026.7.13
#tool nuget:?package=Hsu.Formats.Replay&version=2026.7.13
Hsu.Formats.Replay
Replay engine for the Hsu.Formats toolkit. It schedules recorded CAN trace logs (ASC, BLF, TRC, MDF, KME), mixed CAN + Ethernet trace logs (ASC, BLF), and pure Ethernet captures (PCAP, PCAPNG), then emits replay items over an Ethernet network transport (UDP in the current release).
This library does not capture or record — it replays recordings produced by the
Hsu.Formats.Trace parsers.
Pipeline
file ─▶ streaming parser ─▶ ReplayPlanBuilder ─▶ ReplayPlan
│
ReplaySession (timing/speed/loop/pause/max-idle-gap)
▼
IReplayTransport / UdpReplayTransport / UdpDuplexTransport
Supported parser categories consumed by ReplayPlanBuilder:
IAsyncStreamingEventParser— mixed CAN + Ethernet trace logsIAsyncStreamingTraceParser— frame-oriented CAN trace logsIAsyncStreamingEthernetParser— Ethernet packet captures
Key Types
| Type | Role |
|---|---|
ReplayPlanBuilder |
Parses a recording into time-ordered replay items |
ReplayPlan / ReplayItem |
Immutable replay schedule and payload units |
ReplaySession |
Time-accurate scheduler with Speed, Loop, Pause(), Resume(), and MaxIdleGap |
IReplayTransport |
Output abstraction |
UdpReplayTransport |
One-way UDP transport |
UdpDuplexTransport |
UDP request/response transport for compare workflows |
TcpReplayTransport |
One-way TCP transport |
TcpDuplexTransport |
TCP request/response transport for compare workflows |
IFrameEncapsulator<T> |
Payload mapping strategy (CanOverEthernetEncapsulator, EthernetOverUdpEncapsulator) |
ReplayComparator |
Incremental expected-vs-live response matcher |
Features
- Replays CAN trace recordings and Ethernet captures over UDP transports
- Preserves original inter-item timing with optional speed scaling
- Optional looping playback
- Pause/resume support without counting paused wall-clock time against playback timing
- Optional
MaxIdleGapcompression for long silences in the source recording - Progress notifications after each item is sent
- Duplex-response comparison support for replay/response workflows
- Distinguishes CAN and Ethernet replay payloads on wire through a shared replay protocol prefix and typed payload kind
- Supports both desktop UI and command-line execution paths on the desktop host
Quick Start
Replay an ASC trace
using Hsu.Formats.Asc;
using Hsu.Formats.Replay;
var parser = new AscParser();
var plan = await ReplayPlanBuilder.BuildAsync(
parser,
() => File.OpenRead("log.asc"));
using var transport = new UdpReplayTransport(new ReplayTarget("127.0.0.1", 5005));
using var session = new ReplaySession(plan, transport) { Speed = 1.0, Loop = false };
session.Progress += (_, e) => Console.WriteLine($"{e.SentCount}/{e.TotalCount}");
await session.RunAsync();
Replay an Ethernet capture
using Hsu.Formats.Pcapng;
using Hsu.Formats.Replay;
var parser = new PcapngParser();
var plan = await ReplayPlanBuilder.BuildAsync(
parser,
() => File.OpenRead("capture.pcapng"));
using var transport = new UdpReplayTransport(new ReplayTarget("239.1.2.3", 5005));
using var session = new ReplaySession(plan, transport)
{
Speed = 1.0,
Loop = false,
};
await session.RunAsync();
Replay from the CLI
ReplayTool cli --input capture.pcapng --host 127.0.0.1 --port 5005 --mode unicast
ReplayTool cli --input trace.asc --host 127.0.0.1 --port 5005 --compare --echo --builtin-responder
Timing Behavior
ReplaySession computes deterministic cumulative offsets from the source timestamps and uses
one Stopwatch baseline for the active run.
Important behaviors:
Speed < 1.0slows replay downSpeed > 1.0speeds replay upPause()/Resume()stop and restart the timing clockMaxIdleGapcompresses long quiet periods without changing relative orderingLoop = truerestarts the plan after the last item
Comparison / Duplex Workflows
The replay subsystem also supports expected-vs-live response comparison.
Key pieces:
ReplayComparatorIResponseDecoderIResponseCorrelatorCompareOptionsUdpDuplexTransportTcpDuplexTransport
Typical workflow:
- build a replay plan from the recorded source
- capture expected response units from the recording
- replay over a duplex transport
- feed live responses into
ReplayComparator - build a
ReplayComparisonReport
Encapsulation Model
Replay payload generation depends on the source event type:
- CAN trace frames are encapsulated through
CanOverEthernetEncapsulator - Ethernet capture packets are encapsulated through
EthernetOverUdpEncapsulator - both payload families share the same replay protocol prefix and carry a typed message kind
- CAN and Ethernet keep type-specific payload layouts while still belonging to one replay payload protocol family
- mixed ASC/BLF event streams can produce both kinds of replay items in timestamp order
Documentation
- Replay subsystem architecture and Ethernet capture design notes are documented in the project repository.
- Standard format specifications, when present, are documented in the project repository.
Related Tests
Additional replay examples and validation scenarios are available in the project test suite.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Hsu.Formats.Abstractions (>= 2026.7.13)
- Hsu.Formats.Trace (>= 2026.7.13)
- Microsoft.Bcl.AsyncInterfaces (>= 8.0.0)
-
net8.0
- Hsu.Formats.Abstractions (>= 2026.7.13)
- Hsu.Formats.Trace (>= 2026.7.13)
- Microsoft.Bcl.AsyncInterfaces (>= 8.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 |
|---|---|---|
| 2026.7.13 | 113 | 7/13/2026 |