using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace umbraco.presentation.ClientDependency
{
///
/// Wraps a HashSet object for the client dependency file type and declares a equality operator
///
public class ClientDependencyCollection : HashSet
{
public ClientDependencyCollection() : base(new ClientDependencyComparer()) { }
internal class ClientDependencyComparer : IEqualityComparer
{
#region IEqualityComparer Members
///
/// If the lowercased combination of the file path, dependency type and path name aliases are the same,
/// then they are the same dependency.
///
///
///
///
public bool Equals(IClientDependencyFile x, IClientDependencyFile y)
{
return (x.FilePath.ToLower().Trim() + x.DependencyType.ToString().ToLower() + x.PathNameAlias.ToLower().Trim() ==
y.FilePath.ToLower().Trim() + y.DependencyType.ToString().ToLower() + y.PathNameAlias.ToLower().Trim());
}
public int GetHashCode(IClientDependencyFile obj)
{
return (obj.FilePath.ToLower().Trim() + obj.DependencyType.ToString().ToLower() + obj.PathNameAlias.ToLower().Trim())
.GetHashCode();
}
#endregion
}
}
}