Exemplo n.º 1
0
        public static void Connected(MySQLConnection c)
        {
            if (c == null)
            {
                return;
            }

            Connections.Update(c);

            if (OnConnected != null)
            {
                OnConnected(c);
            }
        }
Exemplo n.º 2
0
        public static void Connected(MySQLConnection c)
        {
            if (c == null)
            {
                return;
            }

            Connections.AddOrReplace(c);

            if (OnConnected != null)
            {
                OnConnected(c);
            }
        }
Exemplo n.º 3
0
        public static bool CanConnect(MySQLConnection c, bool message = true)
        {
            if (c == null)
            {
                if (message)
                {
                    CSOptions.ToConsole("Connection invalid: The connection no longer exists.");
                }

                return(false);
            }

            if (c.HasError)
            {
                if (message)
                {
                    CSOptions.ToConsole("Connection invalid: The connection has errors.");
                }

                return(false);
            }

            if (c.Credentials == null || !c.Credentials.IsValid())
            {
                if (message)
                {
                    CSOptions.ToConsole("Connection invalid: The connection credentials are invalid.");
                }

                return(false);
            }

            if (Connections.Count >= CSOptions.MaxConnections)
            {
                if (message)
                {
                    CSOptions.ToConsole("Connection invalid: Max connection limit ({0:#,0}) reached.", CSOptions.MaxConnections);
                }

                return(false);
            }

            if (message)
            {
                CSOptions.ToConsole("Connection validated.");
            }

            return(true);
        }
Exemplo n.º 4
0
        public static void Disconnected(MySQLConnection c)
        {
            if (c == null)
            {
                return;
            }

            Connections.Remove(c);
            Connections.Free(false);

            if (OnDisconnected != null)
            {
                OnDisconnected(c);
            }
        }
Exemplo n.º 5
0
        public static void Disconnected(MySQLConnection c)
        {
            if (c == null)
            {
                return;
            }

            if (Connections.Contains(c))
            {
                Connections.Remove(c);
            }

            if (OnDisconnected != null)
            {
                OnDisconnected(c);
            }
        }
Exemplo n.º 6
0
        public static void Connected(MySQLConnection c)
        {
            if (c == null)
            {
                return;
            }

            if (!Connections.Contains(c))
            {
                Connections.Add(c);
            }

            if (OnConnected != null)
            {
                OnConnected(c);
            }
        }