ComponentFactory.Krypton.Ribbon.EncryptedLicenseProvider.FromHex C# (CSharp) Méthode

FromHex() private static méthode

Converts a hexadecimal string into a byte array.
private static FromHex ( string hex ) : byte[]
hex string Te hexadecimal string to convert
Résultat byte[]
        private static byte[] FromHex(string hex)
        {
            string strippedHex = Strip(hex, "\t\r\n -");
            if (strippedHex == null || strippedHex.Length % 2 != 0)
                throw new FormatException("Invalid hexadecimal string");
            byte[] result = new byte[ArraySize(strippedHex.Length / 2)];
            for (int i = 0, j = 0; i < strippedHex.Length; i += 2, j++)
            {
                string s = strippedHex.Substring(i, 2);
                result[j] = byte.Parse(s, NumberStyles.HexNumber);
            }
            return result;
        }