public static IConversionSettingsBuilder <TCustom, TomlDateTime> ToToml <TCustom>( this IConversionSettingsBuilder <TCustom, TomlDateTime> cb, Func <TCustom, DateTimeOffset> conv) { ((TomlSettings.ConversionSettingsBuilder <TCustom, TomlDateTime>)cb).AddConverter( new TomlConverter <TCustom, TomlDateTime>((root, customValue) => new TomlDateTime(root, conv(customValue)))); return(cb); }
public static IConversionSettingsBuilder <TCustom, TomlTimeSpan> ToToml <TCustom>( this IConversionSettingsBuilder <TCustom, TomlTimeSpan> cb, Func <TCustom, TimeSpan> conv) { ((TomlSettings.ConversionSettingsBuilder <TCustom, TomlTimeSpan>)cb).AddConverter( new TomlConverter <TCustom, TomlTimeSpan>((root, customValue) => new TomlTimeSpan(root, conv(customValue)))); return(cb); }
public static IConversionSettingsBuilder <TCustom, TomlTable> ToToml <TCustom>( this IConversionSettingsBuilder <TCustom, TomlTable> cb, Action <TCustom, TomlTable> conv) { ((TomlSettings.ConversionSettingsBuilder <TCustom, TomlTable>)cb).AddConverter( new TomlConverter <TCustom, TomlTable>((root, customValue) => { var t = new TomlTable(root); conv(customValue, t); return(t); })); return(cb); }
public static IConversionSettingsBuilder <TCustom, TomlString> ToToml <TCustom>( this IConversionSettingsBuilder <TCustom, TomlString> cb, Func <TCustom, string> conv, Func <TCustom, string> unit) { ((TomlSettings.ConversionSettingsBuilder <TCustom, TomlString>)cb).AddConverter( new TomlConverter <TCustom, TomlString>((root, customValue) => { return(new TomlString(root, conv(customValue)) { Unit = unit(customValue), }); })); return(cb); }