diff options
Diffstat (limited to 'src/Godosa.Core/Runs/DigestLine.cs')
| -rw-r--r-- | src/Godosa.Core/Runs/DigestLine.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Godosa.Core/Runs/DigestLine.cs b/src/Godosa.Core/Runs/DigestLine.cs new file mode 100644 index 0000000..bc4519b --- /dev/null +++ b/src/Godosa.Core/Runs/DigestLine.cs @@ -0,0 +1,13 @@ +using System.Globalization; + +namespace Godosa.Core.Runs; + +/// <summary>The shared digest stdout line: <c>digest <frame> <game seconds 0.###> <16 hex></c>.</summary> +public static class DigestLine +{ + public static string Format(long frame, double gameSeconds, ulong hash) => + string.Create(CultureInfo.InvariantCulture, $"digest {frame} {gameSeconds:0.###} {hash:x16}"); + + /// <summary>Every <paramref name="every"/> frames (frame 0 and every ≤ 0 never).</summary> + public static bool Due(long frame, int every) => every > 0 && frame > 0 && frame % every == 0; +} |
