about summary refs log tree commit diff
path: root/IrcStates/ISupportPrefix.cs
blob: 94668e3bbc2d39c655795ddceb7318796a1954bf (plain) (blame)
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
using System.Collections.Generic;

namespace IrcStates
{
    public class ISupportPrefix
    {
        public ISupportPrefix(string splitVal)
        {
            var split = splitVal.Substring(1).Split(')', 2);
            Modes    = new List<string> {split[0]};
            Prefixes = new List<string> {split[1]};
        }

        public List<string> Modes { get; set; }
        public List<string> Prefixes { get; set; }

        public string FromMode(string mode)
        {
            return Modes.Contains(mode) ? Modes[Modes.IndexOf(mode)] : null;
        }

        public string FromPrefix(string prefix)
        {
            return Prefixes.Contains(prefix) ? Prefixes[Prefixes.IndexOf(prefix)] : null;
        }
    }
}