Draky, thanks for posting it!
I'm not into Pointers yet, but its nice to have this code in C#. Thanks again!
But if you allow me, i'd like to make some comments about your C# code.
A
List<List<>> is basically a matrix, which is one of the worst programming techniques that you can use. It turns the code into a bloody mess.
As C# allows OOP, you definately should use it to make your code faster and readable.
Eg.:
I've created a class called
Channel which stores:
-Name of the Channel (eg.: "Server Log")
-A List<Message> with every message read from this Channel
Code:
public class Channel
{
public string Name { get; set; }
public List<Message> Messages { get; set; }
}
On the other hand,
Message class has the following properties:
Code:
public class Message
{
public Channel Channel { get; set; }
public byte Type { get; set; }
public string Sender { get; set; }
public string Text { get; set; }
public string Level { get; set; }
public string Time { get; set; }
}
Finally, my
ReadChannels function returns a List<Channel>, which makes it fareasier to read the channels and it's messages.
Code:
List<Channel> result = _client.ReadChannels();
foreach (Channel _channel in result)
{
Console.WriteLine(String.Concat("[", _channel.Name, "]"));
foreach (Message _msg in _channel.Messages)
{
Console.WriteLine(_msg.Text);
}
}
So, if you got interested on the improvements i've made, take a look at the project attached. I've create it on Visual Studio 2010.