FindMyFiles

FindMyFiles.Services

ShellOps Class

Shell-facing operations, centralized so every failure path notifies the user instead of crashing. Targets launch via explorer.exe to shed the process's elevation (CLAUDE.md UI rules).

public static class ShellOps

Inheritance System.Object → ShellOps

Methods

ShellOps.CopyText(string, string) Method

Put text on the clipboard. A failure is logged and surfaced as a warning notification (clipboard access can be transiently denied by other apps).

public static void CopyText(string text, string what);

Parameters

text System.String

The content to copy.

what System.String

Short label for what is being copied, used in the failure log/notification (e.g. "path", "diagnostics").

ShellOps.Open(string) Method

Open a file or folder with its default handler via explorer.exe, shedding the app's elevation. Failures notify the user (with a Win32-specific hint) rather than throwing.

public static void Open(string fullPath);

Parameters

fullPath System.String

Absolute path to open; treated as data, never as a command line (see FindMyFiles.Services.ShellOps.BuildOpenStartInfo(System.String)).

ShellOps.Relaunch() Method

Relaunch this app (unelevated — no runas) and exit, used right after an in-app service registration so the fresh instance picks up the now-running service over the pipe (the engine transport is chosen once, at startup). Strictly user-initiated (the "restart app" button). A failed launch notifies and leaves the current instance running.

public static void Relaunch();

ShellOps.Reveal(string) Method

Reveal a file in Explorer with it selected, via the shell API (SHParseDisplayName + SHOpenFolderAndSelectItems) — never explorer.exe /select,<path>, whose switch parser needs a literal quoted path it does not escape, so a '"' in an MFT-sourced name could inject switches. Runs on a dedicated STA thread with COM initialised: on the WinUI UI thread (an ASTA) SHOpenFolderAndSelectItems returns S_OK but opens nothing. Failures notify off-thread (Notifier/ FileLog are thread-safe; the ViewModel marshals the InfoBar to the UI).

public static void Reveal(string fullPath);

Parameters

fullPath System.String

Absolute path to reveal and select.