2013-08-20 18:17:06 -07:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
2013-08-27 12:13:11 -07:00
|
|
|
using NzbDrone.Common.EnvironmentInfo;
|
2014-12-01 22:26:25 -08:00
|
|
|
using NzbDrone.Common.Extensions;
|
2013-08-20 18:17:06 -07:00
|
|
|
|
|
|
|
namespace NzbDrone.Common
|
|
|
|
{
|
|
|
|
public class PathEqualityComparer : IEqualityComparer<String>
|
|
|
|
{
|
2013-11-30 16:33:59 -08:00
|
|
|
public static readonly PathEqualityComparer Instance = new PathEqualityComparer();
|
|
|
|
|
|
|
|
private PathEqualityComparer()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-08-20 18:17:06 -07:00
|
|
|
public bool Equals(string x, string y)
|
|
|
|
{
|
|
|
|
return x.PathEquals(y);
|
|
|
|
}
|
|
|
|
|
|
|
|
public int GetHashCode(string obj)
|
|
|
|
{
|
2014-12-07 12:54:07 -08:00
|
|
|
if (OsInfo.IsWindows)
|
2013-08-27 12:13:11 -07:00
|
|
|
{
|
2014-12-07 12:54:07 -08:00
|
|
|
return obj.CleanFilePath().ToLower().GetHashCode();
|
2013-08-27 12:13:11 -07:00
|
|
|
}
|
|
|
|
|
2014-12-07 12:54:07 -08:00
|
|
|
return obj.CleanFilePath().GetHashCode();
|
2013-08-20 18:17:06 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|