Esempio n. 1
0
 private void Savetimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     try
     {
         foreach (var conn in _connections.Values)
         {
             if (ConnectedToSQL)
             {
                 try
                 {
                     SqlInfo.UpdateUser(_connections[conn.UCID].UName, _connections[conn.UCID].PName, _connections[conn.UCID].TotalDistance, _connections[conn.UCID].points);
                 }
                 catch (Exception EX)
                 {
                     if (!SqlInfo.IsConnectionStillAlive())
                     {
                         ConnectedToSQL = false;
                         SQLReconnectTimer.Start();
                     }
                     LogTextToFile("sqlerror", "[" + conn.UCID + "] " + (_connections[conn.UCID].PName) + "(" + _connections[conn.UCID].UName + ") conn - Exception: " + EX.Message, false);
                 }
             }
         }
     }
     catch (Exception f)
     {
         MessageBox.Show("" + f.Message, "AN ERROR OCCURED");
     }
 }
Esempio n. 2
0
 private void Savetimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     try
     {
         foreach (var conn in _connections.Values)
         {
             if (ConnectedToSQL)
             {
                 try { SqlInfo.UpdateUser(_connections[conn.UCID].UName, StringHelper.StripColors(SqlInfo.RemoveStupidCharacters(_connections[conn.UCID].PName)), false, _connections[conn.UCID].cash, _connections[conn.UCID].bankbalance, _connections[conn.UCID].TotalDistance, _connections[conn.UCID].cars, _connections[conn.UCID].totaljobsdone, _connections[conn.UCID].totalearnedfromjobs, _connections[conn.UCID].Timezone, _connections[conn.UCID].KMHorMPH, _connections[conn.UCID].TotalConnectionTime); }
                 catch (Exception EX)
                 {
                     if (!SqlInfo.IsConnectionStillAlive())
                     {
                         SQL_label.Text = "MySQL : NOT CONNECTED!";
                         ConnectedToSQL = false;
                         SQLReconnectTimer.Start();
                     }
                     LogTextToFile("sqlerror", "[" + conn.UCID + "] " + StringHelper.StripColors(_connections[conn.UCID].PName) + "(" + _connections[conn.UCID].UName + ") conn - Exception: " + EX.Message, false);
                 }
             }
         }
     }
     catch (Exception f)
     {
         MessageBox.Show("" + f.Message, "AN ERROR OCCURED");
     }
 }
Esempio n. 3
0
        private void Savetimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                foreach (var c in _connections.Values)
                {
                    c.totalplaytime += 1;
                }

                foreach (var conn in _connections.Values)
                {
                    if (ConnectedToSQL)
                    {
                        try { SqlInfo.UpdateUser(_connections[conn.UCID].UName, StringHelper.StripColors(SqlInfo.RemoveStupidCharacters(_connections[conn.UCID].PName)),
                                                 false, _connections[conn.UCID].TotalDistance, _connections[conn.UCID].Timezone, _connections[conn.UCID].KMHorMPH, _connections[conn.UCID].Rank,
                                                 _connections[conn.UCID].Driftpoints, _connections[conn.UCID].timesCrashed, _connections[conn.UCID].timesChatted, _connections[conn.UCID].timesReset,
                                                 _connections[conn.UCID].timesJoined, _connections[conn.UCID].timesSpectated, _connections[conn.UCID].kmXRG, _connections[conn.UCID].kmLX4,
                                                 _connections[conn.UCID].kmLX6, _connections[conn.UCID].kmRB4, _connections[conn.UCID].kmFXO, _connections[conn.UCID].kmXRT, _connections[conn.UCID].kmRAC,
                                                 _connections[conn.UCID].kmFZ5, _connections[conn.UCID].totalplaytime); }
                        catch (Exception EX)
                        {
                            if (!SqlInfo.IsConnectionStillAlive())
                            {
                                ConnectedToSQL = false;
                                SQLReconnectTimer.Start();
                            }
                            LogTextToFile("sqlerror", "[" + conn.UCID + "] " + StringHelper.StripColors(_connections[conn.UCID].PName) + "(" + _connections[conn.UCID].UName + ") conn - Exception: " + EX.Message, false);
                        }
                    }
                }
            }
            catch (Exception f)
            {
                MessageBox.Show("" + f.Message, "AN ERROR OCCURED");
            }
        }