Table of Contents

Class DroppedFileParser

Namespace
EchoHub.Client.UI.Helpers
Assembly
EchoHub.Client.dll

Recognizes a dragged-and-dropped file (or files) that a terminal delivers into the input as an absolute path. Terminals differ: some paste the whole path at once, others send it character by character; either way this checks whether the current input text resolves to existing file(s).

public static class DroppedFileParser
Inheritance
DroppedFileParser
Inherited Members

Methods

LooksLikePath(string)

Cheap pre-check so callers only stat the filesystem when the input plausibly holds a path: a quoted path, a Windows drive path (X:</code>/X:/), a UNC path (\), or a POSIX absolute path (/). Normal chat text never starts this way.

public static bool LooksLikePath(string text)

Parameters

text string

Returns

bool

TryGetFiles(string, out List<string>, Func<string, bool>?)

Returns true when text resolves to one or more existing files. Handles a single path (quoted or not, possibly containing spaces) and multiple space-separated (optionally quoted) paths. fileExists is injectable for testing; production passes Exists(string).

public static bool TryGetFiles(string text, out List<string> files, Func<string, bool>? fileExists = null)

Parameters

text string
files List<string>
fileExists Func<string, bool>

Returns

bool