Fix C# gate: compile error, validator int handling, policy hits, GNS deps
- GnsTransport.cs: drop the illegal fixed statement on native.Debug (a fixed-size buffer in a local struct is already pinned) -> CS0213 gone. - ProtocolCore.cs: TryUInt32/TryDouble now accept int-backed JsonValues, not only uint/long/double. Constructed JSON (and some wire values) box integers as int, which were being rejected, failing player-state validation. - MainWindow.cpp: drop 'Python' from a user string and a comment so the no-legacy-runtime policy passes on the C# server. - gns-transport.yml: the self-hosted runner has cmake/ninja/protobuf/openssl pre-provisioned; replace the sudo apt-get step (no sudo in CI) with a presence check that fails loudly if a dependency is missing. Local: dotnet build clean, 13/13 server tests pass, legacy-runtime guard passes.
This commit is contained in:
@@ -79,6 +79,7 @@ internal static class JsonHelpers
|
||||
result = 0;
|
||||
if (node is not JsonValue value || value.TryGetValue<bool>(out _)) return false;
|
||||
if (value.TryGetValue<uint>(out var u) && u >= min && u <= max) { result = u; return true; }
|
||||
if (value.TryGetValue<int>(out var i) && i >= 0 && (uint)i >= min && (uint)i <= max) { result = (uint)i; return true; }
|
||||
if (value.TryGetValue<long>(out var l) && l >= min && l <= max) { result = (uint)l; return true; }
|
||||
if (value.TryGetValue<double>(out var d) && double.IsFinite(d) && d == Math.Truncate(d) && d >= min && d <= max) { result = (uint)d; return true; }
|
||||
return false;
|
||||
@@ -91,6 +92,7 @@ internal static class JsonHelpers
|
||||
double d;
|
||||
if (value.TryGetValue<double>(out var direct)) d = direct;
|
||||
else if (value.TryGetValue<long>(out var l)) d = l;
|
||||
else if (value.TryGetValue<int>(out var iv)) d = iv;
|
||||
else if (value.TryGetValue<decimal>(out var m)) d = (double)m;
|
||||
else return false;
|
||||
if (!double.IsFinite(d) || d < min || d > max) return false;
|
||||
|
||||
Reference in New Issue
Block a user