chore: bootstrap repository foundation

Solution layout, build rules with zero-package guard, in-house test
framework, localization runtime, brand mark rasteriser with ICO/PNG
generation, Core contracts (imaging, video, domain model, TIFF reader),
Titano.Tools (make-icon, i18n, xaml-lint, package-guard) and docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-02 08:59:40 +00:00
1 parent def3fadb6e
commit 83a54fb57b
109 files changed
+7523

No files matched your search

+238
View File
@@ -0,0 +1,238 @@
using Titano.Core.Imaging;
namespace Titano.Core.Model;
/// <summary>A rooted folder tree that holds originals, sidecars, proxies and exports (BRIEF §7).</summary>
public sealed record Archive
{
public required Guid Id { get; init; }
public required string Name { get; init; }
public required string RootPath { get; init; }
public string FolderTemplate { get; init; } = Naming.TemplateDefaults.Folder;
public string FileTemplate { get; init; } = Naming.TemplateDefaults.File;
public int SchemaVersion { get; init; } = 1;
public DateTimeOffset Created { get; init; }
/// <summary>Proxy long edge in pixels; 0 = full size, -1 = proxies disabled.</summary>
public int ProxyLongEdge { get; init; } = 1920;
}
/// <summary>One shoot: a folder of frames that becomes one project (BRIEF §5).</summary>
public sealed record Sequence
{
public required Guid Id { get; init; }
public required Guid ArchiveId { get; init; }
public string? Title { get; init; }
/// <summary>Folder relative to the archive root, forward slashes.</summary>
public required string Folder { get; init; }
public string? CameraMake { get; init; }
public string? CameraModel { get; init; }
public string? CameraSerial { get; init; }
public string? Lens { get; init; }
public DateTime? FirstCapture { get; init; }
public DateTime? LastCapture { get; init; }
public int FrameCount { get; init; }
/// <summary>Median capture interval in seconds.</summary>
public double? MedianInterval { get; init; }
public long TotalBytes { get; init; }
public SequenceStatus Status { get; init; }
public int RenderedCount { get; init; }
public DateTimeOffset? VerifiedAt { get; init; }
public Guid? HeroFrameId { get; init; }
public IReadOnlyList<string> Tags { get; init; } = [];
public int Rating { get; init; }
public string? Notes { get; init; }
/// <summary>Render settings ("project") as JSON.</summary>
public string? SettingsJson { get; init; }
/// <summary>Compact analysis summary as JSON; the full report lives in <c>.titano/analysis.json</c>.</summary>
public string? AnalysisJson { get; init; }
public SequenceOrigin Origin { get; init; }
public SyncState SyncState { get; init; }
public int SettingsVersion { get; init; }
public int FramesVersion { get; init; }
public Guid? OwnerUserId { get; init; }
public int WarningCount { get; init; }
public DateTimeOffset UpdatedAt { get; init; }
/// <summary>User title or "{date} {camera}".</summary>
public string DisplayTitle => !string.IsNullOrWhiteSpace(Title)
? Title!
: $"{FirstCapture:yyyy-MM-dd} {CameraModel}".Trim();
}
/// <summary>One photo of a sequence.</summary>
public sealed record Frame
{
public required Guid Id { get; init; }
public required Guid SequenceId { get; init; }
public required int Index { get; init; }
/// <summary>Path relative to the archive root, forward slashes.</summary>
public required string RelativePath { get; init; }
public required string FileName { get; init; }
public string? OriginalFileName { get; init; }
public long Size { get; init; }
/// <summary>Lower-case hex SHA-256 of the original file.</summary>
public string? Sha256 { get; init; }
/// <summary>Camera wall-clock time including sub-seconds (unspecified kind).</summary>
public DateTime? CapturedAt { get; init; }
/// <summary>UTC offset of <see cref="CapturedAt"/> when known, in minutes.</summary>
public int? UtcOffsetMinutes { get; init; }
public TimestampSource TimestampSource { get; init; }
public double? ExposureTime { get; init; }
public double? FNumber { get; init; }
public int? Iso { get; init; }
public double? FocalLength { get; init; }
public double? ExposureBias { get; init; }
public int? WhiteBalance { get; init; }
public int Orientation { get; init; } = 1;
public int Width { get; init; }
public int Height { get; init; }
public ImageFileFormat Format { get; init; }
public long? PreviewOffset { get; init; }
public long? PreviewLength { get; init; }
/// <summary>Mean log2 luminance once analysed.</summary>
public double? MeanLogLuminance { get; init; }
public double? ClipLow { get; init; }
public double? ClipHigh { get; init; }
public FrameFlags Flags { get; init; }
/// <summary>Exposure value at ISO 100: log2(N²/t) − log2(ISO/100).</summary>
public double? ExposureValue => ExposureTime is > 0 && FNumber is > 0
? Math.Log2(FNumber.Value * FNumber.Value / ExposureTime.Value) - Math.Log2((Iso ?? 100) / 100.0)
: null;
}
/// <summary>An exported video or image sequence.</summary>
public sealed record Render
{
public required Guid Id { get; init; }
public required Guid SequenceId { get; init; }
public required string PresetName { get; init; }
public string? SettingsJson { get; init; }
public required string OutputPath { get; init; }
public string? Codec { get; init; }
public int Width { get; init; }
public int Height { get; init; }
public double Fps { get; init; }
public double DurationSeconds { get; init; }
public long Bytes { get; init; }
public DateTimeOffset Created { get; init; }
public string? ProducedBy { get; init; }
}
/// <summary>Any long operation: resumable, cancellable, logged (BRIEF §5, §14.6).</summary>
public sealed record Job
{
public required Guid Id { get; init; }
public required JobKind Kind { get; init; }
public IReadOnlyList<Guid> TargetIds { get; init; } = [];
/// <summary>Human-readable target ("Harbour sunset", "Archive · 2024").</summary>
public string? TargetLabel { get; init; }
public string? ParametersJson { get; init; }
public JobState State { get; init; }
public JobPriority Priority { get; init; } = JobPriority.Normal;
public long ProgressDone { get; init; }
public long ProgressTotal { get; init; }
public double? ItemsPerSecond { get; init; }
public TimeSpan? Eta { get; init; }
/// <summary>Opaque resume cursor written at checkpoints.</summary>
public string? Checkpoint { get; init; }
public string? LogTail { get; init; }
public Guid? CreatedBy { get; init; }
public string? NodeId { get; init; }
public int Attempts { get; init; }
public string? Error { get; init; }
public DateTimeOffset Created { get; init; }
public DateTimeOffset? Started { get; init; }
public DateTimeOffset? Finished { get; init; }
}
/// <summary>A memory card known to this client (BRIEF §13).</summary>
public sealed record MediaCard
{
public required Guid Id { get; init; }
/// <summary><c>{volumeSerial}-{label}-{capacity}</c>.</summary>
public required string Identity { get; init; }
public uint VolumeSerial { get; init; }
public string? Label { get; init; }
public long Capacity { get; init; }
public string? Nickname { get; init; }
public string? CameraMake { get; init; }
public string? CameraModel { get; init; }
public string? CameraSerial { get; init; }
public string? ProfileJson { get; init; }
public bool AutoImport { get; init; }
public DateTimeOffset FirstSeen { get; init; }
public DateTimeOffset LastSeen { get; init; }
}
public sealed record User
{
public required Guid Id { get; init; }
public required string Username { get; init; }
public string? DisplayName { get; init; }
public required string PasswordHash { get; init; }
public UserRole Role { get; init; }
public Permissions Permissions { get; init; }
public long QuotaBytes { get; init; }
public long UsedBytes { get; init; }
public bool Disabled { get; init; }
public bool MustChangePassword { get; init; }
public DateTimeOffset Created { get; init; }
public DateTimeOffset? LastLogin { get; init; }
}
public sealed record SessionToken
{
public required string TokenHash { get; init; }
public required Guid UserId { get; init; }
public string? ClientName { get; init; }
public DateTimeOffset Created { get; init; }
public DateTimeOffset Expires { get; init; }
public DateTimeOffset LastUsed { get; init; }
public bool Revoked { get; init; }
}
public sealed record RenderNode
{
public required Guid Id { get; init; }
public required Guid UserId { get; init; }
public required string ClientName { get; init; }
public string? CapabilitiesJson { get; init; }
public DateTimeOffset LastHeartbeat { get; init; }
public string State { get; init; } = "idle";
}
public sealed record AuditEntry
{
public required Guid Id { get; init; }
public DateTimeOffset At { get; init; }
public Guid? UserId { get; init; }
public string? Username { get; init; }
public required string Action { get; init; }
public string? TargetKind { get; init; }
public string? TargetId { get; init; }
public string? Details { get; init; }
public string? RemoteAddress { get; init; }
}
+126
View File
@@ -0,0 +1,126 @@
namespace Titano.Core.Model;
/// <summary>Where a capture timestamp came from.</summary>
public enum TimestampSource
{
Unknown = 0,
ExifOriginal,
ExifCreate,
Xmp,
QuickTime,
Gps,
FileSystem,
}
[Flags]
public enum FrameFlags
{
None = 0,
Missing = 1,
Corrupt = 2,
Duplicate = 4,
Excluded = 8,
PreviewOnly = 16,
Undecodable = 32,
Black = 64,
White = 128,
}
[Flags]
public enum SequenceStatus
{
None = 0,
AnalyzedLight = 1,
AnalyzedDeep = 2,
ProxiesBuilt = 4,
ThumbsBuilt = 8,
Verified = 16,
HasWarnings = 32,
HasErrors = 64,
}
public enum SequenceOrigin
{
Local,
Server,
}
public enum SyncState
{
LocalOnly,
InSync,
LocalAhead,
ServerAhead,
Conflict,
RemoteOnly,
}
public enum JobKind
{
Scan,
Rebuild,
Verify,
LightAnalyse,
DeepAnalyse,
Proxies,
Thumbs,
Render,
Import,
UploadCommit,
Maintenance,
Duplicates,
Orphans,
Adopt,
Move,
}
public enum JobState
{
Queued,
Running,
Paused,
Done,
Failed,
Cancelled,
}
public enum JobPriority
{
Background = 0,
Normal = 1,
User = 2,
}
public enum UserRole
{
Viewer,
Uploader,
Editor,
Admin,
}
[Flags]
public enum Permissions : long
{
None = 0,
Read = 1,
Upload = 2,
Edit = 4,
Delete = 8,
Render = 16,
RenderNode = 32,
ManageArchive = 64,
ManageUsers = 128,
All = Read | Upload | Edit | Delete | Render | RenderNode | ManageArchive | ManageUsers,
}
public static class RolePermissions
{
public static Permissions Default(UserRole role) => role switch
{
UserRole.Admin => Permissions.All,
UserRole.Editor => Permissions.Read | Permissions.Upload | Permissions.Edit | Permissions.Delete | Permissions.Render | Permissions.RenderNode,
UserRole.Uploader => Permissions.Read | Permissions.Upload,
_ => Permissions.Read,
};
}