コード例 #1
0
        private static Tuple <char, char> ToHexSymbol(byte value)
        {
            char digit1 = ConversionTool.ToHexSymbol((byte)(value & 0xF));
            char digit2 = ConversionTool.ToHexSymbol((byte)((value >> 4) & 0xF));

            return(new Tuple <char, char>(digit1, digit2));
        }
コード例 #2
0
        public static string ToHexString(this IReadOnlyList <Bit> @this)
        {
            char[] chars = new char[@this.Count / 4 + 2];

            ByteWriter bw = new ByteWriter();

            for (int n = 0; n < @this.Count;)
            {
                for (int j = 0; j < 4; j++)
                {
                    bw.AddBit(@this[n++]);
                }
                chars[chars.Length - n / 4] = ConversionTool.ToHexSymbol(bw.Value);
                bw.Reset();
            }
            chars[0] = '0';
            chars[1] = 'x';
            return(new string(chars));
        }