예제 #1
0
파일: MonitorForm.cs 프로젝트: 10usb/common
        private void Append(byte[] buffer, int count)
        {
            string text = Encoding.ASCII.GetString(buffer, 0, count);

            TextView.SelectionStart  = TextView.TextLength;
            TextView.SelectionLength = 0;
            TextView.SelectionColor  = Color.Red;
            TextView.AppendText(text);
            TextView.ScrollToCaret();

            StringBuilder builder = new StringBuilder();

            for (int index = 0; index < count; index++)
            {
                builder.AppendFormat("{0:X2} ", buffer[index]);
            }
            HexView.SelectionStart  = HexView.TextLength;
            HexView.SelectionLength = 0;
            HexView.SelectionColor  = Color.Red;
            HexView.AppendText(builder.ToString());
            HexView.ScrollToCaret();
        }