IRC parsing, tokenization, and state handling in C#
at 933a4f85604e21445c9bac8272d64cf3e6f65e00 30 lines 789 B view raw
1using IrcTokens; 2using System; 3using System.Collections.Generic; 4 5namespace TokensSample 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}