示例#1
0
        static void Main(string[] args)
        {
            SQL = new MySqlConnection();
            SQL.ConnectionString = "server=localhost;uid=auxilium;pwd=123456;database=auxilium";
            SQL.Open();

            Channels = new string[] { "Lounge", "VB.NET", "C#" };

            Packer = new Pack();
            Listener = new Server();

            Listener.Size = 2048;
            Listener.Client_Read += Client_Read;
            Listener.MaxConnections = 10000;
            Listener.Client_State += Client_State;
            Listener.Server_State += Server_State;
            Listener.Listen(Port);

            while (true)
            {
                string str = string.Empty;
                if (Console.ReadKey().Key == ConsoleKey.Escape)
                    break;
                else if (!string.IsNullOrWhiteSpace(str = Console.ReadLine()))
                    ProcessCommand(str);
            }
        }
示例#2
0
        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: "******"Password: "******"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;
                }
            }
        }