fix order of nick and user in example

This commit is contained in:
Ben Harris 2020-04-28 00:44:58 -04:00
parent 80afa2c0ae
commit f1c4ed9ae8
2 changed files with 15 additions and 22 deletions

View File

@ -1,16 +1,16 @@
using IrcTokens;
using System;
using System;
using System.Collections.Generic;
using System.Net.Sockets;
using IrcTokens;
namespace TokensSample
{
public class Client
{
private readonly Socket _socket;
private readonly byte[] _bytes;
private readonly StatefulDecoder _decoder;
private readonly StatefulEncoder _encoder;
private readonly byte[] _bytes;
private readonly Socket _socket;
public Client()
{
@ -24,8 +24,8 @@ namespace TokensSample
{
_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> {"tokensbot"}});
Send(new Line {Command = "USER", Params = new List<string> {"username", "0", "*", "real name"}});
while (true)
{
@ -60,10 +60,7 @@ namespace TokensSample
{
Console.WriteLine($"> {line.Format()}");
_encoder.Push(line);
while (_encoder.PendingBytes.Length > 0)
{
_encoder.Pop(_socket.Send(_encoder.PendingBytes));
}
while (_encoder.PendingBytes.Length > 0) _encoder.Pop(_socket.Send(_encoder.PendingBytes));
}
}
}

View File

@ -1,6 +1,6 @@
using IrcTokens;
using System;
using System;
using System.Collections.Generic;
using IrcTokens;
namespace TokensSample
{
@ -14,11 +14,7 @@ namespace TokensSample
Console.WriteLine(line.Format());
// formatting
var line2 = new Line
{
Command = "USER",
Params = new List<string> { "user", "0", "*", "real name" }
};
var line2 = new Line {Command = "USER", Params = new List<string> {"user", "0", "*", "real name"}};
Console.WriteLine(line2);
Console.WriteLine(line2.Format());