StrToByteArray had unsafe, unchecked case in which str in not in a number format.
Passing non-numerical string to byte.Parse makes it throw the "System.FormatException: Input string was not in a correct format." exception.
Added new condition, to check if the string passed to this function is numeric, in order to prevent unhandled exception problem.