jellyfin/MediaBrowser.Controller/Entities/LinkedChild.cs

42 lines
971 B
C#
Raw Normal View History

2013-07-05 06:47:10 -07:00
using System;
2013-10-03 08:24:32 -07:00
using System.Collections.Generic;
using System.Runtime.Serialization;
2013-07-05 06:47:10 -07:00
namespace MediaBrowser.Controller.Entities
{
public class LinkedChild
{
public string Path { get; set; }
public LinkedChildType Type { get; set; }
2013-10-03 08:24:32 -07:00
/// <summary>
/// Serves as a cache
/// </summary>
[IgnoreDataMember]
public Guid ItemId { get; set; }
2013-07-05 06:47:10 -07:00
}
public enum LinkedChildType
{
Manual = 1,
Shortcut = 2
}
2013-10-03 08:24:32 -07:00
public class LinkedChildComparer : IEqualityComparer<LinkedChild>
2013-07-05 06:47:10 -07:00
{
2013-10-03 08:24:32 -07:00
public bool Equals(LinkedChild x, LinkedChild y)
2013-07-05 06:47:10 -07:00
{
2013-10-03 08:24:32 -07:00
if (x.Type == y.Type)
2013-07-05 06:47:10 -07:00
{
2013-10-03 08:24:32 -07:00
return string.Equals(x.Path, y.Path, StringComparison.OrdinalIgnoreCase);
2013-07-05 06:47:10 -07:00
}
2013-10-03 08:24:32 -07:00
return false;
}
2013-07-05 06:47:10 -07:00
2013-10-03 08:24:32 -07:00
public int GetHashCode(LinkedChild obj)
{
return (obj.Path + obj.Type.ToString()).GetHashCode();
2013-07-05 06:47:10 -07:00
}
}
}