Table of Contents

Class UIProfile

Namespace
FishMMO.Client
Assembly
FishMMO.Client.dll

Reads and writes a UI profile: the player's window layout, theme colours and interface scale, in a file of its own that can be handed to somebody else.

public static class UIProfile
Inheritance
UIProfile
Inherited Members

Remarks

Why a separate file. Configuration.cfg holds the whole client's settings — including its API host, launcher state and the machine's display mode. None of that is meaningful on another player's computer and some of it is actively wrong there, so it is not something to hand around. A profile carries only the parts that describe how the interface looks and where its windows are, which are exactly the parts worth sharing.

Configuration.cfg stays the source of truth. Loading a profile writes its keys into GlobalSettings and saves; nothing reads a profile at runtime. That keeps one store behind every setting — a second live store is how two halves of a client end up disagreeing about what the player chose — and means a profile that is later deleted cannot take the player's interface with it.

Every key is validated on the way in. A profile is a text file written by a stranger. Panel coordinates are re-clamped into the viewport by UITKControl when they are applied, the scale is clamped to the range the slider offers, and colour channels are bytes that cannot be out of range by construction. A key the profile format does not define is ignored rather than copied through, so a hand-edited profile cannot reach any other part of the configuration.

Fields

DirectoryName

Folder, under the install directory, that profiles are read from and written to.

public const string DirectoryName = "UIProfiles"

Field Value

string

Properties

ProfileDirectory

The folder profiles live in.

public static string ProfileDirectory { get; }

Property Value

string

Methods

Delete(string, out string)

Deletes a profile.

public static bool Delete(string name, out string error)

Parameters

name string

Profile name.

error string

A player-facing explanation when the delete fails.

Returns

bool

True when the file is gone afterwards.

Exists(string)

Whether a profile of that name exists.

public static bool Exists(string name)

Parameters

name string

Returns

bool

IsValidName(string, out string)

Whether a name is usable as a profile file name.

public static bool IsValidName(string name, out string reason)

Parameters

name string

The candidate name.

reason string

A player-facing explanation when it is not.

Returns

bool

True when the name is safe to use.

Remarks

Rejects rather than sanitises. A name silently rewritten to something else does not match what the player typed, so the profile they saved is not the one they look for — and a sanitiser that strips separators is one missed case away from writing outside the profile folder.

List()

Every profile currently on disk, by name, alphabetically.

public static List<string> List()

Returns

List<string>

Load(string, out string)

Applies a profile to the running client and writes it into the global configuration.

public static bool Load(string name, out string error)

Parameters

name string

Profile name.

error string

A player-facing explanation when the load fails.

Returns

bool

True when the profile was applied.

Remarks

A profile is applied wholesale, including the absence of a key. A profile with no entry for a panel means "that panel sits where the stylesheet puts it", not "leave the panel where the player last dragged it" — otherwise loading somebody else's layout leaves a mixture of theirs and yours, which is not a layout either of you has ever seen.

Colours work the same way: a colour the profile does not set is cleared rather than left, so a shared colour scheme arrives whole.

Save(string, out string)

Writes the interface's current state to a profile.

public static bool Save(string name, out string error)

Parameters

name string

Profile name, already validated by IsValidName(string, out string).

error string

A player-facing explanation when the save fails.

Returns

bool

True when the file was written.

Remarks

Panel positions are collected from the stored configuration keys, not from the panels currently registered: the settings panel is reachable from the login screen, where the world's windows do not exist yet.