ToInt8() public static méthode

Converts byte array to INT8 (64 bit integer)
public static ToInt8 ( byte value, int startIndex ) : long
value byte
startIndex int
Résultat long
Exemple #1
0
        /// <summary>
        /// Unpack the string 'x' (network order byte format) into object.
        /// </summary>
        public static object Unpack(string x, int n)
        {
            x = Util.StringPad(x, n);

            byte[] b = new byte[n];
            for (int i = 0; i < x.Length; i++)
            {
                b[i] = (byte)x[i];
            }

            if (b.Length == 1)
            {
                return(BStruct.ToInt1(b, 0));
            }
            if (b.Length == 2)
            {
                return(BStruct.ToInt2(b, 0));
            }
            if (b.Length == 4)
            {
                return(BStruct.ToInt4(b, 0));
            }
            if (b.Length == 8)
            {
                return(BStruct.ToInt8(b, 0));
            }
            return(null);
        }
Exemple #2
0
        private static object DecodeInt8(string x, int startIndex, out int endIndex)
        {
            startIndex += 1;
            endIndex    = startIndex + 8;

            return(BStruct.ToInt8(Util.StringBytes(x.Substring(startIndex, 8)), 0));
        }