feat(app): library, jobs, settings, server, welcome and about screens
Local-mode composition root (SQLite index, one JobEngine fed by a single handler registration list), keyset-paged library with thumbnail cache and hover scrub, live job list with throttled updates and the shell job bar, settings with live template validation and encoder self-test, server connection with trust-on-first-use and DPAPI token, first-run welcome, About with update check, and --capture screenshots with synthetic data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
94 files changed
+10130
-374
No files matched your search
@@ -8,10 +8,11 @@ namespace Titano.App.Infrastructure;
|
||||
/// </summary>
|
||||
public sealed class AppEnvironment
|
||||
{
|
||||
private AppEnvironment(string dataDirectory, bool portable)
|
||||
private AppEnvironment(string dataDirectory, bool portable, bool isCapture)
|
||||
{
|
||||
DataDirectory = dataDirectory;
|
||||
IsPortable = portable;
|
||||
IsCapture = isCapture;
|
||||
Directory.CreateDirectory(DataDirectory);
|
||||
Directory.CreateDirectory(LogDirectory);
|
||||
Directory.CreateDirectory(CacheDirectory);
|
||||
@@ -19,8 +20,13 @@ public sealed class AppEnvironment
|
||||
|
||||
public string DataDirectory { get; }
|
||||
public bool IsPortable { get; }
|
||||
|
||||
/// <summary>A throw-away environment for <c>--capture</c>: nothing of the user's data is read or written.</summary>
|
||||
public bool IsCapture { get; }
|
||||
|
||||
public string LogDirectory => Path.Combine(DataDirectory, "logs");
|
||||
public string CacheDirectory => Path.Combine(DataDirectory, "cache");
|
||||
public string BackupDirectory => Path.Combine(DataDirectory, "backups");
|
||||
public string DatabasePath => Path.Combine(DataDirectory, "titano.db");
|
||||
public string SettingsPath => Path.Combine(DataDirectory, "settings.json");
|
||||
|
||||
@@ -28,8 +34,29 @@ public sealed class AppEnvironment
|
||||
{
|
||||
var exeDir = AppContext.BaseDirectory;
|
||||
if (File.Exists(Path.Combine(exeDir, "portable.txt")))
|
||||
return new AppEnvironment(Path.Combine(exeDir, "data"), portable: true);
|
||||
return new AppEnvironment(Path.Combine(exeDir, "data"), portable: true, isCapture: false);
|
||||
var local = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
return new AppEnvironment(Path.Combine(local, "Titano"), portable: false);
|
||||
return new AppEnvironment(Path.Combine(local, "Titano"), portable: false, isCapture: false);
|
||||
}
|
||||
|
||||
/// <summary>A fresh temporary data folder for screenshots and smoke tests; delete it with <see cref="DeleteCaptureData"/>.</summary>
|
||||
public static AppEnvironment ForCapture() =>
|
||||
new(Path.Combine(Path.GetTempPath(), "titano-capture-" + Guid.CreateVersion7().ToString("N")), portable: false, isCapture: true);
|
||||
|
||||
/// <summary>Removes the temporary data folder of a capture environment (never a real one).</summary>
|
||||
public void DeleteCaptureData()
|
||||
{
|
||||
if (!IsCapture) return;
|
||||
try
|
||||
{
|
||||
Directory.Delete(DataDirectory, recursive: true);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
// Files still open (log, database) are left to the OS temp cleanup.
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user