Files
Chronos/src/Titano.Uploader/Infrastructure/CommandLine.cs
T
Claude ad5c3e0f37 feat(uploader): settings, DPAPI token, single instance and startup registration
uploader.json (server, user, DPAPI CurrentUser-protected token, trusted
fingerprints, options, watch folders) written atomically; command line
(paths, --tray, --capture); named mutex plus a current-user named pipe
that hands a second launch's paths to the running instance; HKCU Run
key for "Start with Windows"; coalescing background writer for state
files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-02 10:27:36 +00:00

28 lines
1.2 KiB
C#

namespace Titano.Uploader.Infrastructure;
/// <summary>
/// <c>Titano.Uploader.exe [--tray] [--capture &lt;dir&gt;] [files or folders…]</c>: paths are enqueued, <c>--tray</c>
/// starts hidden (used by the Run key), <c>--capture</c> renders screenshots and exits.
/// </summary>
public sealed record CommandLine(IReadOnlyList<string> Paths, bool StartInTray, string? CaptureDirectory)
{
public const string TrayOption = "--tray";
public const string CaptureOption = "--capture";
public static CommandLine Parse(IReadOnlyList<string> args)
{
var paths = new List<string>();
var tray = false;
string? capture = null;
for (var i = 0; i < args.Count; i++)
{
var a = args[i];
if (a.Equals(TrayOption, StringComparison.OrdinalIgnoreCase)) tray = true;
else if (a.Equals(CaptureOption, StringComparison.OrdinalIgnoreCase))
capture = i + 1 < args.Count && !args[i + 1].StartsWith("--", StringComparison.Ordinal) ? args[++i] : "screenshots";
else if (!a.StartsWith("--", StringComparison.Ordinal) && a.Length > 0) paths.Add(a);
}
return new CommandLine(paths, tray, capture);
}
}