private void Awake() { if (Instance == null) { Instance = this; } }
public ChallongeTournament UpdateTournament(string tournamentUrl, TournamentCreation t) { var tournament = new JsonTournamentCreation(); tournament.json = t; return(ProcessJson <ChallongeTournament, JsonChallongeTournament>( JsonConvert.DeserializeObject <JsonChallongeTournament>( Send(tournament, "PUT", "/" + tournamentUrl) ) )); }
/** * public JsonChallongeTournament CreateTournament(ChallongeTournament t) * * Purpose: <summary>Creates a PGTournament using Challonge's API.</summary> * * Parameters: * TournamentCreation The TournamentCreation object to be passed to the Challonge's Website * * Return Value: * JsonChallongeTournament The processed object returned by the API * null In case a problem occurred, it will be logged by the API */ public ChallongeTournament CreateTournament(TournamentCreation t) { //Creates the wrapper for the send method var tournament = new JsonTournamentCreation(); tournament.json = t; return(ProcessJson <ChallongeTournament, JsonChallongeTournament>( JsonConvert.DeserializeObject <JsonChallongeTournament>( Send(tournament) ) )); }
public static void Run([TimerTrigger("0 0 12 * * 1")] TimerInfo myTimer, ILogger log) { log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}"); //Doing this way for now since the new version of the functions doesn't seem to play nice with the configuration manager ChallongeApiHelper.HttpHelper.ChallongeHttpHelper.setAuthorizationHeader(Environment.GetEnvironmentVariable("ApiUsername"), Environment.GetEnvironmentVariable("ApiPassword")); ChallongeApiHelper.SQLHelper.ChallongeSQLHelper.ChallongeSQLHelperConnectionString = Environment.GetEnvironmentVariable("dbConnection"); FrayDbCurrentWeek currentWeekInfo = ChallongeApiHelper.SQLHelper.ChallongeSQLHelper.GetCurrentWeekInfo(); TournamentCreation tournamentToCreate = new TournamentCreation() { name = $"QDAL Friday Fray - Week {currentWeekInfo.CurrentWeekNum.ToString()}", url = Guid.NewGuid().ToString().Replace("-", ""), tournament_type = TournamentConstants.TournamentType.SingleElimination, open_signup = true, hold_third_place_match = false, pts_for_game_win = 0.0m, pts_for_game_tie = 0.0m, pts_for_match_win = 1.0m, pts_for_match_tie = 0.5m, pts_for_bye = 1.0m, swiss_rounds = 0, @private = false, ranked_by = TournamentConstants.RankedBy.MatchWins, show_rounds = true, hide_forum = false, sequential_pairings = false, rr_pts_for_game_win = 0.0m, rr_pts_for_game_tie = 0.0m, rr_pts_for_match_win = 0.0m, rr_pts_for_match_tie = 0.0m, prediction_method = TournamentConstants.PredictionMethod.Exponential, game_id = TournamentConstants.GameId.PingPong }; var createdTournamnet = ChallongeApiHelper.HttpHelper.ChallongeHttpHelper.PostNewTournament(tournamentToCreate); ChallongeSQLHelper.SetCurrentSignupUrl(createdTournamnet.sign_up_url); ChallongeSQLHelper.SetCurrentTournamnetId(createdTournamnet.id); log.LogInformation("Weekly tournament scheduled succesfully"); }
public static TournamentRetrieval PostNewTournament(TournamentCreation newTournament) { var postResponse = Post("tournaments.json", newTournament); return(JsonConvert.DeserializeObject <TournamentHolderGarbage>(postResponse).tournament); }