refactor(card): rename TryParseDestructDict to TryParseCardCountDict

This commit is contained in:
gamer147
2026-05-28 00:59:07 -04:00
parent 6e106d646b
commit 0867c5bd05

View File

@@ -28,7 +28,7 @@ public class CardController : SVSimController
{ {
if (!TryGetViewerId(out long viewerId)) return Unauthorized(); if (!TryGetViewerId(out long viewerId)) return Unauthorized();
if (!TryParseDestructDict(request.CardIdNumberArray, out var destructCounts, out var snapshots, out var parseError)) if (!TryParseCardCountDict(request.CardIdNumberArray, out var destructCounts, out var snapshots, out var parseError))
return BadRequest(new { error = parseError }); return BadRequest(new { error = parseError });
if (destructCounts.Count == 0) if (destructCounts.Count == 0)
@@ -83,13 +83,13 @@ public class CardController : SVSimController
/// <c>"&lt;num_to_destruct&gt;,&lt;client_possession_snapshot&gt;"</c> — both strings. /// <c>"&lt;num_to_destruct&gt;,&lt;client_possession_snapshot&gt;"</c> — both strings.
/// Returns false (and sets <paramref name="errorKey"/>) on any structural problem. /// Returns false (and sets <paramref name="errorKey"/>) on any structural problem.
/// </summary> /// </summary>
private static bool TryParseDestructDict( private static bool TryParseCardCountDict(
string raw, string raw,
out Dictionary<long, int> destructCounts, out Dictionary<long, int> counts,
out Dictionary<long, int> clientSnapshots, out Dictionary<long, int> clientSnapshots,
out string errorKey) out string errorKey)
{ {
destructCounts = new(); counts = new();
clientSnapshots = new(); clientSnapshots = new();
errorKey = "malformed_request"; errorKey = "malformed_request";
@@ -120,7 +120,7 @@ public class CardController : SVSimController
if (!int.TryParse(pair[1], out int snapshot) || snapshot < 0) if (!int.TryParse(pair[1], out int snapshot) || snapshot < 0)
return false; return false;
destructCounts[cardId] = num; counts[cardId] = num;
clientSnapshots[cardId] = snapshot; clientSnapshots[cardId] = snapshot;
} }
} }