about summary refs log tree commit diff
path: root/Sample
diff options
context:
space:
mode:
Diffstat (limited to 'Sample')
-rw-r--r--Sample/Client.cs19
-rw-r--r--Sample/Program.cs8
-rw-r--r--Sample/TokensSample.csproj (renamed from Sample/Sample.csproj)0
3 files changed, 14 insertions, 13 deletions
diff --git a/Sample/Client.cs b/Sample/Client.cs
index e9e286f..b756adf 100644
--- a/Sample/Client.cs
+++ b/Sample/Client.cs
@@ -1,10 +1,9 @@
-using System;
+using IrcTokens;
+using System;
 using System.Collections.Generic;
 using System.Net.Sockets;
-using System.Text;
-using IrcTokens;
 
-namespace Sample
+namespace TokensSample
 {
     public class Client
     {
@@ -25,15 +24,15 @@ namespace Sample
         {
             _socket.Connect("127.0.0.1", 6667);
 
-            Send(new Line {Command = "USER", Params = new List<string> {"username", "0", "*", "real name"}});
-            Send(new Line {Command = "NICK", Params = new List<string> {"statefulbot"}});
+            Send(new Line { Command = "USER", Params = new List<string> { "username", "0", "*", "real name" } });
+            Send(new Line { Command = "NICK", Params = new List<string> { "tokensbot" } });
 
             while (true)
             {
                 var bytesReceived = _socket.Receive(_bytes);
                 var lines = _decoder.Push(_bytes);
 
-                if (lines.Count == 0)
+                if (bytesReceived == 0)
                 {
                     Console.WriteLine("! disconnected");
                     _socket.Shutdown(SocketShutdown.Both);
@@ -47,10 +46,10 @@ namespace Sample
                     switch (line.Command)
                     {
                         case "PING":
-                            Send(new Line {Command = "PONG", Params = line.Params});
+                            Send(new Line { Command = "PONG", Params = line.Params });
                             break;
                         case "001":
-                            Send(new Line {Command = "JOIN", Params = new List<string> {"#channel"}});
+                            Send(new Line { Command = "JOIN", Params = new List<string> { "#channel" } });
                             break;
                     }
                 }
@@ -62,7 +61,9 @@ namespace Sample
             Console.WriteLine($"> {line.Format()}");
             _encoder.Push(line);
             while (_encoder.PendingBytes.Length > 0)
+            {
                 _encoder.Pop(_socket.Send(_encoder.PendingBytes));
+            }
         }
     }
 }
diff --git a/Sample/Program.cs b/Sample/Program.cs
index 6800179..eda312f 100644
--- a/Sample/Program.cs
+++ b/Sample/Program.cs
@@ -1,8 +1,8 @@
-using System;
+using IrcTokens;
+using System;
 using System.Collections.Generic;
-using IrcTokens;
 
-namespace Sample
+namespace TokensSample
 {
     public class Program
     {
@@ -17,7 +17,7 @@ namespace Sample
             var line2 = new Line
             {
                 Command = "USER",
-                Params = new List<string> {"user", "0", "*", "real name"}
+                Params = new List<string> { "user", "0", "*", "real name" }
             };
             Console.WriteLine(line2);
             Console.WriteLine(line2.Format());
diff --git a/Sample/Sample.csproj b/Sample/TokensSample.csproj
index 7c66734..7c66734 100644
--- a/Sample/Sample.csproj
+++ b/Sample/TokensSample.csproj