Skip to content

KgpTestHelper

Namespace: Hex1b

Assembly: Hex1b.dll

Helper for constructing KGP escape sequences in tests.

csharp
public static class KgpTestHelper

Inheritance

ObjectKgpTestHelper

Methods

BuildChunkedTransmitCommands(uint, uint, uint, int, KgpFormat, byte)

Builds chunked KGP transmit commands.

Parameters:

  • imageId (UInt32): Image ID.
  • width (UInt32): Width in pixels.
  • height (UInt32): Height in pixels.
  • chunkSize (Int32): Max raw bytes per chunk before base64 encoding.
  • format (KgpFormat): Pixel format.
  • fillByte (Byte): Byte value to fill pixel data with.

Returns: List<String>

List of escape sequences (first has full control data, rest have only m key).

csharp
public static List<string> BuildChunkedTransmitCommands(uint imageId, uint width, uint height, int chunkSize = 3072, KgpFormat format = KgpFormat.Rgba32, byte fillByte = 255)

BuildCommand(string, byte[]?)

Builds a complete KGP escape sequence with base64-encoded payload.

Parameters:

  • controlData (String): Comma-separated key=value control data.
  • rawPayload (Byte[]): Raw bytes to base64-encode as payload, or null for no payload.

Returns: String

The complete escape sequence string.

csharp
public static string BuildCommand(string controlData, byte[]? rawPayload = null)

BuildDeleteCommand(char, uint, uint)

Builds a KGP delete command.

Parameters:

Returns: String

csharp
public static string BuildDeleteCommand(char deleteTarget = 'a', uint imageId = 0, uint placementId = 0)

BuildPutCommand(uint, uint, uint, uint, int, int)

Builds a KGP put (display) command for a previously transmitted image.

Parameters:

Returns: String

csharp
public static string BuildPutCommand(uint imageId, uint placementId = 0, uint displayColumns = 0, uint displayRows = 0, int zIndex = 0, int cursorMovement = 0)

BuildQueryCommand(uint, uint, uint, KgpFormat)

Builds a KGP query command.

Parameters:

Returns: String

csharp
public static string BuildQueryCommand(uint imageId = 0, uint width = 1, uint height = 1, KgpFormat format = KgpFormat.Rgb24)

BuildTransmitAndDisplayCommand(uint, uint, uint, KgpFormat, uint, uint, int, int, int, byte)

Builds a KGP transmit+display command.

Parameters:

Returns: String

csharp
public static string BuildTransmitAndDisplayCommand(uint imageId, uint width, uint height, KgpFormat format = KgpFormat.Rgba32, uint displayColumns = 0, uint displayRows = 0, int zIndex = 0, int cursorMovement = 0, int quiet = 0, byte fillByte = 255)

BuildTransmitCommand(uint, uint, uint, KgpFormat, KgpAction, int, byte)

Builds a KGP transmit command for a simple RGB or RGBA image.

Parameters:

Returns: String

csharp
public static string BuildTransmitCommand(uint imageId, uint width, uint height, KgpFormat format = KgpFormat.Rgba32, KgpAction action = KgpAction.Transmit, int quiet = 0, byte fillByte = 255)

CreatePixelData(uint, uint, KgpFormat, byte)

Creates test pixel data of the specified size.

Parameters:

Returns: Byte[]

csharp
public static byte[] CreatePixelData(uint width, uint height, KgpFormat format = KgpFormat.Rgba32, byte fillByte = 255)

Released under the MIT License.