IRC parsing, tokenization, and state handling in C#
at 2c4e412c189ef54c181ffad96667232eaf80fcef 26 lines 729 B view raw
1using System; 2using System.Collections.Generic; 3using IrcTokens; 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 {Command = "USER", Params = new List<string> {"user", "0", "*", "real name"}}; 18 Console.WriteLine(line2); 19 Console.WriteLine(line2.Format()); 20 21 // stateful example 22 var client = new Client(); 23 client.Start(); 24 } 25 } 26}