Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ryzhpolsos/redeye/llms.txt

Use this file to discover all available pages before exploring further.

IConfig is the central interface for reading and working with RedEye’s XML configuration. It loads config.xml on startup, exposes the parsed node tree, and provides utilities for constructing new nodes at runtime. Every plugin receives a pre-initialized IConfig instance through the Config property on the Plugin base class.

IConfig interface

IConfig lives in the RedEye.Core namespace and extends IComponent. Use it to load config files, resolve file-system paths relative to the RedEye installation directory, and obtain the root or layout node tree.

LoadConfig

Parses config.xml from the application directory, processes all child nodes, and registers hotkeys, windows, and layout nodes. Returns this to allow chaining.
IConfig LoadConfig();
LoadConfig() is called once by the shell on startup. Plugins do not need to call it. Use GetRootNode() or GetLayoutNode() to access the already-loaded tree.

GetAppDirectory

Returns the absolute path to the directory containing the RedEye executable.
string GetAppDirectory();
Returnsstring: absolute path, e.g. C:\RedEye\.

GetPath

Resolves one or more relative path segments against the application directory. If the combined path is already rooted, it is returned as-is.
string GetPath(params string[] relativePath);
relativePath
string[]
required
One or more path segments to combine and resolve. Equivalent to calling Path.Combine and then prepending the app directory when the result is not already rooted.
Returnsstring: the resolved absolute path.
// Resolve a plugin asset at runtime
string iconPath = Config.GetPath("plugins", "MyPlugin", "icon.png");

GetRootNode

Returns the ConfigNode for the document root (<root>). All configuration data is accessible by traversing its children.
ConfigNode GetRootNode();
ReturnsConfigNode: the root node of the loaded config tree.

GetLayoutNode

Returns the ConfigNode for the <layout> element inside <config>. This is the starting point for all window and widget definitions.
ConfigNode GetLayoutNode();
ReturnsConfigNode: the layout node (config → layout).

LoadFile

Parses an XML file and appends the resulting nodes as children of parentNode. The file path is resolved relative to the application directory.
void LoadFile(string fileName, ConfigNode parentNode);
fileName
string
required
Path to the XML file relative to the RedEye application directory.
parentNode
ConfigNode
required
The node that will receive the parsed XML as child nodes.

LoadString

Parses a raw XML string and appends the resulting nodes as children of parentNode.
void LoadString(string data, ConfigNode parentNode);
data
string
required
A valid XML string to parse. Must have a single root element.
parentNode
ConfigNode
required
The node that will receive the parsed XML as child nodes.

CreateNode

Creates a new empty virtual ConfigNode with the given name. Virtual nodes are not backed by an XML document and cannot be saved to disk.
ConfigNode CreateNode(string name);
name
string
required
Element name for the new node.
ReturnsConfigNode: a new empty node.

CreateNodeFromString

Parses a snippet of XML and returns the first element as a ConfigNode.
ConfigNode CreateNodeFromString(string data);
data
string
required
XML string. The outermost element becomes the returned node.
ReturnsConfigNode: the parsed node.
ConfigNode badge = Config.CreateNodeFromString("<badge color=\"#ff0000\" text=\"NEW\" />");
string color = badge.GetAttribute("color"); // "#ff0000"

ConfigNode

ConfigNode is the core tree type used throughout RedEye. Every element in config.xml is represented as a ConfigNode. Attributes are evaluated through the expression parser before being returned, so they support variables and built-in functions.

Properties

Name
string
The XML element name of this node, e.g. "window" or "label".
Value
string
The text content of the element. Evaluated through the expression parser via GetValue(). Use GetRawValue() to skip evaluation.
IsTextNode
bool
true when the node was created with a non-null text value.
IsAttribute
bool
true when this node represents an attribute node rather than an element.
ParentNode
ConfigNode
The direct parent node, or null for the root.
RootNode
ConfigNode
Walks up the parent chain and returns the topmost ancestor. Returns this if there is no parent.
IsVirtual
bool
true for nodes created with CreateNode() or CreateNodeFromString(). Virtual nodes cannot be saved to disk.

GetAttribute

Returns the value of the named attribute, evaluated through the expression parser. Returns defaultValue (default: empty string) when the attribute is absent.
string GetAttribute(string name, string defaultValue = "");
name
string
required
Attribute name to look up.
defaultValue
string
Value to return when the attribute is absent. Defaults to an empty string.
// Inside a plugin widget, read the "label" attribute from the node
string label = Node.GetAttribute("label", "Untitled");
int width = int.Parse(Node.GetAttribute("width", "100"));

GetRawAttribute

Returns the raw, unevaluated value of the named attribute, bypassing the expression parser.
string GetRawAttribute(string name, string defaultValue = "");

GetAttributes

Returns the names of all attributes set on this node.
IEnumerable<string> GetAttributes();

SetAttribute

Sets or updates the named attribute. Triggers any registered event watchers with a SetAttribute event.
void SetAttribute(string name, string value);
name
string
required
Attribute name to set.
value
string
required
New attribute value.

GetNodes

Returns all child nodes after processing special directives (<if>, <import>, <variables>, etc.). Overloads allow filtering by name or predicate.
IEnumerable<ConfigNode> GetNodes();
IEnumerable<ConfigNode> GetNodes(string name);
IEnumerable<ConfigNode> GetNodes(Func<ConfigNode, bool> filter);
name
string
When provided, returns only child nodes whose Name equals this value.
foreach (var widget in layoutNode.GetNodes("label"))
{
    string text = widget.GetAttribute("text");
}

GetNode

Returns the first child node with the given name, or null if none exists.
ConfigNode GetNode(string name);

TryGetNode

Attempts to find the first child node by name. Returns true and sets node on success.
bool TryGetNode(string name, out ConfigNode node);

AddNode

Appends a child node and fires AddNode event watchers.
void AddNode(ConfigNode node);

Variables

ConfigNode implements IVariableStorage<string>, providing scoped variables that propagate up the parent chain when read.
string GetVariable(string name);
void SetVariable(string name, string value);
IEnumerable<string> GetVariables();
Variables set on a child node are accessible from the child and any of its descendants. Reading a variable that does not exist on the current node walks up to the parent.

Event watchers

You can subscribe to mutations on a node using AddEventWatcher. The isRecursive flag propagates the watcher to all child nodes added in the future.
string AddEventWatcher(Action<ConfigNodeEvent> eventWatcher, bool isRecursive = false);
void RemoveEventWatcher(string name);
ConfigNodeEvent includes:
  • EventType — one of AddNode, RemoveNode, SetAttribute, SetVariable
  • Node — the node that owns the watcher
  • AddedNode / RemovedNode — the affected child node
  • OldAttributeValue / NewAttributeValue — for attribute changes
  • OldVariableValue / NewVariableValue — for variable changes

Usage examples

Reading config values from a plugin

public override void Main()
{
    ConfigNode root = Config.GetRootNode();
    string theme = root["config"]["core"]["theme"].GetAttribute("name", "default");
    Logger.LogInformation("Active theme: " + theme);
}

Creating and populating a virtual node

ConfigNode node = Config.CreateNode("item");
node.SetAttribute("text", "Hello");
node.SetAttribute("color", "#ffffff");

Loading a config fragment from a string

ConfigNode fragment = Config.CreateNodeFromString(
    "<panel width=\"200\" height=\"40\"><label text=\"Status\" /></panel>"
);

foreach (var child in fragment.GetNodes())
{
    Logger.LogInformation(child.Name); // "label"
}

Resolving a path to a plugin asset

string fullPath = Config.GetPath("plugins", "MyPlugin", "data.json");
string json = File.ReadAllText(fullPath);

Plugin API reference

Overview of all services available to plugins, including the Config property.

Configuration overview

How config.xml is structured and how the node tree is loaded at startup.

Build docs developers (and LLMs) love