about summary refs log tree commit diff
path: root/IrcStates/ISupportPrefix.cs
diff options
context:
space:
mode:
Diffstat (limited to 'IrcStates/ISupportPrefix.cs')
-rw-r--r--IrcStates/ISupportPrefix.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/IrcStates/ISupportPrefix.cs b/IrcStates/ISupportPrefix.cs
new file mode 100644
index 0000000..94668e3
--- /dev/null
+++ b/IrcStates/ISupportPrefix.cs
@@ -0,0 +1,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;
+        }
+    }
+}