HypernovaDesktop Components · docs
Binarymission
WPF › Skinning › BinarySkinSerializer

BinarySkinSerializer

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Skinning

Reads and writes skins as JSON files.

public static class BinarySkinSerializer

Remarks

A skin file names a built-in skin to start from and lists only what differs: { "format": "binarymission-skin/1", "name": "Harbour", "basedOn": "Black", "colors": { "accent": "#2BA3A3", "surface": "#1C2A30" } } basedOn is one of the BinarySkinTheme names, White when left out. The colours are named as BinarySkinColor is, starting with a lower-case letter, and written #RRGGBB or #AARRGGBB . isDark , prefersSystemBackdrop and cornerRadius may also be given. An accent left out is the one chosen in Windows when the file is read. The selected tab's colours, when not given, are made from the accent to read on the canvas, and isDark , when not given and the surface is, follows the surface. Comments ( // and /* */ ) are allowed. ToJson writes every value, so a file it writes reads back as exactly the same skin.

Members at a glance

FromJsonReads a skin from JSON text.
LoadReads a skin from a file.
LoadReads a skin from a stream of UTF-8 text.
SaveWrites a skin to a file, as UTF-8.
ToJsonWrites a skin as JSON text.
FormatThe format a skin file declares, and the only one this version reads.

Methods

FromJson

public static BinarySkin FromJson(string json)

Reads a skin from JSON text.

json
The text.

Returns. The skin.

BinarySkinFormatException
The text does not describe a skin.

Load

public static BinarySkin Load(string path)

Reads a skin from a file.

path
The file.

Returns. The skin.

BinarySkinFormatException
The file does not describe a skin.

Load

public static BinarySkin Load(Stream stream)

Reads a skin from a stream of UTF-8 text.

stream
The stream, read to its end and left open.

Returns. The skin.

BinarySkinFormatException
The text does not describe a skin.

Save

public static void Save(BinarySkin skin, string path)

Writes a skin to a file, as UTF-8.

skin
The skin.
path
The file, replaced if it exists.

ToJson

public static string ToJson(BinarySkin skin)

Writes a skin as JSON text.

skin
The skin.

Returns. The text: every value the skin has, one to a line.

Fields

Format

public const string Format

The format a skin file declares, and the only one this version reads.