Details about the application:
- Developed under Visual Studio 2019 (Windows 10)
- Designed on
UWP
platform withC#
&XAML
language
My application receive a frame from a remote server. After receiving the frame, I decode all received information, it's here that I have a problem.
Data received (hexa) : CA0000000100000030000000010000003137322E31362E3233392E343100000000000000000000000000000000000000
Code:
int _IndexLecture = 0;
bool _PRIORITE;
string _ABONNE;
_TraitementString = _Decode.Substring(_IndexLecture + 8, 2);
_VOIE = Convert.ToSByte(_TraitementString, 16);
_TraitementString = _Decode.Substring(_IndexLecture + 24, 2);
_PRIORITE = Convert.ToBoolean(_TraitementString);
_TraitementString = _Decode.Substring(_IndexLecture + 32, 64);
_ABONNE = Convert.ToString(_TraitementString);
Obtained result :
_VOIE = 1
_PRIORITE =
_ABONNE =
Exepected result :
_VOIE = 1
_PRIORITE = TRUE
_ABONNE = "172.16.239.41"
How can I pass my hex string
to bool
and ASCII string
to find the right values?