using System;
namespace PhotoThumbnail.Definitions
{
///
/// This class attribute is applied to a Thumbnail Provider to specify registration parameters
/// and aesthetic attributes.
///
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class ThumbnailProviderAttribute : Attribute
{
///
/// Creates a new instance of the attribute.
///
/// Name of the provider
/// Semi-colon-separated list of extensions supported by this provider.
public ThumbnailProviderAttribute(string name, string extensions)
{
Name = name ?? throw new ArgumentNullException("name");
Extensions = extensions ?? throw new ArgumentNullException("extensions");
DisableProcessIsolation = false;
ThumbnailCutoff = ThumbnailCutoffSize.Square20;
TypeOverlay = null;
ThumbnailAdornment = ThumbnailAdornment.Default;
}
///
/// Gets the name of the provider
///
public string Name { get; private set; }
///
/// Gets the semi-colon-separated list of extensions supported by the provider.
///
public string Extensions { get; private set; }
// optional parameters below.
///
/// Opts-out of running within the surrogate process DllHost.exe.
/// This will reduce robustness and security.
/// This value should be true if the provider does not implement .
///
// Note: The msdn documentation and property name are contradicting.
// http://msdn.microsoft.com/en-us/library/cc144118(VS.85).aspx
public bool DisableProcessIsolation { get; set; } // If true: Makes it run IN PROCESS.
///
/// Below this size thumbnail images will not be generated - file icons will be used instead.
///
public ThumbnailCutoffSize ThumbnailCutoff { get; set; }
///
/// A resource reference string pointing to the icon to be used as an overlay on the bottom right of the thumbnail.
/// ex. ISVComponent.dll@,-155
/// ex. C:\Windows\System32\SampleIcon.ico
/// If an empty string is provided, no overlay will be used.
/// If the property is set to null, the default icon for the associated icon will be used as an overlay.
///
public string TypeOverlay { get; set; }
///
/// Specifies the for the thumbnail.
///
/// Only 32bpp bitmaps support adornments.
/// While 24bpp bitmaps will be displayed, their adornments will not.
/// If an adornment is specified by the file-type's associated application,
/// the applications adornment will override the value specified in this registration.
///
public ThumbnailAdornment ThumbnailAdornment { get; set; }
}
///
/// Defines the minimum thumbnail size for which thumbnails will be generated.
///
public enum ThumbnailCutoffSize
{
///
/// Default size of 20x20
///
Square20 = -1, //For 20x20, you do not add any key in the registry
///
/// Size of 32x32
///
Square32 = 0,
///
/// Size of 16x16
///
Square16 = 1,
///
/// Size of 48x48
///
Square48 = 2,
///
/// Size of 16x16. An alternative to Square16.
///
Square16B = 3
}
///
/// Adornment applied to thumbnails.
///
public enum ThumbnailAdornment
{
///
/// This will use the associated application's default icon as the adornment.
///
Default = -1, // Default behaviour for no value added in registry
///
/// No adornment
///
None = 0,
///
/// Drop shadow adornment
///
DropShadow = 1,
///
/// Photo border adornment
///
PhotoBorder = 2,
///
/// Video sprocket adornment
///
VideoSprockets = 3
}
}