Files
itc.pidi-3-docs/figures/code/document-name.cs
T
0qln bff34658b8 appendix: 23 Code-Ausschnitte aus dem Houston-Repository
Pin nixpkgs to the revision used by itc.componentware: the channel version
ships a latexminted that crashes on Python 3.14, which made every listing
fail and sent latexmk into an endless error prompt. Also force
nonstopmode/halt-on-error so a broken listing can never loop again.
2026-08-25 21:38:22 +02:00

27 lines
847 B
C#

namespace Houston.Model.Documents;
public readonly record struct DocumentName(string Value)
{
public bool Matches(string pattern)
{
return Value.Contains(pattern, StringComparison.CurrentCultureIgnoreCase);
}
/// <summary>
/// Whether this document is a PDF and therefore eligible for the inline modal preview.
/// </summary>
public bool IsPdf => Value.EndsWith(".pdf", StringComparison.OrdinalIgnoreCase);
/// <summary>
/// Whether this is an external document link (a .URL file).
/// </summary>
public bool IsLink => Value.EndsWith(".url", StringComparison.OrdinalIgnoreCase);
/// <summary>
/// File display name.
/// </summary>
public string DisplayName => IsLink ? Value[..^".url".Length] : Value;
/// <inheritdoc />
public override string ToString() => Value;
}