59 lines
1.4 KiB
C#
59 lines
1.4 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace JD.TeaBoxAddinSystem.Addins.Description
|
|
{
|
|
/// <summary>
|
|
/// Extension point collection.
|
|
/// </summary>
|
|
internal class ExtensionPointCollection : AddinObjectKeyedCollection<string, ExtensionPoint>
|
|
{
|
|
#region Inner Types
|
|
|
|
private class ExtensionPointPathEqualityComparer : IEqualityComparer<string>
|
|
{
|
|
#region IEqualityComparer<string> Members
|
|
|
|
public bool Equals(string x, string y)
|
|
{
|
|
x = ExtensionPoint.NormalizePath(x);
|
|
y = ExtensionPoint.NormalizePath(y);
|
|
|
|
return x == y;
|
|
}
|
|
|
|
public int GetHashCode(string obj)
|
|
{
|
|
return ExtensionPoint.NormalizePath(obj).GetHashCode();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
internal ExtensionPointCollection(Module owner)
|
|
: base(owner, new ExtensionPointPathEqualityComparer())
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
/// <summary>
|
|
/// Overriden.
|
|
/// </summary>
|
|
/// <param name="item"></param>
|
|
/// <returns></returns>
|
|
protected override string GetKeyForItem(ExtensionPoint item)
|
|
{
|
|
System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(item.Path));
|
|
|
|
return item.Path;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|