Skip to content

Commandog Dispatcher

Taiizor edited this page Jun 5, 2026 · 2 revisions

Commandog Dispatcher

Sucrose.Commandog.exe is the heart of the Sucrose process model: a short-lived command dispatcher / process broker. Almost every cross-process action — set/restart/cycle the wallpaper, kill a process, open the Portal, run a service, import/export a theme, register startup, show a crash dialog — is performed by spawning Commandog with a single encoded argument string. Commandog parses that string, performs exactly one action (usually by launching the right executable or calling a shared helper), and then exits. It is not a resident service. This page explains how the broker works internally; the full command catalogue lives on the Command Reference page.

Stability disclaimer: Commandog's command string is an internal IPC protocol, not a stable, supported public CLI. End users never type these commands — the UI builds them. The format and the command set may change between versions. See Command Reference and Automation Examples.

Contents

What Commandog is (and is not)

  • It is a console (hidden) process at src/Project/Sucrose.Commandog, re-runnable, that runs one command and exits via Environment.Exit(0).
  • It is not a long-lived service, and it is not related to the live-data IPC channels (Pipe / Signal / Transmission). Despite the shared "command" wording, Commandog is process-argument based; the live-data transports are described on the IPC page.

Key files: src/Project/Sucrose.Commandog/App.cs (entry point), Helper/Arguments.cs (the command switch), Helper/Parse.cs (typed argument parsing), Helper/Scheduler.cs (Windows Task Scheduler operations), Helper/Miscellaneous.cs (runtime type sniffing for Test). The command enum is src/Shared/Sucrose.Shared.Dependency/Enum/CommandType.cs; the delimiter constants are in src/Library/Sucrose.Memory/Manage/Readonly/General.cs.

Entry point and lifecycle

App.cs Main():

  1. SSDHG.Configure() (graphics — high-performance GPU) and SSDHR.Configure() (runtime — bundled private .NET runtime, RELEASE-only).
  2. Sets Console.InputEncoding/OutputEncoding = UTF8required so the / Unicode delimiters survive (mojibake here means the wrong console encoding).
  3. Sets thread culture from Sucrose.Manager.Manage.General.Culture.
  4. Runs Arguments.Parse(args).
  5. Always calls Environment.Exit(0) in finally — it does not stay resident.

The command string wire format

Built from constants in src/Library/Sucrose.Memory/Manage/Readonly/General.cs:

Constant Value
StartCommandChar '✔' (U+2714)
StartCommand "✔"
ValueSeparatorChar '✖' (U+2716)
ValueSeparator "✖"

Layout:

✔<CommandName>✖<Value0>✖<Value1>✖<Value2>...

Examples:

✔Interface✖<path-to-Portal.exe>
✔Interface✖<path-to-Portal.exe>✖GeneralSetting
✔Live✖<path-to-engine.exe>
✔RestartLive✖Unknown
✔Watchdog✖<path-to-Watchdog.exe>✖<Base64(app✖ex✖show✖log)>

Anyone reproducing a command externally must emit these exact / characters.

Parse flow

Arguments.Parse (Helper/Arguments.cs):

  1. string.Join(" ", args) to recombine the argument tokens into one string.
  2. Require the combined string to StartsWith("✔") AND Contains("✖").
  3. Strip the leading (Combined[1..]), then Split('✖').
  4. First segment = command Name; remaining segments = Values (at least one is required; total parts ≥ 2).
  5. Enum.TryParse<CommandType>(Name, ignoreCase: true, ...)command names are case-insensitive.
  6. switch on the parsed CommandType.

Typed value parsing

Values are coerced by Parse.ArgumentValue<T> (Helper/Parse.cs):

T Conversion
int int.TryParse
bool bool.TryParse
an enum type Enum.Parse
anything else the raw string

Miscellaneous.GetType(string) sniffs bool first, then int, else string — used only by the diagnostic Test command.

Routing: what the dispatcher does

The switch in Arguments.cs maps each CommandType to a side effect. Run(x) below is Sucrose.Shared.Space.Helper.Processor.Run (a ShellExecute); many "open" commands simply pass a path or URL to Run. A representative slice:

Command Action in Commandog
Live Run(value) — start the given engine exe directly.
Kill Processor.Kill(name) — kill all processes by name.
Interface Start Portal (Run(portal[, settingPage])); optional 2nd value = settings-page selector (ArgumentCommandType).
Property / PropertyA Launch Sucrose.Property.exe (the Customize UI), with or without a theme argument.
Update Launch Sucrose.Update.exe (optional 2nd value, run hidden).
Reportdog / Backgroundog Launch the respective service exe.
Watchdog When exactly 2 values: launch Sucrose.Watchdog.exe with the Base64 error payload (hidden).
RestartLive Stop live + stop subprocess, kill Sucrose.Backgroundog.exe, Run.Start(), wait 1500 ms, retry if not running. (Wallpaper reload.)
Cycyling Same as RestartLive but without killing Backgroundog (wallpaper slideshow advance; note the in-code spelling "Cycyling").
Scheduler Create / Enable / Disable / Delete a Windows scheduled task (SchedulerCommandType), task name Autorun for Sucrose.
Startup / StartupM / StartupP Register Windows startup (per-user / machine / priority) via Skylark.Wing.
Import / Export / Reset / Temp / Versioning Theme/library/file operations through Sucrose.Shared.Space.Helper.* (Import/Export/Reset/Temp are awaited async; Versioning calls the synchronous Delete.Folder).
Log / Wiki / Report / Publish / Official / Repository / Discussions / QuotingGoogle / QuotingTranslate / Bundle Run(value) — open a URL or file (the Bundle case launches the downloaded installer).
Test Diagnostic echo: prints each typed value to the console.

The full CommandType table (31 commands), plus ArgumentCommandType (settings-page targets) and SchedulerCommandType, are documented on the Command Reference page. Two sub-enums:

  • ArgumentCommandType: OtherSetting, DonateSetting, SystemSetting, GeneralSetting, PersonalSetting, WallpaperSetting, PerformanceSetting — the 2nd value of Interface.
  • SchedulerCommandType: Create, Enable, Delete, Disable.

Who emits commands

Commands are built by the UI and helper layers, never by end users:

  • Launcher tray actions — each tiny static Command() under src/Shared/Sucrose.Shared.Launcher/Command/*.cs builds a ✔...✖... string and calls Processor.Run(Commandog, ...): Interface.cs✔Interface✖<Portal>, Setting.cs✔Interface✖<Portal>✖GeneralSetting, Property.cs✔Property✖<Property>, Reload.cs✔RestartLive✖Unknown, Update.cs✔Update✖<Update> (or ...✖False for silent), Reportdog.cs✔Reportdog✖<Reportdog>, Version.cs✔Versioning✖<LocalAppData\Sucrose>✖<version>✖false.
  • Crash pathSucrose.Shared.Space/Helper/Watchdog.cs builds ✔Watchdog✖<Watchdog>✖<Base64 payload>.
  • UpdaterSucrose.Update's MainWindow builds ✔Bundle✖<path> to launch the downloaded installer.
  • EngineSucrose.Shared.Engine/Event/Handler.cs emits ✔RestartLive✖Unknown.

Note that Close.cs and Engine.cs are exceptions — they act locally (kill processes / start the engine) and do not route through Commandog.

See also

  • Command Reference — the full 31-command catalogue and sub-enums.
  • Automation Examples — practical command examples and the stability disclaimer.
  • IPC — the separate live-data Pipe / Signal / Transmission channels.
  • Architecture Overview — why everything routes through a broker.
  • Lifecycle — where Reload / Cycle / Watchdog commands fire during runtime.

Home

Getting Started

Wallpaper Types

Using Sucrose

Settings Reference

Creating Wallpapers

Engine Reference

Automation & Command Line

Architecture & Internals

Data, Files & Diagnostics

Building & Contributing

Help & Support

Clone this wiki locally