/// <summary> /// Constructor. /// </summary> internal EveServer() { m_status = ServerStatus.Online; m_monitor = new QueryMonitor<SerializableAPIServerStatus>(APIMethods.ServerStatus); m_monitor.Updated += OnMonitorUpdated; }
/// <summary> /// Constructor. /// </summary> internal EveServer() { m_status = ServerStatus.Online; m_serverStatusMonitor = new QueryMonitor<SerializableAPIServerStatus>(CCPAPIGenericMethods.ServerStatus, OnServerStatusMonitorUpdated) { Enabled = true }; EveMonClient.TimerTick += EveMonClient_TimerTick; }
/// <summary> /// Constructor. /// </summary> internal EveServer() { m_status = ServerStatus.Online; m_serverStatusMonitor = new QueryMonitor <EsiAPIServerStatus>(ESIAPIGenericMethods.ServerStatus, OnServerStatusMonitorUpdated) { Enabled = true }; EveMonClient.TimerTick += EveMonClient_TimerTick; }
///<summary>Currently only for user queries. The connection must already be opened before calling this method. ///Fills and returns a DataTable from the database. ///Throws an exception if a connection could not be found via the passed in server thread.</summary> public static DataTable GetTableConAlreadyOpen(int serverThread, string command, bool isSqlValidated) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetTable(MethodBase.GetCurrentMethod(), serverThread, command, isSqlValidated)); } //If the dictionary does not contain the ServerThread key, then something went wrong. Just stop and throw. MySqlConnection con; if (!_dictCons.TryGetValue(serverThread, out con)) { throw new ApplicationException("Critical error in GetTableConAlreadyOpen: A connection could not be found via the given server thread ID."); } if (!isSqlValidated && !Db.IsSqlAllowed(command)) //Throws Exception if Sql is not allowed, which is handled by the ExceptionThreadHandler and output in a MsgBox { throw new ApplicationException("Error: Command is either not safe or user does not have permission."); } //At this point, we know that _dictCons contains the current connection's ServerThread ID. DataTable table = new DataTable(); MySqlDataAdapter da = new MySqlDataAdapter(new MySqlCommand(command, con)); try { Db.LastCommand = command; QueryMonitor.RunMonitoredQuery(() => DataCore.ExecuteQueryFunc(() => da.Fill(table)), command ); } finally { con.Close(); //if the query was stopped or has finished executing, this will close the connection that it was executing on. lock (_lockObj) { _dictCons.Remove(serverThread); } } return(table); }