A 24 hex byte message entries: xx xx xx xx xx xx xx xx xx xx xx xx
I have a 24 hex byte message entry into a textbox with different byte segment entry requirements, how to code dynamically the range of hex value I require for each segment e.g. 1byte, 4, 5byte or any byte requirement?
I tried the code below but is not what I wanted as it converts whole hex entry into int equivalent without giving me the freedom to code the range I wanted.
outputTxt.Text = String.Join(" ",
hexTextBox.Text.Trim().Split(' ').Select(item => Convert.ToInt32(item, 16)));
For example, the first group of 2 hex value entered into the textbox, a function to check hex value entered is between 0 to 100 in uint before converting it into its decimal equivalent onto the output textbox, else it will display 'Error' display on the output textbox.
Subsequently the next 4 bytes case, I only allow 4 bytes of hex entries in the range between -1000 to 1000 in int then it can convert to decimal equivalent, else display 'error' message. As for 5 bytes: where each 1 byte is representative to a ASCII characters with range of 0 to 255. How to code these different cases? Thanks!