mirror of
https://github.com/rmcrackan/Libation.git
synced 2026-03-30 12:53:45 -04:00
20 lines
607 B
C#
20 lines
607 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using FileManager.NamingTemplate;
|
|
|
|
namespace LibationFileManager.Templates;
|
|
|
|
public record StringDto(string Value) : IFormattable
|
|
{
|
|
public static readonly Dictionary<string, Func<StringDto, object?>> FormatReplacements = new(StringComparer.OrdinalIgnoreCase)
|
|
{
|
|
{ "S", dto => dto.Value }
|
|
};
|
|
|
|
public override string ToString() => Value;
|
|
|
|
public string ToString(string? format, IFormatProvider? provider)
|
|
=> string.IsNullOrWhiteSpace(format)
|
|
? ToString()
|
|
: CommonFormatters.TemplateStringFormatter(this, format, provider, FormatReplacements);
|
|
} |