Skip to content

Commit

Permalink
Added MediaTypes.Icon (image/x-icon) as a supported content-type for …
Browse files Browse the repository at this point in the history
…the BitmapHttpContentConverter and BitmapSourceHttpContentConverter, this adds support for loading icon files.

[release]
  • Loading branch information
Lakritzator committed Sep 5, 2016
1 parent 6d8799c commit c1f703c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ static BitmapHttpContentConverter()
SupportedContentTypes.Add(MediaTypes.Jpeg.EnumValueOf());
SupportedContentTypes.Add(MediaTypes.Png.EnumValueOf());
SupportedContentTypes.Add(MediaTypes.Tiff.EnumValueOf());
SupportedContentTypes.Add(MediaTypes.Icon.EnumValueOf());
}
/// <summary>
/// Constructor
Expand Down Expand Up @@ -141,7 +142,10 @@ public bool CanConvertToHttpContent(Type typeToConvert, object content)
/// <inheritdoc />
public HttpContent ConvertToHttpContent(Type typeToConvert, object content)
{
if (!CanConvertToHttpContent(typeToConvert, content)) return null;
if (!CanConvertToHttpContent(typeToConvert, content))
{
return null;
}

var bitmap = content as Bitmap;
if (bitmap == null) return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ static BitmapSourceHttpContentConverter()
SupportedContentTypes.Add(MediaTypes.Jpeg.EnumValueOf());
SupportedContentTypes.Add(MediaTypes.Png.EnumValueOf());
SupportedContentTypes.Add(MediaTypes.Tiff.EnumValueOf());
SupportedContentTypes.Add(MediaTypes.Icon.EnumValueOf());
}

/// <summary>
Expand Down

0 comments on commit c1f703c

Please sign in to comment.