using System;
using System.IO;
namespace HtmlHelp
{
///
/// Enumeration for specifying the mode of the information type
///
public enum InformationTypeMode
{
///
/// Inclusive information type. The user will be allowed to select from one or more information types.
///
Inclusive = 0,
///
/// Exclusive information type. The user will be allowed to choose only one information type within each category
///
Exclusive = 1,
///
/// Hidden information type. The user cannot see this information types (only for API calls).
///
Hidden = 2
}
///
/// The class InformationType implements a methods/properties for an information type.
///
/// Note: Information types and categories allow users to filter help contents.
/// They are only supported if using sitemap TOC and/or sitemap Index.
public class InformationType
{
private string _name = "";
private string _description = "";
private InformationTypeMode _typeMode = InformationTypeMode.Inclusive;
private bool _isInCategory = false;
private int _referenceCount = 1;
///
/// Standard constructor
///
/// the mode is set to InformationTypeMode.Inclusive by default
public InformationType() : this("","")
{
}
///
/// Standard constructor
///
/// name of the information type
/// description
/// the mode is set to InformationTypeMode.Inclusive by default
public InformationType(string name, string description) : this(name, description, InformationTypeMode.Inclusive)
{
}
///
/// Standard constructor
///
/// name of the information type
/// description
/// mode of the information type
public InformationType(string name, string description, InformationTypeMode mode)
{
_name = name;
_description = description;
_typeMode = mode;
}
#region Data dumping
///
/// Dump the class data to a binary writer
///
/// writer to write the data
internal void Dump(ref BinaryWriter writer)
{
writer.Write( (int)_typeMode );
writer.Write( _name );
writer.Write( _description );
}
///
/// Reads the object data from a dump store
///
/// reader to read the data
internal void ReadDump(ref BinaryReader reader)
{
_typeMode = (InformationTypeMode)reader.ReadInt32();
_name = reader.ReadString();
_description = reader.ReadString();
}
#endregion
///
/// Sets the flag if this information type is nested in at least one category
///
/// true or false
internal void SetCategoryFlag(bool newValue)
{
_isInCategory = newValue;
}
///
/// Gets/Sets the reference count of this information type instance
///
internal int ReferenceCount
{
get { return _referenceCount; }
set { _referenceCount = value; }
}
///
/// Gets true if this information type is nested in at least one category
///
public bool IsInCategory
{
get { return _isInCategory; }
}
///
/// Gets/Sets the name of the information type
///
public string Name
{
get { return _name; }
set { _name = value; }
}
///
/// Gets/Sets the description of the information type
///
public string Description
{
get { return _description; }
set { _name = value; }
}
///
/// Gets/Sets the mode of the information type
///
public InformationTypeMode Mode
{
get { return _typeMode; }
set { _typeMode = value; }
}
}
}