using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using BoogieBot.Common;
namespace BoogieBot.GUIApp
{
public partial class BoogieBot : Form
{
delegate void SetChatCallback(string username, string message, ChatMsg type, string from);
delegate void SetText(string text);
public void Display_Chat(string username, string message, ChatMsg type, string from)
{
string text = "";
string u = username;
string m = message;
ChatMsg t = type;
string c = from;
switch (t)
{
case ChatMsg.CHAT_MSG_SAY:
text = String.Format("<{0}> says: {1}\r\n", u, m);
main_tab.AddText(text);
break;
case ChatMsg.CHAT_MSG_WHISPER:
BoogieCore.Log(LogType.System, "Whisper!");
text = String.Format("[{0}] whispers: {1}\r\n", u, m);
int x = findTab(u);
if (x == 0)
{
ChatTab tab = new ChatTab(ChatMsg.CHAT_MSG_WHISPER, u);
tab.AddText(text);
this.channels_tab.Controls.Add(tab);
x = whispers_tabs_count + 1;
whispers_tabs[x] = tab;
whispers_tabs_count++;
}
else
{
ChatTab tab = whispers_tabs[x];
tab.AddText(text);
}
break;
case ChatMsg.CHAT_MSG_WHISPER_INFORM:
text = String.Format("To: [{0}]: {1}\r\n", u, m);
system_tab.AddText(text);
break;
case ChatMsg.CHAT_MSG_YELL:
text = String.Format("[{0}] yells: {1}\r\n", u, m);
main_tab.AddText(text);
break;
case ChatMsg.CHAT_MSG_CHANNEL:
text = String.Format("[{0}] <{1}>: {2}\r\n", c, u, m);
break;
case ChatMsg.CHAT_MSG_SYSTEM:
text = String.Format("SYSTEM: {0}\r\n", m);
this.system_tab.AddText(text);
break;
}
//AddText(text);
}
private void OnClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
this.Hide();
}
private void type_SelectedIndexChanged(object sender, EventArgs e)
{
//UpdateList();
}
public int findTab(string u)
{
int x = 1;
int y = 0;
while (x <= whispers_tabs_count)
{
if (whispers_tabs[x].name == u)
{
Log(LogType.System, "{0}", x);
Log(LogType.System, whispers_tabs[x].name);
y = x;
}
x++;
}
if (y > 0) return y;
else return 0;
}
}
}
enum Channel
{
}