public StreamConverter( string toExtension, AsyncConversion <Stream> conversion) { ToExtension = toExtension; Conversion = conversion; }
public TypeConverter( AsyncConversion conversion, CanConvert canConvert) { Conversion = conversion; CanConvert = canConvert; }
public static void RegisterFileConverter( string fromExtension, AsyncConversion <Stream> conversion) { Guard.AgainstNull(conversion, nameof(conversion)); Guard.AgainstBadExtension(fromExtension, nameof(fromExtension)); extensionConverters[fromExtension] = conversion; }
public TypeConverter( string toExtension, AsyncConversion conversion, CanConvert canConvert) { ToExtension = toExtension; Conversion = conversion; CanConvert = canConvert; }
public static void RegisterFileConverter <T>( AsyncConversion <T> conversion, CanConvert <T>?canConvert = null) { Guard.AgainstNull(conversion, nameof(conversion)); var converter = new TypeConverter( (o, settings) => conversion((T)o, settings), DefaultCanConvert(canConvert)); typedConverters.Add(converter); }
public static void RegisterFileConverter( AsyncConversion conversion, CanConvert canConvert) { Guard.AgainstNull(conversion, nameof(conversion)); Guard.AgainstNull(canConvert, nameof(canConvert)); var converter = new TypeConverter( conversion, canConvert); typedConverters.Add(converter); }
internal static bool TryGetExtensionConverter(string extension, [NotNullWhen(true)] out AsyncConversion <Stream>?converter) { return(extensionConverters.TryGetValue(extension, out converter)); }