fix duplicate connections on the dashboard

This commit is contained in:
LukePulverenti
2013-03-16 12:41:49 -04:00
parent 110ee00517
commit bae89ee824
13 changed files with 79 additions and 88 deletions

View File

@@ -64,6 +64,39 @@ namespace MediaBrowser.Controller.Drawing
return encoders.FirstOrDefault(i => i.MimeType.Equals(mimeType, StringComparison.OrdinalIgnoreCase)) ?? encoders.FirstOrDefault();
}
/// <summary>
/// Determines whether [is pixel format supported by graphics object] [the specified format].
/// </summary>
/// <param name="format">The format.</param>
/// <returns><c>true</c> if [is pixel format supported by graphics object] [the specified format]; otherwise, <c>false</c>.</returns>
public static bool IsPixelFormatSupportedByGraphicsObject(PixelFormat format)
{
// http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fromimage.aspx
if (format.HasFlag(PixelFormat.Indexed))
{
return false;
}
if (format.HasFlag(PixelFormat.Undefined))
{
return false;
}
if (format.HasFlag(PixelFormat.DontCare))
{
return false;
}
if (format.HasFlag(PixelFormat.Format16bppArgb1555))
{
return false;
}
if (format.HasFlag(PixelFormat.Format16bppGrayScale))
{
return false;
}
return true;
}
/// <summary>
/// Crops an image by removing whitespace and transparency from the edges
/// </summary>

View File

@@ -179,7 +179,7 @@ namespace MediaBrowser.Controller.Drawing
var newHeight = Convert.ToInt32(newSize.Height);
// Graphics.FromImage will throw an exception if the PixelFormat is Indexed, so we need to handle that here
var thumbnail = originalImage.PixelFormat.HasFlag(PixelFormat.Indexed) ? new Bitmap(originalImage, newWidth, newHeight) : new Bitmap(newWidth, newHeight, originalImage.PixelFormat);
var thumbnail = !ImageExtensions.IsPixelFormatSupportedByGraphicsObject(originalImage.PixelFormat) ? new Bitmap(originalImage, newWidth, newHeight) : new Bitmap(newWidth, newHeight, originalImage.PixelFormat);
// Preserve the original resolution
thumbnail.SetResolution(originalImage.HorizontalResolution, originalImage.VerticalResolution);

View File

@@ -20,7 +20,7 @@ namespace MediaBrowser.Controller.Library
/// Gets the active connections.
/// </summary>
/// <value>The active connections.</value>
IEnumerable<ClientConnectionInfo> ConnectedUsers { get; }
IEnumerable<ClientConnectionInfo> RecentConnections { get; }
/// <summary>
/// Occurs when [playback start].