# C# based IRC application (with WPF as UI)

I would like to know how I could improve my C# project. I'm not really sure whether or not I'm allowed to just post a link to the Google Code project here, so sorry if it's not allowed, I'll edit my question if someone tells me so.

The reason I'm posting the entire project is because I would like to know if there's anything I can improve coding-wise (coding conventions I'm missing or misusing?), structural-wise (should anything be restructured, do I need to split it up in different classes etc?) and document-wise (how should I document my variables, methods, etc?).

Edit: Maybe I should explain a few things to save anyone who reads this some time. The project is split up in three "modules". The UI part of the application is in the "Source" folder, the core IRC library is in the "Library" folder and any plugins (that the UI module may load) are in the "Plugins" folder.

Edit2: I'll edit my question as a reply to the replies, this is a picture of the application: http://matthias.van-eeghem.com/data/simpleIRC.png

This is a small bit of code (as I apparently have to include that according to the FAQ):

/// <summary>
/// Called when the client receives the your hostName is event
/// </summary>
/// <param name="serverIndex">The server index</param>
/// <param name="hostName">The displayed hostName</param>
private void OnDisplayedHostReceived(int serverIndex, string hostName)
{
string Output = "Your displayed hostName is: " + hostName + "\r";
Core.ServerList[serverIndex].Logger.Log(Output);
ServerWindow.List[serverIndex].SendText(Output);

foreach (PluginInterface Plugin in MainWindow.PluginList) if(Plugin != null) Plugin.OnDisplayedHostReceived(serverIndex, hostName);
}

/// <summary>
/// Called when the server sends all the commands supported to the client
/// </summary>
/// <param name="serverIndex">The index of the server</param>
/// <param name="commandsSupported">The list of the commands supported</param>
private void OnCommandsSupportedReceived(int serverIndex, string commandsSupported)
{
string Output = "Supported: " + commandsSupported + "\r";
Core.ServerList[serverIndex].Logger.Log(Output);
ServerWindow.List[serverIndex].SendText(Output);

foreach (PluginInterface Plugin in MainWindow.PluginList) if(Plugin != null) Plugin.OnCommandsSupportedReceived(serverIndex, commandsSupported);
}

/// <summary>
/// Called when the client times out from the server
/// </summary>
/// <param name="serverIndex">The serverIndex</param>
private void OnClientTimeout(int serverIndex)
{
Server Server = Core.ServerList[serverIndex];
// Could not resolve hostName
string Output = "* Lost connection to " + Server.Hostname + "\r";
Core.ServerList[serverIndex].Logger.Log(Output);
ServerWindow.List[serverIndex].SendText(Output);

Output = "* Trying to reconnect..\r";
Core.ServerList[serverIndex].Logger.Log(Output);
ServerWindow.List[serverIndex].SendText(Output);

// Loop through all channels
for (int i = 0; i < Core.ChannelList.Count; i++)
{
Channel Channel = Core.ChannelList[i];
if(Channel != null && Channel.Server != null)
{
if (Channel.Server.Index == serverIndex)
{
Output = "* Lost connection to " + Server.Hostname + "\r";
Core.ServerList[serverIndex].Logger.Log(Output);
ChannelWindow.List[i].SendText(Output);
}
}
}

// Try reconnecting
Server.Connect();

foreach (PluginInterface Plugin in MainWindow.PluginList) if(Plugin != null) Plugin.OnClientTimeout(serverIndex);
}


I'd love any feedback for this code specifically but I'd also appreciate any comments in regards to the entire project structure etc.

-
Can we see some pics? –  Bryan Dunsmore Jun 3 '12 at 21:29