fix some register issue
This commit is contained in:
@ -13,9 +13,7 @@ namespace PhotoThumbnail
|
|||||||
[ThumbnailProvider("TgaThumbnailer", ".tga", ThumbnailAdornment = ThumbnailAdornment.PhotoBorder)]
|
[ThumbnailProvider("TgaThumbnailer", ".tga", ThumbnailAdornment = ThumbnailAdornment.PhotoBorder)]
|
||||||
public class TgaThumbnailer : ThumbnailProvider, IThumbnailFromStream, IThumbnailFromFile
|
public class TgaThumbnailer : ThumbnailProvider, IThumbnailFromStream, IThumbnailFromFile
|
||||||
{
|
{
|
||||||
#region IThumbnailFromStream Members
|
private Bitmap GetBitmap(Stream stream, int sideSize)
|
||||||
|
|
||||||
public Bitmap ConstructBitmap(Stream stream, int sideSize)
|
|
||||||
{
|
{
|
||||||
Bitmap bitmap = TgaDecoder.FromStream(stream);
|
Bitmap bitmap = TgaDecoder.FromStream(stream);
|
||||||
|
|
||||||
@ -39,6 +37,16 @@ namespace PhotoThumbnail
|
|||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region IThumbnailFromStream Members
|
||||||
|
|
||||||
|
public Bitmap ConstructBitmap(Stream stream, int sideSize)
|
||||||
|
{
|
||||||
|
using (stream)
|
||||||
|
{
|
||||||
|
return GetBitmap(stream, sideSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IThumbnailFromFile Members
|
#region IThumbnailFromFile Members
|
||||||
@ -47,7 +55,7 @@ namespace PhotoThumbnail
|
|||||||
{
|
{
|
||||||
using (FileStream stream = File.OpenRead(info.FullName))
|
using (FileStream stream = File.OpenRead(info.FullName))
|
||||||
{
|
{
|
||||||
return ConstructBitmap(stream, sideSize);
|
return GetBitmap(stream, sideSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +339,7 @@ namespace ShellExtensions
|
|||||||
private static void ThrowIfNotValid(Type type)
|
private static void ThrowIfNotValid(Type type)
|
||||||
{
|
{
|
||||||
var interfaces = type.GetInterfaces();
|
var interfaces = type.GetInterfaces();
|
||||||
if (!interfaces.Any(x => x is IPreviewFromStream || x is IPreviewFromFile))
|
if (!interfaces.Any(x => x == typeof(IPreviewFromStream) || x == typeof(IPreviewFromFile)))
|
||||||
{
|
{
|
||||||
throw new NotImplementedException(
|
throw new NotImplementedException(
|
||||||
string.Format(System.Globalization.CultureInfo.InvariantCulture,
|
string.Format(System.Globalization.CultureInfo.InvariantCulture,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#if PREVIEW_HANDLER
|
#if PREVIEW_HANDLER_WINFORM
|
||||||
using ShellExtensions.Interop;
|
using ShellExtensions.Interop;
|
||||||
using ShellExtensions.Interop.Common;
|
using ShellExtensions.Interop.Common;
|
||||||
using ShellExtensions.Resources;
|
using ShellExtensions.Resources;
|
||||||
|
@ -200,9 +200,9 @@ namespace ShellExtensions
|
|||||||
}
|
}
|
||||||
|
|
||||||
var interfaces = type.GetInterfaces();
|
var interfaces = type.GetInterfaces();
|
||||||
bool interfaced = interfaces.Any(x => x is IThumbnailFromStream);
|
bool interfaced = interfaces.Any(x => x == typeof(IThumbnailFromStream));
|
||||||
|
|
||||||
if (interfaces.Any(x => x is IThumbnailFromFile))
|
if (interfaces.Any(x => x == typeof(IThumbnailFromFile)))
|
||||||
{
|
{
|
||||||
// According to MSDN (http://msdn.microsoft.com/en-us/library/cc144114(v=VS.85).aspx)
|
// According to MSDN (http://msdn.microsoft.com/en-us/library/cc144114(v=VS.85).aspx)
|
||||||
// A thumbnail provider that does not implement IInitializeWithStream must opt out of
|
// A thumbnail provider that does not implement IInitializeWithStream must opt out of
|
||||||
|
Reference in New Issue
Block a user