about summary refs log blame commit diff
path: root/IrcStates/ISupportPrefix.cs
blob: b319e04a124ba1213ba2377ed5005ac5dd6ab89c (plain) (tree)
1
2
3
4
5
6
7
8
9

                                 






                                              

                                                                                    


















                                                                                         
using System;
using System.Collections.Generic;

namespace IrcStates
{
    public class ISupportPrefix
    {
        public ISupportPrefix(string splitVal)
        {
            if (splitVal == null) throw new ArgumentNullException(nameof(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;
        }
    }
}