Table of Contents

Class ServerIconService

Namespace
McServerLauncher.Services
Assembly
McServerLauncher.dll

Generates a server's server-icon.png (64x64 PNG) from any image, cropping it to a centered square and scaling. This is the icon players see in the server list. Uses SkiaSharp so it works on Windows and Linux.

public class ServerIconService
Inheritance
ServerIconService
Inherited Members

Fields

FileName

public const string FileName = "server-icon.png"

Field Value

string

Methods

RemoveIcon(string)

Deletes the icon, so the server list falls back to the game's default.

public void RemoveIcon(string serverFolder)

Parameters

serverFolder string

RenderIcon(string)

The 64x64 PNG a server would get from this image, without touching any server.

public byte[] RenderIcon(string sourceImagePath)

Parameters

sourceImagePath string

Returns

byte[]

Remarks

Separate from writing so the appearance editor can show the result straight away and only put it on disk when the user accepts: picking an image and then cancelling must leave the server exactly as it was.

SetIconFromImage(string, string)

public void SetIconFromImage(string serverFolder, string sourceImagePath)

Parameters

serverFolder string
sourceImagePath string

WriteIcon(string, byte[])

Writes the icon, never half: a cut-off PNG is an icon the game refuses to show.

public void WriteIcon(string serverFolder, byte[] png)

Parameters

serverFolder string
png byte[]