IRC parsing, tokenization, and state handling in C#
at 338763fde71ba2dc0de8ea5e2437d24ee365874b 30 lines 781 B view raw
1using System; 2using System.Collections.Generic; 3using IrcTokens; 4 5namespace Sample 6{ 7 public class Program 8 { 9 public static void Main(string[] args) 10 { 11 // tokenization 12 var line = new Line("@id=123 :ben!~ben@hostname PRIVMSG #channel :hello there!"); 13 Console.WriteLine(line); 14 Console.WriteLine(line.Format()); 15 16 // formatting 17 var line2 = new Line 18 { 19 Command = "USER", 20 Params = new List<string> {"user", "0", "*", "real name"} 21 }; 22 Console.WriteLine(line2); 23 Console.WriteLine(line2.Format()); 24 25 // stateful example 26 var client = new Client(); 27 client.Start(); 28 } 29 } 30}