public Key(PixelTypes pixelType, string filePath, IImageDecoder customDecoder) { Type customType = customDecoder?.GetType(); this.commonValues = new Tuple <PixelTypes, string, Type>(pixelType, filePath, customType); this.decoderParameters = GetDecoderParameters(customDecoder); }
public Key(PixelTypes pixelType, string filePath, int allocatorBufferCapacity, IImageDecoder customDecoder) { Type customType = customDecoder?.GetType(); this.commonValues = new Tuple <PixelTypes, string, Type, int>( pixelType, filePath, customType, allocatorBufferCapacity); this.decoderParameters = GetDecoderParameters(customDecoder); }
private static Dictionary <string, object> GetDecoderParameters(IImageDecoder customDecoder) { Type type = customDecoder.GetType(); var data = new Dictionary <string, object>(); while (type != null && type != typeof(object)) { PropertyInfo[] properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (PropertyInfo p in properties) { string key = $"{type.FullName}.{p.Name}"; object value = p.GetValue(customDecoder); data[key] = value; } type = type.GetTypeInfo().BaseType; } return(data); }
public static void RegisterDecoder(string fileExtension, IImageDecoder decoder) { decoders.Add(fileExtension.ToUpperInvariant(), decoder.GetType()); }