Exemple #1
0
        public static void DumpAsHex(this bool[] data, Action <string> channel, int rowLength = 16)
        {
            if (data == null)
            {
                throw new NullReferenceException(nameof(data));
            }
            if (channel == null)
            {
                throw new NullReferenceException(nameof(channel));
            }
            WriteHeader(channel);
            var bytes  = new BitArray(data).ToBytes();
            var offset = 0L;

            foreach (var row in bytes.Chunks(rowLength))
            {
                var hex = BitConverter.ToString(row.ToArray()).Replace("-", " ");
                channel($"{offset:x8}\t{hex}");
                offset += rowLength;
            }
        }