aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities/LinkedChild.cs
blob: edc5a7ac88f3305d63761d317f11c6d4af85197d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Collections;

namespace MediaBrowser.Controller.Entities
{
    public class LinkedChild
    {
        public string Path { get; set; }
        public LinkedChildType Type { get; set; }
    }

    public enum LinkedChildType
    {
        Manual = 1,
        Shortcut = 2
    }

    public class LinkedChildComparer : IComparer
    {
        public int Compare(object x, object y)
        {
            var a = (LinkedChild)x;

            var b = (LinkedChild)y;

            if (!string.Equals(a.Path, b.Path, StringComparison.OrdinalIgnoreCase))
            {
                return string.Compare(a.Path, b.Path, StringComparison.OrdinalIgnoreCase);
            }
            if (a.Type != b.Type)
            {
                return a.Type.CompareTo(b.Type);
            }

            return 0;
        }
    }
}