mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-02-16 13:14:49 +00:00
Fixed issues with parsing large ushort values
This commit is contained in:
@@ -141,14 +141,11 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
void ProcessUshortPath(ushort index) {
|
void ProcessUshortPath(ushort index) {
|
||||||
string response;
|
string response;
|
||||||
if (Process(UshortPaths[index], out response)) {
|
if (Process(UshortPaths[index], out response)) {
|
||||||
ushort returnVal;
|
ushort val;
|
||||||
short val;
|
try { val = Convert.ToInt32(response) < 0 ? (ushort)(Convert.ToInt16(response) + 65536) : Convert.ToUInt16(response); }
|
||||||
try { val = Convert.ToInt16(response); }
|
|
||||||
catch { val = 0; }
|
catch { val = 0; }
|
||||||
|
|
||||||
returnVal = val < 0 ? (ushort)(val + 65536) : (ushort)val;
|
OnUShortChange(val, index, JsonToSimplConstants.UshortValueChange);
|
||||||
|
|
||||||
OnUShortChange(returnVal, index, JsonToSimplConstants.UshortValueChange);
|
|
||||||
}
|
}
|
||||||
else { }
|
else { }
|
||||||
// OnUShortChange(0, index, JsonToSimplConstants.UshortValueChange);
|
// OnUShortChange(0, index, JsonToSimplConstants.UshortValueChange);
|
||||||
|
|||||||
Reference in New Issue
Block a user