refactor(card): rename TryParseDestructDict to TryParseCardCountDict
This commit is contained in:
@@ -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>"<num_to_destruct>,<client_possession_snapshot>"</c> — both strings.
|
/// <c>"<num_to_destruct>,<client_possession_snapshot>"</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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user