static void Main(string[] args)
{
SQLQueue = new MySqlConnection[10];
RandomSQL = new Random(new Guid().GetHashCode());
string connectionString = "server=localhost;uid=auxilium;pwd=123456;database=auxilium";
for (int i = 0; i < SQLQueue.Length; i++)
{
MySqlConnection msc = new MySqlConnection();
SQLQueue[i] = msc;
try
{
msc.ConnectionString = connectionString;
msc.Open();
}
catch (Exception)
{
Console.Write("An error occured connecting to the database.\nPlease enter your credentials.\n\nUsername: ");
string username = Console.ReadLine();
Console.Write("Password: ");
string password = Console.ReadLine();
msc.ConnectionString = (connectionString = string.Format("server=localhost;uid={0};pwd={1};database=auxilium", username, password));
msc.Open();
}
}
EmailClient = new SmtpClient
{
Host = "smtp.gmail.com",
Port = 587,
EnableSsl = true,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false
};
LetsDoThis();
Channels = new string[] { "Lounge" };
MOTD = GetMOTD();
Packer = new Pack();
Listener = new Server {BufferSize = 2048, MaxConnections = 1000};
Listener.ClientRead += ClientRead;
Listener.ClientState += ClientState;
Listener.ServerState += ServerState;
Listener.Listen(Port);
//Create the chat monitor timer.
ChatMonitor = new Timer(Monitor, null, 1000, 240000); //240,000 = 4 Minutes
LastBackup = DateTime.Now;
string console = string.Empty;
while (true)
{
char c = Console.ReadKey().KeyChar;
if (c == Convert.ToChar(ConsoleKey.Escape)) {
break;
} if (c == Convert.ToChar(ConsoleKey.Enter)) {
CheckCommand(null, console);
console = string.Empty;
} else {
console += c;
}
}
}