Example #1
0
 public PersonList(Database.Connection db)
     : base()
 {
     database = db;
     if (database == null)
         return;
     InitializeComponent();
 }
Example #2
0
        // ----------------------------------------------------------
        public Context()
        {
            database = new Database.Connection();
            Application.ApplicationExit += new EventHandler(this.OnApplicationExit);

            logging = new Logger.Logging();

            settingsForm = new UI.DBDialog(database);
            settingsForm.Closed += new EventHandler(this.settingsForm_Closed);
            settingsForm.Show();
        }
Example #3
0
    public static void Stop()
    {
        Development.Log("Stopping Server");

        if (TcpReady)
        {
            Development.Log("Shutting Down TCP Listener");
            tcpListener.Stop();
            tcpListener = null;
        }

        if (UdpReady)
        {
            Development.Log("Shutting Down UDP Listener");
            udpListener.Close();
            udpListener = null;
        }


        if (PacketsReady)
        {
            Development.Log("Clearing Packet Receivers");
            packetReceivers.Clear();
            packetReceivers = null;
        }

        if (ClientsReady)
        {
            // Setup Max Clients
            Development.Log("Clearing Client Connections");
            clients.Clear();
        }

        if (DatabaseReady)
        {
            Game.Save();
            Development.Log("Disconnected from MySQL");
            database.Disconnect();
            database = null;
        }

        Development.Log("Server Shutdown");
        IsReady = false;
        Development.Divider();
    }
Example #4
0
    public static void Start(int _maxPlayers, int _port)
    {
        Util.IniFile MyIni   = new Util.IniFile("Settings.ini");
        string       section = "MySQL";
        string       host    = MyIni.Read("Host", section);
        string       user    = MyIni.Read("Username", section);
        string       pass    = MyIni.Read("Password", section);
        string       db      = MyIni.Read("Database", section);

        database = new Database.Connection(host, db, user, pass, true);
        Development.Log("Starting Server");

        MaxPlayers = _maxPlayers;
        Port       = _port;

        // Setup Server Packets
        InitializeServerData();

        Development.Divider();
    }