about summary refs log blame commit diff
path: root/IrcStates/ISupportPrefix.cs
blob: 94668e3bbc2d39c655795ddceb7318796a1954bf (plain) (tree)


























                                                                                         
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;
        }
    }
}