public DatabaseCommand(string query, DbConnection connection, Profiler profiler = null, params object[] arguments) { CommandProfiler = profiler; Query = string.Format(query, arguments); Command = connection.CreateCommand(); Command.CommandText = query; }
public Worker(EngineRegionProfile regionProfile, Configuration configuration, Database provider) { Profile = regionProfile; Provider = provider; WorkerProfiler = new Profiler(); ActiveAccountIds = new HashSet<int>(); Connection = Provider.GetConnection(); ConnectionData = new ConnectionProfile(configuration.Authentication, regionProfile.Region, configuration.Proxy, Profile.Username, Profile.Password); Connect(); }
void UpdateSummoner(SummonerDescription summoner, bool isNewSummoner) { AccountLock accountLock = Master.GetAccountLock(summoner.AccountId); Profiler profiler = new Profiler(true, string.Format("{0} {1} {2}", RegionProfile.Abbreviation, WorkerLogin.Username, summoner.Name)); lock (accountLock) { SummonerMessage("Updating", summoner); profiler.Start("RetrievePlayerStatsByAccountID"); PlayerLifeTimeStats lifeTimeStatistics = RPC.RetrievePlayerStatsByAccountID(summoner.AccountId, "CURRENT"); if (lifeTimeStatistics == null) { SummonerMessage("Unable to retrieve lifetime statistics", summoner); return; } profiler.Stop(); profiler.Start("GetAggregatedStats"); AggregatedStats aggregatedStatistics = RPC.GetAggregatedStats(summoner.AccountId, "CLASSIC", "CURRENT"); if (aggregatedStatistics == null) { SummonerMessage("Unable to retrieve aggregated statistics", summoner); return; } profiler.Stop(); profiler.Start("GetRecentGames"); RecentGames recentGameData = RPC.GetRecentGames(summoner.AccountId); if (recentGameData == null) { SummonerMessage("Unable to retrieve recent games", summoner); return; } profiler.Stop(); profiler.Start("SQL"); UpdateSummonerRatings(summoner, lifeTimeStatistics); UpdateSummonerRankedStatistics(summoner, aggregatedStatistics); UpdateSummonerGames(summoner, recentGameData); if (!isNewSummoner) { //This means that the main summoner entry must be updated UpdateSummonerLastModifiedTimestamp(summoner); } profiler.Stop(); Master.ReleaseAccountLock(summoner.AccountId, accountLock); } }
public Worker(EngineRegionProfile regionProfile, Login login, Configuration configuration, RegionHandler regionHandler, DatabaseConnectionProvider databaseProvider) { RegionProfile = regionProfile; WorkerLogin = login; WorkerProfiler = new Profiler(); JobEvent = new AutoResetEvent(false); Master = regionHandler; DatabaseProvider = databaseProvider; Database = DatabaseProvider.GetConnection(); ConnectionData = new ConnectionProfile(configuration.Authentication, regionProfile.Region, configuration.Proxy, login.Username, login.Password); Connect(); }
public WebService(Configuration configuration, StatisticsService statisticsService, DatabaseConnectionProvider databaseProvider) { ProgramConfiguration = configuration; ServiceConfiguration = configuration.Web; Statistics = statisticsService; Server = new WebServer(ServiceConfiguration.Host, ServiceConfiguration.Port, Observe); DatabaseProvider = databaseProvider; WebServiceProfiler = new Profiler(); Serialiser = new JavaScriptSerializer(); LoadChampionNames(); LoadItemInformation(); InitialiseHandlers(); }
public SQLCommand(string query, DbConnection connection, Profiler profiler = null, params object[] arguments) { CommandProfiler = profiler; Query = string.Format(query, arguments); // All logic assumes MySQL is the "edge case", and the fallback is postgre. if (connection is MySqlConnection) { Query = Query.Replace(":", "?").Replace("at time zone 'UTC'", ""); Query = cast_replace.Replace(Query, "$1"); SqlType = new SqlTypes(MySqlDbType.Int32, MySqlDbType.Text, MySqlDbType.Double, MySqlDbType.Bit, MySqlDbType.VarChar); } else { SqlType = new SqlTypes(NpgsqlDbType.Integer, NpgsqlDbType.Text, NpgsqlDbType.Double, NpgsqlDbType.Boolean, NpgsqlDbType.Varchar); } Command = DatabaseConnectionProvider.GetCommand(Query, connection); }
public WebService(Program program, Configuration configuration, StatisticsService statisticsService, Database databaseProvider) { Program = program; ProgramConfiguration = configuration; ServiceConfiguration = configuration.Web; StatisticsService = statisticsService; Server = new WebServer(ServiceConfiguration.Host, ServiceConfiguration.Port, Observe, ServiceConfiguration.EnableReverseProxyRealIPMode); DatabaseProvider = databaseProvider; WebServiceProfiler = new Profiler(); Serialiser = new JavaScriptSerializer(); Views = new HashSet<string>(); PRNG = new Random(); LoadIndex(); InitialiseHandlers(); }
public Worker(Program program, StatisticsService statisticsService, EngineRegionProfile regionProfile, Configuration configuration, Database provider) { Program = program; StatisticsService = statisticsService; Provider = provider; Configuration = configuration; Profile = regionProfile; Connected = false; Profiler = new Profiler(); ActiveAccountIds = new HashSet<int>(); Region = (RegionType)Profile.Identifier; AutomaticUpdateInterval = configuration.AutomaticUpdateInterval; InitialiseAuthenticationProfile(); }
public SQLCommand(string query, NpgsqlConnection connection, Profiler profiler = null, params object[] arguments) { CommandProfiler = profiler; Query = string.Format(query, arguments); Command = new NpgsqlCommand(Query, connection); }