#region --------------- Copyright Dresser Wayne Pignone -------------
/*
* $Log: /Wrk/WayneLibraries/Wrk/StateEngine/Description/ImageDescriptionAttribute.cs $
*
* 4 08-03-10 15:02 Mattias.larsson
* Changed parameter to GetDefaultImageFileName().
*
* 3 08-03-07 10:01 Mattias.larsson
* Added StateMachineDefaultMainImage.
*
* 2 07-03-29 9:10 Mattias.larsson
*/
#endregion
using System;
namespace Wayne.Lib.StateEngine
{
///
/// Adds a document image describing this state.
///
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public sealed class ImageDescriptionAttribute : Attribute
{
#region Fields
private string imageFileName;
private string description;
#endregion
#region Construction
///
/// Description of an image with its default file name and no description.
///
public ImageDescriptionAttribute()
{
this.description = "";
this.imageFileName = "";
}
///
/// Description of an image with its default file name.
///
/// The file name of the image.
/// Keep null or empty to use default state image filename.
public ImageDescriptionAttribute(string imageFileName)
{
this.imageFileName = imageFileName;
this.description = "";
}
///
/// Description of an image given a file name.
///
/// The file name of the image.
/// Keep null or empty to use default state image filename.
/// A descriptive text for the image.
public ImageDescriptionAttribute(string imageFileName, string description)
{
this.imageFileName = imageFileName;
this.description = description;
}
#endregion
#region Properties
///
/// The file name of the image.
///
public string ImageFileName
{
get { return imageFileName; }
}
///
/// A descriptive text for the image.
///
public string Description
{
get { return description; }
}
///
/// Gets the default filename (including relative path and extension) given a state.
///
///
///
public static string GetDefaultImageFileName(string factoryName)
{
return string.Concat(factoryName, DefaultImageFileExtension);
}
///
/// The default image filename extension.
///
///
public static string DefaultImageFileExtension
{
get { return ".png"; }
}
///
/// The default filename of the main image of the StateMachine.
///
///
public static string StateMachineDefaultMainImage
{
get { return string.Concat("MainStates", DefaultImageFileExtension); }
}
#endregion
}
}