Click or drag to resize

NiceFormatterPrintBuffer Method

Prints a byte array buffer in a traditional format with lines of hex on the left and characters on the right.

Namespace: Orthogonal.Common.Basic
Assembly: Orthogonal.Common.Basic (in Orthogonal.Common.Basic.dll) Version: 3.2.5
Syntax
C#
public static IEnumerable<string> PrintBuffer(
	byte[] buffer,
	int maxLines = 20,
	int width = 32,
	char nonprintReplace = '.'
)

Parameters

buffer  Byte
The byte array buffer to print.
maxLines  Int32  (Optional)
The maximum number of full formatted lines to print. If the number of lines to be printed would exceed this value, then middle lines are truncated. If the value is less than 2 then it's set to 2. The default value is 20 to print a maximum of 10 leading and 10 trailing lines of the data. Note that any partial line at the end is always displayed.
width  Int32  (Optional)
The width in bytes of one formatted line. If the value is outside the range 8 to 128 then it's set to the default value of 32.
nonprintReplace  Char  (Optional)
The character to display in place of unprintable characters. The default is a full-stop.

Return Value

IEnumerableString
An enumerable set of lines of the printed byte buffer.
Example

Example output using maxLines = 6.

            000000 07020000002400005253413200040000010001002BE7AF93DD66D1EEBEF66DDE │.....$..RSA2........+....f....m.│
            000020 EE6C42906BED6CA55A38E0D4AF81E0B680D19C49F0B94FD3E2F8DAC4DE6AE68C │.lB.k.l.Z8.........I..O......j..│
            000040 04E604897EDB65B418A428D3986EF0ECD222E1CEF437F3CE1FD82EAC5C23DF9C │....~.e...(..n..."...7......\#..│
            :::::: (skip 12 lines)
            0001E0 41782DDE040EFD0FAA80CFAC28514CB475137E637A92FB290EE4684E7F3CAA42 │Ax-.........(QL.u.~cz..)..hN.<.B│
            000200 0BEDD828EC54573E6C06061669F77D7AD12D53A81837FABDABCE98AC55E39D25 │...(.TW>l...i.}z.-S..7......U..%│
            000220 465252E19E6C7B3364C5AC75F6DDA7DEC571A85DBF25876C25039FB4D6912A1A │FRR..l{3d..u.....q.].%.l%.....*.│
            000240 1B9C714BDF8D81BC62221A152C8D5A1046E62A52                         │..qK....b"..,.Z.F.*R            │
            
See Also