feat: align legacy operator and playout behavior

This commit is contained in:
2026-07-15 21:04:05 +09:00
parent 06a16e5741
commit 83398044c6
77 changed files with 6377 additions and 391 deletions

View File

@@ -24,6 +24,13 @@ public sealed record LegacyCutPointerDownIntent(
int Y,
long TimestampMilliseconds) : LegacyUiIntent;
public sealed record LegacyCutKeyDownIntent(
LegacyCutKeyboardKey Key,
bool Control,
bool Shift) : LegacyUiIntent;
public sealed record LegacyClearCutSelectionIntent : LegacyUiIntent;
public sealed record LegacyDropSelectedCutsIntent : LegacyUiIntent;
public sealed record LegacySetPlaylistEnabledIntent(string RowId, bool Enabled)
@@ -37,6 +44,8 @@ public sealed record LegacySelectPlaylistRowIntent(
bool Control,
bool Shift) : LegacyUiIntent;
public sealed record LegacyActivatePlaylistRowIntent(string RowId) : LegacyUiIntent;
public sealed record LegacyMoveSelectedPlaylistRowsIntent(
LegacyPlaylistMoveDirection Direction) : LegacyUiIntent;
@@ -349,10 +358,13 @@ public static class LegacyBridgeProtocol
"search-stocks" => ParseSearch(payload),
"select-stock" => ParseStockSelection(payload),
"cut-pointer-down" => ParseCutPointer(payload),
"cut-key-down" => ParseCutKeyDown(payload),
"clear-cut-selection" => ParseClearCutSelection(payload),
"drop-selected-cuts" => ParseDrop(payload),
"set-playlist-enabled" => ParseEnabled(payload),
"set-all-playlist-enabled" => ParseAllEnabled(payload),
"select-playlist-row" => ParsePlaylistSelection(payload),
"activate-playlist-row" => ParsePlaylistActivation(payload),
"move-selected-playlist-rows" => ParsePlaylistMove(payload),
"reorder-playlist-rows" => ParsePlaylistReorder(payload),
"delete-selected-playlist-rows" => ParseDeleteSelected(payload),
@@ -565,6 +577,7 @@ public static class LegacyBridgeProtocol
row.RowId,
row.IsEnabled,
row.IsSelected,
row.IsActive,
row.MarketText,
row.StockName,
row.GraphicType,
@@ -1020,10 +1033,12 @@ public static class LegacyBridgeProtocol
playout.IsCommandAvailable,
playout.LiveTakeInAllowed,
playout.IsPlayCompletionPending,
playout.IsTakeOutCompletionPending,
playout.OutcomeUnknown,
playout.PreparedCode,
playout.OnAirCode,
playout.CurrentCueIndexZeroBased,
playout.CurrentEntryId,
playout.PageIndexZeroBased,
playout.PageCount,
playout.PageSize,
@@ -1089,7 +1104,12 @@ public static class LegacyBridgeProtocol
"x",
"y",
"timestampMilliseconds") ||
!TryInt32(payload, "physicalIndex", 0, 32, out var physicalIndex) ||
!TryInt32(
payload,
"physicalIndex",
0,
LegacyRuntimeStockCutMenuLoader.MaximumRows - 1,
out var physicalIndex) ||
!TryBoolean(payload, "control", out var control) ||
!TryBoolean(payload, "shift", out var shift) ||
!TryInt32(payload, "x", 0, 16_384, out var x) ||
@@ -1111,6 +1131,33 @@ public static class LegacyBridgeProtocol
private static LegacyUiIntent? ParseDrop(JsonElement payload) =>
HasOnlyProperties(payload) ? new LegacyDropSelectedCutsIntent() : null;
private static LegacyUiIntent? ParseCutKeyDown(JsonElement payload)
{
if (!HasOnlyProperties(payload, "key", "control", "shift") ||
!TryString(payload, "key", 16, out var keyText) ||
!TryBoolean(payload, "control", out var control) ||
!TryBoolean(payload, "shift", out var shift))
{
return null;
}
var key = keyText switch
{
"arrow-up" => LegacyCutKeyboardKey.ArrowUp,
"arrow-down" => LegacyCutKeyboardKey.ArrowDown,
"home" => LegacyCutKeyboardKey.Home,
"end" => LegacyCutKeyboardKey.End,
"space" => LegacyCutKeyboardKey.Space,
_ => (LegacyCutKeyboardKey?)null
};
return key.HasValue
? new LegacyCutKeyDownIntent(key.Value, control, shift)
: null;
}
private static LegacyUiIntent? ParseClearCutSelection(JsonElement payload) =>
HasOnlyProperties(payload) ? new LegacyClearCutSelectionIntent() : null;
private static LegacyUiIntent? ParseEnabled(JsonElement payload)
{
if (!HasOnlyProperties(payload, "rowId", "enabled") ||
@@ -1144,6 +1191,13 @@ public static class LegacyBridgeProtocol
return new LegacySelectPlaylistRowIntent(rowId, control, shift);
}
private static LegacyUiIntent? ParsePlaylistActivation(JsonElement payload) =>
HasOnlyProperties(payload, "rowId") &&
TryString(payload, "rowId", 128, out var rowId) &&
IsSafeIdentifier(rowId)
? new LegacyActivatePlaylistRowIntent(rowId)
: null;
private static LegacyUiIntent? ParsePlaylistMove(JsonElement payload)
{
if (!HasOnlyProperties(payload, "direction") ||