83 lines
1.9 KiB
C#
83 lines
1.9 KiB
C#
using System;
|
|
using JD.Collections.Interfaces;
|
|
using JD.Kernel.StaticHelpers;
|
|
|
|
namespace JD.TeaBoxAddinSystem.Addins.Description
|
|
{
|
|
/// <summary>
|
|
/// An extension is a collection of <see cref="ExtensionNodeDescription"/>s that extend a specific path in the addin tree.
|
|
/// </summary>
|
|
public sealed class Extension : AddinObject
|
|
{
|
|
#region Variables
|
|
|
|
private readonly string m_path;
|
|
private readonly ExtensionNodeDescriptionCollection m_extensionNodes = new ExtensionNodeDescriptionCollection();
|
|
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
/// <summary>
|
|
/// Constructor.
|
|
/// </summary>
|
|
/// <param name="path"></param>
|
|
public Extension(string path)
|
|
{
|
|
Throw.IfEmpty(path, "path");
|
|
m_path = ExtensionPoint.NormalizePath(path);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
/// <summary>
|
|
/// Path.
|
|
/// </summary>
|
|
public string Path
|
|
{
|
|
get
|
|
{
|
|
return m_path;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Extension Nodes.
|
|
/// </summary>
|
|
public IKeyedList<string, ExtensionNodeDescription> ExtensionNodes
|
|
{
|
|
get
|
|
{
|
|
return m_extensionNodes;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
/// <summary>
|
|
/// Overriden.
|
|
/// </summary>
|
|
/// <param name="e"></param>
|
|
internal override void OnModuleChanged(EventArgs e)
|
|
{
|
|
m_extensionNodes.Owner = Module;
|
|
|
|
base.OnModuleChanged(e);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Overriden.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public override string ToString()
|
|
{
|
|
return $"[Extension ({Path}): {ExtensionNodes.Count} nodes]";
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|