private static void ProcessLadderJoins() { try { Status("Processing ladder joins", new object[0]); foreach (DataRecord record in new QuazalQuery("GetLadderJoinQueues", new object[0]).GetData()) { int entityId = int.Parse(record["entity_id"]); string entityName = record["entity_name"]; int ladderInstance = int.Parse(record["ladder_instance_id"]); DataAccess.FormatDate(DateTime.UtcNow); int @int = new QuazalQuery("GetNextLadderRank", new object[] { ladderInstance }).GetInt(); LadderInstance instance = LadderInstance.AllInstances[ladderInstance]; instance.LadderDefinition.Resolver.AddParticipant(entityId, entityName, ladderInstance, @int); } if (!new QuazalQuery("ClearLadderJoinQueues", new object[0]).ExecuteNonQuery()) { Error("Failed to clear ladder join queues after proessing them", new object[0]); } } catch (Exception exception) { Error("Processing ladder removals", new object[0]); Error(exception); } }
static PnlContentDetailsView() { DataList data = new QuazalQuery("GetPlayerContentRatings", new object[0]).GetData(); PlayerRatings = new Dictionary<int, int>(data.Count); foreach (DataRecord record in data) { PlayerRatings.Add(int.Parse(record["content_id"]), int.Parse(record["rating"])); } }
public static PlayerAvatar[] GetPlayerAvatars(int playerId) { PlayerAvatar item = new PlayerAvatar(); item.mPlayerID = playerId; item.mAvatarID = 0; MappedObjectList<PlayerAvatar> objects = new QuazalQuery("GetPlayerAvatarsByID", new object[] { playerId }).GetObjects<PlayerAvatar>(); objects.Insert(0, item); return objects.ToArray(); }
protected override void AdjustParticipantRank(LadderGameReport winnerReport, LadderGameReport loserReport) { GPG.Multiplayer.LadderService.LadderService.Status("Resolving game with HardcoreLadderReportResolver", new object[0]); GPG.Multiplayer.LadderService.LadderService.Status("Result of game {0} is entity: {1}({2}) defeated entity: {3}({4})", new object[] { winnerReport.GameID, winnerReport.EntityName, winnerReport.Rank, loserReport.EntityName, loserReport.Rank }); if (!new QuazalQuery("IncrementLadderWin", new object[] { winnerReport.EntityID, winnerReport.LadderInstanceID }).ExecuteNonQuery()) { GPG.Multiplayer.LadderService.LadderService.Error("Failed to increment win for entity: {0}({1}) on ladder: {2}", new object[] { winnerReport.EntityName, winnerReport.EntityID, winnerReport.LadderInstanceID }); } if (!new QuazalQuery("IncrementLadderLoss", new object[] { loserReport.EntityID, loserReport.LadderInstanceID }).ExecuteNonQuery()) { GPG.Multiplayer.LadderService.LadderService.Error("Failed to increment loss for entity: {0}({1}) on ladder: {2}", new object[] { loserReport.EntityName, loserReport.EntityID, loserReport.LadderInstanceID }); } int @int = new QuazalQuery("GetLastLadderRank", new object[] { loserReport.LadderInstanceID }).GetInt(); if (!new QuazalQuery("AdjustLadderParticipantTemp", new object[] { loserReport.LadderInstanceID, loserReport.EntityID }).ExecuteNonQuery()) { GPG.Multiplayer.LadderService.LadderService.Error("An error occured on step 1 while adjusting rank to end of ladder for loser {0} on ladder {1}", new object[] { loserReport.EntityID, loserReport.LadderInstanceID }); } else if (!new QuazalQuery("DecrementLadderAbove", new object[] { loserReport.LadderInstanceID, loserReport.Rank }).ExecuteNonQuery()) { GPG.Multiplayer.LadderService.LadderService.Error("An error occured on step 2 while adjusting rank to end of ladder for loser {0} on ladder {1}", new object[] { loserReport.EntityID, loserReport.LadderInstanceID }); } else if (!new QuazalQuery("AdjustLadderParticipant", new object[] { @int, loserReport.LadderInstanceID, loserReport.EntityID }).ExecuteNonQuery()) { GPG.Multiplayer.LadderService.LadderService.Error("An error occured on step 3 while adjusting rank to end of ladder for loser {0} on ladder {1}", new object[] { loserReport.EntityID, loserReport.LadderInstanceID }); } else { int num2 = new QuazalQuery("FindLadderStreakRank", new object[] { winnerReport.LadderInstanceID, winnerReport.LadderInstanceID, winnerReport.EntityID }).GetInt(); if (num2 <= 0) { num2 = 1; } else { num2++; } if (!new QuazalQuery("AdjustLadderParticipantTemp", new object[] { winnerReport.LadderInstanceID, winnerReport.EntityID }).ExecuteNonQuery()) { GPG.Multiplayer.LadderService.LadderService.Error("An error occured on step 4 while adjusting rank to {0} for winner {1} on ladder {2}", new object[] { num2, winnerReport.EntityID, winnerReport.LadderInstanceID }); } else if (!new QuazalQuery("IncrementLadderBetween", new object[] { winnerReport.LadderInstanceID, num2, winnerReport.Rank }).ExecuteNonQuery()) { GPG.Multiplayer.LadderService.LadderService.Error("An error occured on step 5 while adjusting rank to {0} for winner {1} on ladder {2}", new object[] { num2, winnerReport.EntityID, winnerReport.LadderInstanceID }); } else if (!new QuazalQuery("AdjustLadderParticipant", new object[] { num2, winnerReport.LadderInstanceID, winnerReport.EntityID }).ExecuteNonQuery()) { GPG.Multiplayer.LadderService.LadderService.Error("An error occured on step 6 while adjusting rank to {0} for winner {1} on ladder {2}", new object[] { num2, winnerReport.EntityID, winnerReport.LadderInstanceID }); } else { loserReport.Rank = @int; winnerReport.Rank = num2; } } }
public DlgLadderHistory(LadderParticipant participant, bool showCommentTab) { this.InitializeComponent(); this.mParticipant = participant; this.Text = string.Format(Loc.Get("<LOC>{0} - Ladder Activity History"), this.Participant.EntityName); LadderGameResult[] resultArray = new QuazalQuery("GetLadderParticipantHistory", new object[] { this.Participant.LadderInstanceID, this.Participant.EntityID }).GetObjects<LadderGameResult>().ToArray(); this.gpgDataGridHistory.DataSource = resultArray; this.gvLadder.RefreshData(); LadderParticipantComment[] commentArray = new QuazalQuery("GetLadderParticipantComments", new object[] { this.Participant.EntityID }).GetObjects<LadderParticipantComment>().ToArray(); this.dataGridComments.DataSource = commentArray; this.gvComments.RefreshData(); if (showCommentTab) { this.btnCommentsTab_Click(null, null); } }
public AccessControlListMember AddMember(int memberId, InclusionTypes inclusionType) { AccessControlListMember member2; if ((this.InclusionType == InclusionTypes.MemberDefined) && (inclusionType == InclusionTypes.Undefined)) { throw new Exception("Cannot add a member whos inclusionType is Undefined to an ACL whos inclusion type is MemberDefined."); } if ((this.InclusionType != InclusionTypes.MemberDefined) && (inclusionType != InclusionTypes.Undefined)) { ErrorLog.WriteLine("Ignoring member inclusion type because this ACL's inclusion type is not set to MemberDefined", new object[0]); } Cursor.Current = Cursors.WaitCursor; try { System.Guid guid = System.Guid.NewGuid(); if (new QuazalQuery("AddACLMember", new object[] { guid, this.ID, memberId, (int) inclusionType }).ExecuteNonQuery()) { AccessControlListMember member = new QuazalQuery("GetACLUserMemberByGuid", new object[] { guid }).GetObject<AccessControlListMember>(); DateTime now = DateTime.Now; while (member == null) { Thread.Sleep(50); member = new QuazalQuery("GetACLUserMemberByGuid", new object[] { guid }).GetObject<AccessControlListMember>(); if ((DateTime.Now - now) > TimeSpan.FromSeconds(5.0)) { break; } } if ((this.mMembers != null) && (member != null)) { Array.Resize<AccessControlListMember>(ref this.mMembers, this.mMembers.Length + 1); this.mMembers[this.mMembers.Length - 1] = member; } return member; } member2 = null; } finally { Cursor.Current = Cursors.Default; } return member2; }
private static void ProcessLadderDegradation() { try { Status("Processing ladder degradation", new object[0]); foreach (LadderInstance instance in LadderInstance.AllInstances.Values) { int? nullable = null; foreach (LadderDegradation degradation in instance.LadderDefinition.Degradation) { int num = 0; if (degradation.RankTo.HasValue) { num = degradation.RankTo.Value; } LadderParticipant[] participantArray = new QuazalQuery("GetLadderDegradeParticipants", new object[] { instance.ID, degradation.RankFrom, num, num, degradation.DegradeDayInterval, DateTime.UtcNow }).GetObjects<LadderParticipant>().ToArray(); foreach (LadderParticipant participant in participantArray) { Status("Degrading participant ID: {0}, Name: {1} on ladder: {2} based on degradation rules: {3}", new object[] { participant.EntityID, participant.EntityName, participant.LadderInstanceID, degradation.ID }); if (!nullable.HasValue) { nullable = new int?(new QuazalQuery("GetLastLadderRank", new object[] { instance.ID }).GetInt()); } participant.LadderInstance.LadderDefinition.Resolver.DegradeParticipant(participant, degradation, nullable.Value); } if ((participantArray.Length > 0) && !new QuazalQuery("ResetLadderDegradeParticipants", new object[] { DateTime.UtcNow, instance.ID, degradation.RankFrom, num, num, degradation.DegradeDayInterval, DateTime.UtcNow }).ExecuteNonQuery()) { Error("Failed to reset last degrade dates for participants on ladder: {0}", new object[] { instance.Description }); } } } } catch (Exception exception) { Error("Processing ladder degradation", new object[0]); Error(exception); } }
internal void JumpTo(string name) { try { int @int = new QuazalQuery("GetPlayerLadderRankByName", new object[] { this.Ladder.ID, name }).GetInt(); if (@int > 0) { this.JumpTo(@int); this.gvLadder.RefreshData(); } else { DlgMessage.ShowDialog(string.Format(Loc.Get("<LOC>Unable to locate a participant by the name {0}"), name)); } } catch (Exception exception) { ErrorLog.WriteLine(exception); } }
private void skinButtonRemovePlayer_Click(object sender, EventArgs e) { base.ClearErrors(); if (this.SelectedAvatar == null) { base.Error(this.gpgPictureBoxAvatar, "You must select an avatar", new object[0]); } else if ((this.gpgTextBoxPlayer.Text == null) || (this.gpgTextBoxPlayer.Text.Length < 1)) { base.Error(this.gpgTextBoxPlayer, "You must provide a player name", new object[0]); } else { int @int = new QuazalQuery("GetPlayerIDFromName", new object[] { this.gpgTextBoxPlayer.Text }).GetInt(); if (@int <= 0) { base.Error(this.gpgTextBoxPlayer, "Unable to locate {0}", new object[] { this.gpgTextBoxPlayer.Text }); } else if (new QuazalQuery("RemoveAvatarFromPlayer", new object[] { @int, this.SelectedAvatar.ID, @int, this.SelectedAvatar.ID }).ExecuteNonQuery()) { base.SetStatus("Avatar sucessfully removed from {0}", new object[] { this.gpgTextBoxPlayer.Text }); } else { base.SetStatus("Error removing avatar from {0}, they may not have it", new object[] { this.gpgTextBoxPlayer.Text }); } } }
public virtual void RegisterFullReport(LadderGameReport[] allParticipants) { if ((allParticipants == null) || (allParticipants.Length < 2)) { throw new Exception("The parameter allParticipants must contain all original participants in a game according to the participant_count field in the database."); } LadderGameReport winnerReport = allParticipants[0]; LadderGameReport loserReport = allParticipants[1]; GPG.Multiplayer.LadderService.LadderService.Status("Processing full report for game {0} between entities {1} and {2}", new object[] { winnerReport.GameID, winnerReport.EntityID, loserReport.EntityID }); if (winnerReport.IsWin && loserReport.IsLoss) { int rank = winnerReport.Rank; int opponentPreRank = loserReport.Rank; this.AdjustParticipantRank(winnerReport, loserReport); string reportDescription = string.Format("{0}({1}) reported a win, {2}({3}) reported a loss. Result of game is {0} wins.", new object[] { winnerReport.EntityName, rank, loserReport.EntityName, opponentPreRank }); this.RecordResult(winnerReport, loserReport, winnerReport.GameID, winnerReport.LadderInstanceID, reportDescription, rank, opponentPreRank, DateTime.UtcNow); reportDescription = string.Format("{0}({1}) reported a loss, {2}({3}) reported a win. Result of game is {2} wins.", new object[] { loserReport.EntityName, opponentPreRank, winnerReport.EntityName, rank }); this.RecordResult(loserReport, winnerReport, loserReport.GameID, loserReport.LadderInstanceID, reportDescription, opponentPreRank, rank, DateTime.UtcNow); } else if (winnerReport.IsLoss && loserReport.IsWin) { int preRank = winnerReport.Rank; int num4 = loserReport.Rank; this.AdjustParticipantRank(loserReport, winnerReport); string str2 = string.Format("{0}({1}) reported a loss, {2}({3}) reported a win. Result of game is {2} wins.", new object[] { winnerReport.EntityName, preRank, loserReport.EntityName, num4 }); this.RecordResult(winnerReport, loserReport, winnerReport.GameID, winnerReport.LadderInstanceID, str2, preRank, num4, DateTime.UtcNow); str2 = string.Format("{0}({1}) reported a win, {2}({3}) reported a loss. Result of game is {0} wins.", new object[] { loserReport.EntityName, num4, winnerReport.EntityName, preRank }); this.RecordResult(loserReport, winnerReport, loserReport.GameID, loserReport.LadderInstanceID, str2, num4, preRank, DateTime.UtcNow); } else if (winnerReport.IsDraw && loserReport.IsDraw) { this.OnDraw(winnerReport, loserReport); string str3 = string.Format("{0}({1}) reported a draw, {2}({3}) reported a draw. Result of game is draw.", new object[] { winnerReport.EntityName, winnerReport.Rank, loserReport.EntityName, loserReport.Rank }); this.RecordResult(winnerReport, loserReport, winnerReport.GameID, winnerReport.LadderInstanceID, str3, winnerReport.Rank, loserReport.Rank, DateTime.UtcNow); str3 = string.Format("{0}({1}) reported a draw, {2}({3}) reported a draw. Result of game is draw.", new object[] { loserReport.EntityName, loserReport.Rank, winnerReport.EntityName, winnerReport.Rank }); this.RecordResult(loserReport, winnerReport, loserReport.GameID, loserReport.LadderInstanceID, str3, loserReport.Rank, winnerReport.Rank, DateTime.UtcNow); } else { if (!new QuazalQuery("IncrementLadderConflictReportCount", new object[] { winnerReport.EntityID, winnerReport.LadderInstanceID }).ExecuteNonQuery()) { GPG.Multiplayer.LadderService.LadderService.Error("Failed to increment conflict report count for entity: {0}({1}) on ladder: {2}", new object[] { winnerReport.EntityName, winnerReport.EntityID, winnerReport.LadderInstanceID }); } if (!new QuazalQuery("IncrementLadderConflictReportCount", new object[] { loserReport.EntityID, loserReport.LadderInstanceID }).ExecuteNonQuery()) { GPG.Multiplayer.LadderService.LadderService.Error("Failed to increment conflict report count for entity: {0}({1}) on ladder: {2}", new object[] { loserReport.EntityName, loserReport.EntityID, loserReport.LadderInstanceID }); } if (winnerReport.IsDraw && loserReport.IsLoss) { this.OnDraw(winnerReport, loserReport); string str4 = string.Format("{0}({1}) reported a draw, {2}({3}) reported a loss. Result of game is draw.", new object[] { winnerReport.EntityName, winnerReport.Rank, loserReport.EntityName, loserReport.Rank }); this.RecordResult(winnerReport, loserReport, winnerReport.GameID, winnerReport.LadderInstanceID, str4, winnerReport.Rank, loserReport.Rank, DateTime.UtcNow); str4 = string.Format("{0}({1}) reported a loss, {2}({3}) reported a draw. Result of game is draw.", new object[] { loserReport.EntityName, loserReport.Rank, winnerReport.EntityName, winnerReport.Rank }); this.RecordResult(loserReport, winnerReport, loserReport.GameID, loserReport.LadderInstanceID, str4, loserReport.Rank, winnerReport.Rank, DateTime.UtcNow); } else if (winnerReport.IsLoss && loserReport.IsDraw) { this.OnDraw(winnerReport, loserReport); string str5 = string.Format("{0}({1}) reported a loss, {2}({3}) reported a draw. Result of game is draw.", new object[] { winnerReport.EntityName, winnerReport.Rank, loserReport.EntityName, loserReport.Rank }); this.RecordResult(winnerReport, loserReport, winnerReport.GameID, winnerReport.LadderInstanceID, str5, winnerReport.Rank, loserReport.Rank, DateTime.UtcNow); str5 = string.Format("{0}({1}) reported a draw, {2}({3}) reported a loss. Result of game is draw.", new object[] { loserReport.EntityName, loserReport.Rank, winnerReport.EntityName, winnerReport.Rank }); this.RecordResult(loserReport, winnerReport, loserReport.GameID, loserReport.LadderInstanceID, str5, loserReport.Rank, winnerReport.Rank, DateTime.UtcNow); } else { RatingsReport[] reportArray = new QuazalQuery("GetRatingsReportsByGameID", new object[] { winnerReport.GameID }).GetObjects<RatingsReport>().ToArray(); LadderDefinition ladderDefinition = winnerReport.LadderInstance.LadderDefinition; string str6 = "win"; if (winnerReport.IsLoss) { str6 = "loss"; } else if (winnerReport.IsDraw) { str6 = "draw"; } string str7 = "win"; if (loserReport.IsLoss) { str7 = "loss"; } else if (loserReport.IsDraw) { str7 = "draw"; } if (ladderDefinition.IsIndiviual) { if ((reportArray != null) && (reportArray.Length == 2)) { if ((reportArray[0].Outcome == RatingsReportOutcomes.Victory) && (reportArray[1].Outcome == RatingsReportOutcomes.Defeat)) { if (winnerReport.EntityID == reportArray[0].PlayerID) { int num5 = winnerReport.Rank; int num6 = loserReport.Rank; this.AdjustParticipantRank(winnerReport, loserReport); string str8 = string.Format("{0}({1}) reported a {2}, {3}({4}) reported a {5}. Conflict in report, using ratings report as fallback. Result of game is {0} wins.", new object[] { winnerReport.EntityName, num5, str6, loserReport.EntityName, num6, str7 }); this.RecordResult(winnerReport, loserReport, winnerReport.GameID, winnerReport.LadderInstanceID, str8, num5, num6, DateTime.UtcNow); str8 = string.Format("{0}({1}) reported a {2}, {3}({4}) reported a {5}. Conflict in report, using ratings report as fallback. Result of game is {3} wins.", new object[] { loserReport.EntityName, num6, str7, winnerReport.EntityName, num5, str6 }); this.RecordResult(loserReport, winnerReport, loserReport.GameID, loserReport.LadderInstanceID, str8, num6, num5, DateTime.UtcNow); } else if (loserReport.EntityID == reportArray[0].PlayerID) { int num7 = winnerReport.Rank; int num8 = loserReport.Rank; this.AdjustParticipantRank(loserReport, winnerReport); string str9 = string.Format("{0}({1}) reported a {2}, {3}({4}) reported a {5}. Conflict in report, using ratings report as fallback. Result of game is {3} wins.", new object[] { winnerReport.EntityName, num7, str6, loserReport.EntityName, num8, str7 }); this.RecordResult(winnerReport, loserReport, winnerReport.GameID, winnerReport.LadderInstanceID, str9, num7, num8, DateTime.UtcNow); str9 = string.Format("{0}({1}) reported a {2}, {3}({4}) reported a {5}. Conflict in report, using ratings report as fallback. Result of game is {0} wins.", new object[] { loserReport.EntityName, num8, str7, winnerReport.EntityName, num7, str6 }); this.RecordResult(loserReport, winnerReport, loserReport.GameID, loserReport.LadderInstanceID, str9, num8, num7, DateTime.UtcNow); } else { GPG.Multiplayer.LadderService.LadderService.Error("Ladder reports for game {0} conflicted, but the ratings reports conflicted as well resulting in no resolution.", new object[0]); string str10 = string.Format("{0}({1}) reported a {2}, {3}({4}) reported a {5}. Conflict in report, using ratings report as fallback. Not enough data was present in ratings report to determine an outcome. Result of game is inconclusive.", new object[] { winnerReport.EntityName, winnerReport.Rank, str6, loserReport.EntityName, loserReport.Rank, str7 }); this.RecordResult(winnerReport, loserReport, winnerReport.GameID, winnerReport.LadderInstanceID, str10, winnerReport.Rank, loserReport.Rank, DateTime.UtcNow); str10 = string.Format("{0}({1}) reported a {2}, {3}({4}) reported a {5}. Conflict in report, using ratings report as fallback. Not enough data was present in ratings report to determine an outcome. Result of game is inconclusive.", new object[] { loserReport.EntityName, loserReport.Rank, str7, winnerReport.EntityName, winnerReport.Rank, str6 }); this.RecordResult(loserReport, winnerReport, loserReport.GameID, loserReport.LadderInstanceID, str10, loserReport.Rank, winnerReport.Rank, DateTime.UtcNow); } } else if ((reportArray[0].Outcome == RatingsReportOutcomes.Defeat) && (reportArray[1].Outcome == RatingsReportOutcomes.Victory)) { if (winnerReport.EntityID == reportArray[1].PlayerID) { int num9 = winnerReport.Rank; int num10 = loserReport.Rank; this.AdjustParticipantRank(winnerReport, loserReport); string str11 = string.Format("{0}({1}) reported a {2}, {3}({4}) reported a {5}. Conflict in report, using ratings report as fallback. Result of game is {0} wins.", new object[] { winnerReport.EntityName, num9, str6, loserReport.EntityName, num10, str7 }); this.RecordResult(winnerReport, loserReport, winnerReport.GameID, winnerReport.LadderInstanceID, str11, num9, num10, DateTime.UtcNow); str11 = string.Format("{0}({1}) reported a {2}, {3}({4}) reported a {5}. Conflict in report, using ratings report as fallback. Result of game is {3} wins.", new object[] { loserReport.EntityName, num10, str7, winnerReport.EntityName, num9, str6 }); this.RecordResult(loserReport, winnerReport, loserReport.GameID, loserReport.LadderInstanceID, str11, num10, num9, DateTime.UtcNow); } else if (loserReport.EntityID == reportArray[1].PlayerID) { int num11 = winnerReport.Rank; int num12 = loserReport.Rank; this.AdjustParticipantRank(loserReport, winnerReport); string str12 = string.Format("{0}({1}) reported a {2}, {3}({4}) reported a {5}. Conflict in report, using ratings report as fallback. Result of game is {3} wins.", new object[] { winnerReport.EntityName, num11, str6, loserReport.EntityName, num12, str7 }); this.RecordResult(winnerReport, loserReport, winnerReport.GameID, winnerReport.LadderInstanceID, str12, num11, num12, DateTime.UtcNow); str12 = string.Format("{0}({1}) reported a {2}, {3}({4}) reported a {5}. Conflict in report, using ratings report as fallback. Result of game is {0} wins.", new object[] { loserReport.EntityName, num12, str7, winnerReport.EntityName, num11, str6 }); this.RecordResult(loserReport, winnerReport, loserReport.GameID, loserReport.LadderInstanceID, str12, num12, num11, DateTime.UtcNow); } else { GPG.Multiplayer.LadderService.LadderService.Error("Ladder reports for game {0} conflicted, but the ratings reports conflicted as well resulting in no resolution.", new object[] { winnerReport.GameID }); string str13 = string.Format("{0}({1}) reported a {2}, {3}({4}) reported a {5}. Conflict in report, using ratings report as fallback. Not enough data was present in ratings report to determine an outcome. Result of game is inconclusive.", new object[] { winnerReport.EntityName, winnerReport.Rank, str6, loserReport.EntityName, loserReport.Rank, str7 }); this.RecordResult(winnerReport, loserReport, winnerReport.GameID, winnerReport.LadderInstanceID, str13, winnerReport.Rank, loserReport.Rank, DateTime.UtcNow); str13 = string.Format("{0}({1}) reported a {2}, {3}({4}) reported a {5}. Conflict in report, using ratings report as fallback. Not enough data was present in ratings report to determine an outcome. Result of game is inconclusive.", new object[] { loserReport.EntityName, loserReport.EntityID, str7, winnerReport.EntityName, winnerReport.EntityID, str6 }); this.RecordResult(loserReport, winnerReport, loserReport.GameID, loserReport.LadderInstanceID, str13, loserReport.Rank, winnerReport.Rank, DateTime.UtcNow); } } else if ((reportArray[0].Outcome == RatingsReportOutcomes.Draw) && (reportArray[1].Outcome == RatingsReportOutcomes.Draw)) { this.OnDraw(winnerReport, loserReport); string str14 = string.Format("{0}({1}) reported a {2}, {3}({4}) reported a {5}. Conflict in report, using ratings report as fallback. Result of game is a draw.", new object[] { winnerReport.EntityName, winnerReport.Rank, str6, loserReport.EntityName, loserReport.Rank, str7 }); this.RecordResult(winnerReport, loserReport, winnerReport.GameID, winnerReport.LadderInstanceID, str14, winnerReport.Rank, loserReport.Rank, DateTime.UtcNow); str14 = string.Format("{0}({1}) reported a {2}, {3}({4}) reported a {5}. Conflict in report, using ratings report as fallback. Result of game is a draw.", new object[] { loserReport.EntityName, loserReport.Rank, str7, winnerReport.EntityName, winnerReport.Rank, str6 }); this.RecordResult(loserReport, winnerReport, loserReport.GameID, loserReport.LadderInstanceID, str14, loserReport.Rank, winnerReport.Rank, DateTime.UtcNow); } else { GPG.Multiplayer.LadderService.LadderService.Error("Ladder reports for game {0} conflicted, but the ratings reports conflicted as well resulting in no resolution.", new object[] { winnerReport.GameID }); string str15 = string.Format("{0}({1}) reported a {2}, {3}({4}) reported a {5}. Conflict in report, using ratings report as fallback. Not enough data was present in ratings report to determine an outcome. Result of game is inconclusive.", new object[] { winnerReport.EntityName, winnerReport.Rank, str6, loserReport.EntityName, loserReport.Rank, str7 }); this.RecordResult(winnerReport, loserReport, winnerReport.GameID, winnerReport.LadderInstanceID, str15, winnerReport.Rank, loserReport.Rank, DateTime.UtcNow); str15 = string.Format("{0}({1}) reported a {2}, {3}({4}) reported a {5}. Conflict in report, using ratings report as fallback. Not enough data was present in ratings report to determine an outcome. Result of game is inconclusive.", new object[] { loserReport.EntityName, loserReport.Rank, str7, winnerReport.EntityName, winnerReport.Rank, str6 }); this.RecordResult(loserReport, winnerReport, loserReport.GameID, loserReport.LadderInstanceID, str15, loserReport.Rank, winnerReport.Rank, DateTime.UtcNow); } } else { GPG.Multiplayer.LadderService.LadderService.Error("Ladder reports for game {0} conflicted, but the ratings reports conflicted as well resulting in no resolution.", new object[] { winnerReport.GameID }); string str16 = string.Format("{0}({1}) reported a {2}, {3}({4}) reported a {5}. Conflict in report, using ratings report as fallback. Not enough data was present in ratings report to determine an outcome. Result of game is inconclusive.", new object[] { winnerReport.EntityName, winnerReport.Rank, str6, loserReport.EntityName, loserReport.Rank, str7 }); this.RecordResult(winnerReport, loserReport, winnerReport.GameID, winnerReport.LadderInstanceID, str16, winnerReport.Rank, loserReport.Rank, DateTime.UtcNow); str16 = string.Format("{0}({1}) reported a {2}, {3}({4}) reported a {5}. Conflict in report, using ratings report as fallback. Not enough data was present in ratings report to determine an outcome. Result of game is inconclusive.", new object[] { loserReport.EntityName, loserReport.Rank, str7, winnerReport.EntityName, winnerReport.Rank, str6 }); this.RecordResult(loserReport, winnerReport, loserReport.GameID, loserReport.LadderInstanceID, str16, loserReport.Rank, winnerReport.Rank, DateTime.UtcNow); } } else if (!ladderDefinition.IsClan && !ladderDefinition.IsTeam) { throw new Exception("Ladder is not defined as type: individual, clan or team. It must fall under one of these categories for reporting conflict resolution."); } } } }
public bool FromID(int contentId, out IAdditionalContent content) { Mod mod; if (!base.ContentType.CurrentUserCanUpload) { content = null; return false; } bool flag = new QuazalQuery("GetModById", new object[] { contentId }).GetObject<Mod>(out mod); content = mod; return flag; }
public IAdditionalContent[] GetMyUploads() { if (!base.ContentType.CurrentUserCanUpload) { return new IAdditionalContent[0]; } MappedObjectList<CustomMap> objects = new QuazalQuery("GetMyUploadedMaps", new object[0]).GetObjects<CustomMap>(); if (objects == null) { return new CustomMap[0]; } return objects.ToArray(); }
public IAdditionalContent[] GetMyDownloads() { if (!base.ContentType.CurrentUserCanDownload) { return new IAdditionalContent[0]; } QuazalQuery query = new QuazalQuery("GetMyDownloadedMaps", new object[0]); return query.GetObjects<CustomMap>().ToArray(); }
private void JoinGame() { if (this.SelectedGame != null) { bool flag = false; MappedObjectList<HostedGame> objects = new QuazalQuery("GetHostedSpaceSiegeGames", new object[0]).GetObjects<HostedGame>(); foreach (HostedGame game in objects) { if (game.ID == this.SelectedGame.ID) { flag = true; break; } } if (!flag) { DlgMessage.ShowDialog(Loc.Get("<LOC>The game has been started and you can no longer join."), Loc.Get("<LOC>Warning")); } else if (this.SelectedGame.Password != "") { DialogResult result; if (this.SelectedGame.Password == DlgAskQuestion.AskQuestion(base.MainForm, Loc.Get("<LOC>This game is password protected, please enter the password below."), Loc.Get("<LOC>Password"), true, out result)) { base.MainForm.AcceptGameInvite(this.SelectedGame.HostName); base.DialogResult = DialogResult.OK; base.Close(); } else if (result != DialogResult.Cancel) { DlgMessage.ShowDialog(Loc.Get("<LOC>Incorrect password. Please try again.")); } } else { base.MainForm.AcceptGameInvite(this.SelectedGame.HostName); base.DialogResult = DialogResult.OK; base.Close(); } } }
private void UpdateComments() { WaitCallback callBack = null; MappedObjectList<ContentComment> comments = new QuazalQuery("GetContentComments", new object[] { this.Content.ID }).GetObjects<ContentComment>(); if ((this.CommentCount > -1) && (comments.Count != this.CommentCount)) { if (callBack == null) { callBack = delegate (object s) { VGen0 method = null; try { int num = 0; do { Thread.Sleep(0x3e8); num++; comments = new QuazalQuery("GetContentComments", new object[] { this.Content.ID }).GetObjects<ContentComment>(); } while ((comments.Count != this.CommentCount) && (num < 2)); if (comments.Count == this.CommentCount) { if (method == null) { method = delegate { this.UpdateComments(comments); }; } this.BeginInvoke(method); } else { ErrorLog.WriteLine("Did insert on master db and failed to get propogated data after 3000ms.", new object[0]); } } catch (Exception exception) { ErrorLog.WriteLine(exception); ErrorLog.WriteLine("Did insert on master db and failed to get propogated data after 3000ms.", new object[0]); } }; } ThreadPool.QueueUserWorkItem(callBack); } else { this.CommentCount = comments.Count; this.UpdateComments(comments); } }
public static AccessControlList Create(string name, string description, AccessControlListTypes listType, InclusionTypes inclusionType, int access, string tag) { AccessControlList list2; Cursor.Current = Cursors.WaitCursor; try { System.Guid guid = System.Guid.NewGuid(); if (new QuazalQuery("CreateACL", new object[] { guid, name, description, (int) listType, (int) inclusionType, access, tag }).ExecuteNonQuery()) { AccessControlList list = new QuazalQuery("GetACLByGuid", new object[] { guid }).GetObject<AccessControlList>(); DateTime now = DateTime.Now; while (list == null) { Thread.Sleep(50); list = new QuazalQuery("GetACLByGuid", new object[] { guid }).GetObject<AccessControlList>(); if ((DateTime.Now - now) > TimeSpan.FromSeconds(5.0)) { break; } } if (list != null) { All.Add(list.ID, list); } return list; } list2 = null; } finally { Cursor.Current = Cursors.Default; } return list2; }
private void miAdming_AddPlayerAwards_Click(object sender, EventArgs e) { DialogResult result; string str = DlgAskQuestion.AskQuestion(this, "What is the player's name?", "", false, out result); int @int = new QuazalQuery("GetPlayerIDFromName", new object[] { str }).GetInt(); if (@int > 0) { new QuazalQuery("AddPlayerPendingAwards", new object[] { @int }).ExecuteNonQuery(); } }
private static void ProcessLadderReports() { try { Status("Processing game reports", new object[0]); Dictionary<int, List<LadderGameReport>> dictionary = new Dictionary<int, List<LadderGameReport>>(); foreach (LadderGameReport report in new QuazalQuery("GetLadderReports", new object[0]).GetObjects<LadderGameReport>().ToArray()) { if (!dictionary.ContainsKey(report.GameID)) { dictionary[report.GameID] = new List<LadderGameReport>(); } dictionary[report.GameID].Add(report); } Dictionary<int, string> dictionary2 = new Dictionary<int, string>(dictionary.Count * 2); List<int> list = new List<int>(); string str = ""; string str2 = ""; string str3 = ""; int num = 0; foreach (List<LadderGameReport> list2 in dictionary.Values) { try { Dictionary<int, string> dictionary3; if (list2.Count < 1) { continue; } if (list2.Count != 1) { goto Label_0542; } TimeSpan span = (TimeSpan) (DateTime.UtcNow - DateTime.SpecifyKind(list2[0].ReportDate, DateTimeKind.Utc)); if (span.TotalMinutes < ConfigSettings.GetDouble("LadderGameReportTimeout", 15.0)) { continue; } Status("Processing report for game {0}", new object[] { list2[0].GameID }); LadderGameReport[] allParticipants = new QuazalQuery("GetGameSessionMembersByGameID", new object[] { list2[0].GameID }).GetObjects<LadderGameReport>().ToArray(); if (allParticipants.Length < 2) { Error("Failed to find all members of game {0} on ladder {1}", new object[] { list2[0].GameID, list2[0].LadderInstanceID }); str = str + str3 + list2[0].GameID.ToString(); str3 = ","; num++; continue; } if (list.Contains(list2[0].LadderInstanceID)) { if (allParticipants[0].EntityID == list2[0].EntityID) { list2[0].Rank = allParticipants[0].Rank; goto Label_02EB; } if (allParticipants[1].EntityID == list2[0].EntityID) { list2[0].Rank = allParticipants[1].Rank; goto Label_02EB; } Error("Failed to find reporting member {0} of game {1} on ladder {2}", new object[] { list2[0].EntityID, list2[0].GameID, list2[0].LadderInstanceID }); list2.Clear(); continue; } list.Add(list2[0].LadderInstanceID); Label_02EB: list2[0].LadderInstance.LadderDefinition.Resolver.RegisterPartialReport(allParticipants, list2[0]); if (!dictionary2.ContainsKey(list2[0].LadderInstanceID)) { dictionary2[list2[0].LadderInstanceID] = ""; } if (allParticipants[0].IsAutomatch && allParticipants[1].IsAutomatch) { int num6; (dictionary3 = dictionary2)[num6 = list2[0].LadderInstanceID] = dictionary3[num6] + str3 + allParticipants[0].EntityID.ToString() + "," + allParticipants[1].EntityID.ToString(); string str5 = str2; str2 = str5 + str3 + allParticipants[0].EntityID.ToString() + "," + allParticipants[1].EntityID.ToString(); } else if (allParticipants[0].Rank < allParticipants[1].Rank) { Dictionary<int, string> dictionary4; int num11; (dictionary4 = dictionary2)[num11 = list2[0].LadderInstanceID] = dictionary4[num11] + str3 + allParticipants[0].EntityID.ToString(); str2 = str2 + str3 + allParticipants[0].EntityID.ToString(); } else if (allParticipants[1].Rank < allParticipants[0].Rank) { Dictionary<int, string> dictionary5; int num14; (dictionary5 = dictionary2)[num14 = list2[0].LadderInstanceID] = dictionary5[num14] + str3 + allParticipants[1].EntityID.ToString(); str2 = str2 + str3 + allParticipants[1].EntityID.ToString(); } str = str + str3 + list2[0].GameID.ToString(); str3 = ","; num++; continue; Label_0542: if (list2.Count == 2) { Status("Processing report for game {0}", new object[] { list2[0].GameID }); if (list.Contains(list2[0].LadderInstanceID)) { list2[0].Rank = new QuazalQuery("GetPlayerLadderRankByID", new object[] { list2[0].LadderInstanceID, list2[0].EntityID }).GetInt(); list2[1].Rank = new QuazalQuery("GetPlayerLadderRankByID", new object[] { list2[1].LadderInstanceID, list2[1].EntityID }).GetInt(); } else { list.Add(list2[0].LadderInstanceID); } LadderGameReport[] reportArray2 = list2.ToArray(); list2[0].LadderInstance.LadderDefinition.Resolver.RegisterFullReport(reportArray2); if (!dictionary2.ContainsKey(list2[0].LadderInstanceID)) { dictionary2[list2[0].LadderInstanceID] = ""; } if (reportArray2[0].IsAutomatch && reportArray2[1].IsAutomatch) { Dictionary<int, string> dictionary6; int num18; (dictionary6 = dictionary2)[num18 = list2[0].LadderInstanceID] = dictionary6[num18] + str3 + reportArray2[0].EntityID.ToString() + "," + reportArray2[1].EntityID.ToString(); string str7 = str2; str2 = str7 + str3 + reportArray2[0].EntityID.ToString() + "," + reportArray2[1].EntityID.ToString(); } else { int num5; if (reportArray2[0].Rank < reportArray2[1].Rank) { (dictionary3 = dictionary2)[num5 = list2[0].LadderInstanceID] = dictionary3[num5] + str3 + reportArray2[0].EntityID.ToString(); str2 = str2 + str3 + reportArray2[0].EntityID.ToString(); } else if (reportArray2[1].Rank < reportArray2[0].Rank) { (dictionary3 = dictionary2)[num5 = list2[0].LadderInstanceID] = dictionary3[num5] + str3 + reportArray2[1].EntityID.ToString(); str2 = str2 + str3 + reportArray2[1].EntityID.ToString(); } } str = str + str3 + list2[0].GameID.ToString(); str3 = ","; num++; } else { Error("Processing game reports", new object[0]); Error("Reached an unknown state while processing ladder reports.", new object[0]); } continue; } catch (Exception exception) { Error("An error occured while processing report for game: {0}", new object[] { list2[0].GameID }); Error(exception); continue; } } if (num > 0) { Status("Removing processed games from the system: {0}", new object[] { str }); if (!new QuazalQuery("RemoveProcessedLadderReports", new object[] { str }).ExecuteNonQuery()) { Error("Failed to remove processed game reports: {0}", new object[] { str }); } if (!new QuazalQuery("RemoveProcessedLadderSessions", new object[] { str }).ExecuteNonQuery()) { Error("Failed to remove processed game sessions: {0}", new object[] { str }); } Status("Resetting degrade timer for entities: {0}", new object[] { str2 }); foreach (int num3 in dictionary2.Keys) { if (!new QuazalQuery("SetLastLadderGame", new object[] { DateTime.UtcNow, DateTime.UtcNow, num3, dictionary2[num3] }).ExecuteNonQuery()) { Error("Failed to update last game date for entities: {0}", new object[] { dictionary2[num3] }); } } } } catch (Exception exception2) { Error("Processing game reports", new object[0]); Error(exception2); } }
private static void ProcessLadderRemovals() { try { Status("Processing ladder removals", new object[0]); LadderParticipant participant = new QuazalQuery("GetLadderParticipantRemovals", new object[] { DateTime.UtcNow, ConfigSettings.GetInt("LadderJoinIdleLimitDays", 3) }).GetObject<LadderParticipant>(); while (participant != null) { Status("Removing participant ID: {0}, Name: {1} from ladder: {2}", new object[] { participant.EntityID, participant.EntityName, participant.LadderInstanceID }); if (!new QuazalQuery("RemoveFromLadder", new object[] { participant.EntityID, participant.LadderInstanceID }).ExecuteNonQuery()) { Error("Failed to remove participant ID: {0}, Name: {1} from ladder: {2}", new object[] { participant.EntityID, participant.EntityName, participant.LadderInstanceID }); return; } string str = string.Format("{0}(rank {1}) has left ladder: {2}", participant.EntityName, participant.Rank, participant.LadderInstance.Description); if (!new QuazalQuery("CreateLadderGameResult", new object[] { participant.EntityID, "NULL", "NULL", participant.LadderInstanceID, str, participant.Rank, 0, DateTime.UtcNow }).ExecuteNonQuery()) { Error("Failed to record ladder removal audit record for player: {0}(rank {1})", new object[] { participant.EntityName, participant.Rank }); } if (!new QuazalQuery("DecrementLadderAbove", new object[] { participant.LadderInstanceID, participant.Rank }).ExecuteNonQuery()) { Error("Failed to decrement ladder members above rank {0} on ladder {1} when removing participant ID: {2}, Name: {3}", new object[] { participant.Rank, participant.LadderInstanceID, participant.EntityID, participant.EntityName }); return; } participant = new QuazalQuery("GetLadderParticipantRemovals", new object[] { DateTime.UtcNow, ConfigSettings.GetInt("LadderJoinIdleLimitDays", 3) }).GetObject<LadderParticipant>(); Thread.Sleep(20); } } catch (Exception exception) { Error("Processing ladder removals", new object[0]); Error(exception); } }
private void skinButtonOK_Click(object sender, EventArgs e) { try { string selectedItem = (string) this.comboBoxName.SelectedItem; if ((selectedItem == null) || (selectedItem.Length < 1)) { base.Error(this.comboBoxName, "You must provide a player name", new object[0]); } else { int @int = new QuazalQuery("GetPlayerIDFromName", new object[] { selectedItem }).GetInt(); if (@int <= 0) { base.Error(this.comboBoxName, "Unable to locate {0}", new object[] { selectedItem }); } else { int num2 = (int) this.numericUpDownPoints.Value; if (new DlgYesNo(base.MainForm, "Confirm", string.Format(Loc.Get("<LOC>Are you sure you want to remove {0} honor points from {1}?"), num2, selectedItem)).ShowDialog() == DialogResult.Yes) { if (new QuazalQuery("RemoveHonorPoints", new object[] { num2, @int }).ExecuteNonQuery()) { DlgMessage.ShowDialog("<LOC>Honor points successfully adjusted, informing player."); Messaging.SendCustomCommand(selectedItem, CustomCommands.SystemMessage, new object[] { "<LOC>You have lost {0} tournament honor points.", num2 }); base.DialogResult = DialogResult.OK; base.Close(); } else { DlgMessage.ShowDialog("<LOC>An error occured adjusting this players honor points."); base.DialogResult = DialogResult.Cancel; base.Close(); } } } } } catch (Exception exception) { ErrorLog.WriteLine(exception); DlgMessage.ShowDialog("<LOC>An error occured adjusting this players honor points."); base.DialogResult = DialogResult.Cancel; base.Close(); } }
private void RefreshDataSynchronous() { DataList data; int num = this.CurrentPage * PAGE_SIZE; int num2 = (this.CurrentPage + 1) * PAGE_SIZE; if (this.IsViewingChallengers) { data = new QuazalQuery("GetLadderChallengers", new object[] { this.Ladder.ID, num, num2 }).GetData(); this.OnRefreshData(data); } else { data = new QuazalQuery("GetLadderParticipants", new object[] { this.Ladder.ID, num, num2 }).GetData(); this.OnRefreshData(data); } }
internal void OnLeaveClan() { WaitCallback callBack = null; try { if (Clan.Current != null) { if (new DlgYesNo(this, "<LOC>Leave Clan", "<LOC>Are you sure you want to leave your clan?").ShowDialog(this) == DialogResult.Yes) { ClanMember member = null; if ((ClanMember.Current != null) && (Clan.Current != null)) { ClanMember current = ClanMember.Current; DataAccess.ExecuteQuery("LeaveClan", new object[] { User.Current.ID, Clan.Current.ID }); if (Clan.CurrentMembers.Count == 1) { DataAccess.ExecuteQuery("RemoveClan", new object[] { Clan.Current.ID }); DataAccess.ExecuteQuery("ClearEmptyClanRooms", new object[0]); } else if (current.Rank == ClanRanking.MaxValue.Seniority) { ClanMember[] memberArray; int rank = 1; while (this.GetMembersByRank(rank, out memberArray) < 1) { rank++; if (rank > ClanRanking.MinValue.Seniority) { DataAccess.ExecuteQuery("RemoveClan", new object[] { Clan.Current.ID }); break; } } if (memberArray.Length > 1) { Array.Sort<ClanMember>(memberArray, new SeniorityComparer()); member = memberArray[0]; } else if (memberArray.Length == 1) { member = memberArray[0]; } } string[] currentMembersMsgList = Clan.CurrentMembersMsgList; if (member != null) { DataAccess.ExecuteQuery("ChangeRank", new object[] { ClanRanking.MaxValue.Seniority, member.ID, Clan.Current.ID }); this.RefreshClan(Loc.Get("<LOC>You have left your clan."), "<LOC>{0} has left your clan. {1} has been promoted to {2}", new object[] { User.Current.Name, member.Name, ClanRanking.MaxValue.Description }); } else { this.RefreshClan(Loc.Get("<LOC>You have left your clan."), "<LOC>{0} has left your clan.", new object[] { User.Current.Name }); this.RefreshPMWindows(); } Clan.Current = null; ClanMember.Current = null; Clan.CurrentMembers.Clear(); User.Current.ClanAbbreviation = null; User.Current.ClanName = null; this.RefreshGathering(); DataAccess.ExecuteQuery("ClearClanRequests", new object[0]); for (int i = 0; i < currentMembersMsgList.Length; i++) { this.RefreshChatParticipant(currentMembersMsgList[i]); } this.ClanRequests.Clear(); this.RefreshClanRequestCount(); if (callBack == null) { callBack = delegate (object state) { try { MappedObjectList<Chatroom> persistentRooms = null; if (ConfigSettings.GetBool("DoOldGameList", false)) { persistentRooms = new QuazalQuery("GetPersistentRooms", new object[0]).GetObjects<Chatroom>(); } else { persistentRooms = new QuazalQuery("GetPersistentRooms2", new object[] { GameInformation.SelectedGame.GameID }).GetObjects<Chatroom>(); } base.Invoke((VGen0)delegate { this.GatheringDisplaycontrol.RefreshGatherings(persistentRooms, true); }); } catch (Exception exception) { ErrorLog.WriteLine(exception); } }; } ThreadPool.QueueUserWorkItem(callBack); } } } else { this.ErrorMessage("<LOC>You are not in a clan.", new object[0]); } } catch (Exception exception) { ErrorLog.WriteLine(exception); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); ThreadPool.QueueUserWorkItem(delegate (object s) { try { while (this.Mod == null) { Thread.Sleep(100); } GPG.Multiplayer.Client.Vaulting.Mods.Mod mod = this.Mod; int top = 0; foreach (string requirement in mod.Requirements) { if ((requirement != null) && (requirement.Length >= 1)) { GPG.Multiplayer.Client.Vaulting.Mods.Mod reqMod = new QuazalQuery("GetModByGuid", new object[] { requirement }).GetObject<GPG.Multiplayer.Client.Vaulting.Mods.Mod>(); base.Invoke((VGen0)delegate { GPGLabel label = new GPGLabel { AutoSize = true }; if (reqMod != null) { label.Text = string.Format(Loc.Get("<LOC>Name: {0}, UID: {1}"), reqMod.Name, reqMod.Guid); label.TextStyle = TextStyles.Default; } else { label.Text = string.Format(Loc.Get("<LOC>NOT FOUND, UID: {0}"), requirement); label.TextStyle = TextStyles.ColoredBold; label.ForeColor = Color.Red; } label.Left = 0; label.Top = top; this.gpgPanelRequirements.Controls.Add(label); top += label.Height; }); } } top = 0; foreach (string conflict in mod.Conflicts) { if ((conflict != null) && (conflict.Length >= 1)) { GPG.Multiplayer.Client.Vaulting.Mods.Mod conflictMod = new QuazalQuery("GetModByGuid", new object[] { conflict }).GetObject<GPG.Multiplayer.Client.Vaulting.Mods.Mod>(); base.Invoke((VGen0)delegate { GPGLabel label = new GPGLabel { AutoSize = true }; if (conflictMod != null) { label.Text = string.Format(Loc.Get("<LOC>Name: {0}, UID: {1}"), conflictMod.Name, conflictMod.Guid); label.TextStyle = TextStyles.Default; } else { label.Text = string.Format(Loc.Get("<LOC>NOT FOUND, UID: {0}"), conflict); label.TextStyle = TextStyles.ColoredBold; label.ForeColor = Color.Red; } label.Left = 0; label.Top = top; this.gpgPanelConflicts.Controls.Add(label); top += label.Height; }); } } } catch (Exception exception) { ErrorLog.WriteLine(exception); } }); }
private void RefreshList() { this.skinButtonRefresh.Enabled = false; this.skinButtonJoin.Enabled = false; this.gpgGameGrid.DataSource = null; this.gpgGameGrid.RefreshDataSource(); ThreadQueue.QueueUserWorkItem(delegate (object state) { MappedObjectList<HostedGame> data = new QuazalQuery("GetHostedSpaceSiegeGames", new object[0]).GetObjects<HostedGame>(); base.BeginInvoke((VGen0)delegate { this.gpgGameGrid.DataSource = data; this.skinButtonRefresh.Enabled = true; if (data.Count > 0) { this.skinButtonJoin.Enabled = true; } }); }, new object[0]); }
public bool FromID(int contentId, out IAdditionalContent content) { Video video; if (!base.ContentType.CurrentUserCanDownload) { content = null; return false; } bool flag = new QuazalQuery("GetVideoById", new object[] { contentId }).GetObject<Video>(out video); content = video; return flag; }
private void JoinClan(int clanId, string clanName, string clanAbbr) { WaitCallback callBack = null; try { if ((((Clan.Current == null) && (ClanMember.Current == null)) && (User.Current.ClanName == null)) && (User.Current.ClanAbbreviation == null)) { if (!DataAccess.ExecuteQuery("JoinClan", new object[] { User.Current.ID, clanId, ClanRanking.MinValue.Seniority })) { this.ErrorMessage("<LOC>Unable to join the clan {0}\"{1}\", ensure you are not already a member of a clan.", new object[] { "clan:", clanName }); } else { this.ClanInvites.Clear(); DataAccess.ExecuteQuery("ClearClanInvites", new object[0]); this.RefreshClanInviteCount(); this.RefreshClan(string.Format(Loc.Get("<LOC>You have joined the clan {0}\"{1}\"."), "clan:", clanName), "<LOC>{0} has joined your clan.", new object[] { User.Current.Name }); DataAccess.ExecuteQuery("ClearClanInvites", new object[0]); if (callBack == null) { callBack = delegate (object state) { try { MappedObjectList<Chatroom> persistentRooms = null; if (ConfigSettings.GetBool("DoOldGameList", false)) { persistentRooms = new QuazalQuery("GetPersistentRooms", new object[0]).GetObjects<Chatroom>(); } else { persistentRooms = new QuazalQuery("GetPersistentRooms2", new object[] { GameInformation.SelectedGame.GameID }).GetObjects<Chatroom>(); } base.Invoke((VGen0)delegate { this.GatheringDisplaycontrol.RefreshGatherings(persistentRooms, true); }); } catch (Exception exception) { ErrorLog.WriteLine(exception); } }; } ThreadPool.QueueUserWorkItem(callBack); } } } catch (Exception exception) { ErrorLog.WriteLine(exception); } }
public void RefreshContentLists() { this.treeViewSavedSearches.Nodes.Clear(); if ((this.SelectedDownloadContent != null) && (this.SelectedDownloadContent.ContentType != null)) { ThreadPool.QueueUserWorkItem(delegate (object s) { try { using (IEnumerator<ContentList> enumerator = new QuazalQuery("GetContentLists", new object[] { this.SelectedDownloadContent.ContentType.Name }).GetObjects<ContentList>().GetEnumerator()) { while (enumerator.MoveNext()) { ContentList list = enumerator.Current; string[] strArray = list.Category.Split(new char[] { '.' }); TreeNodeCollection siblings = this.treeViewSavedSearches.Nodes; TreeNode lastNode = null; foreach (string str in strArray) { TreeNode[] nodeArray = this.treeViewSavedSearches.Nodes.Find(str, false); if (nodeArray.Length > 0) { lastNode = nodeArray[0]; siblings = lastNode.Nodes; } else { TreeNode node = new TreeNode(Loc.Get("<LOC>" + str), list.CategoryImageIndex, list.CategoryImageIndex) { Name = str }; if ((!base.IsHandleCreated || base.Disposing) || base.IsDisposed) { return; } base.Invoke((VGen0)delegate { siblings.Add(node); if (node.Parent != null) { node.Parent.Expand(); } }); lastNode = node; siblings = lastNode.Nodes; } } TreeNode listNode = new TreeNode(Loc.Get("<LOC>" + list.Name), list.ListImageIndex, list.ListImageIndex) { Name = list.Name, Tag = list }; if ((!base.IsHandleCreated || base.Disposing) || base.IsDisposed) { return; } base.Invoke((VGen0)delegate { lastNode.Nodes.Add(listNode); if (listNode.Parent != null) { listNode.Parent.Expand(); } if (!(this.DefaultListPicked || !(list.Name == ConfigSettings.GetString("DefaultVaultSearchList", "Most Downloaded")))) { this.treeViewSavedSearches.SelectedNode = listNode; this.DefaultListPicked = true; } }); } } } catch (Exception exception) { ErrorLog.WriteLine(exception); } }); } }
private void OnCreateClan() { WaitCallback callBack = null; if (!User.Current.IsInClan) { if (new DlgCreateClan(this).ShowDialog(this) == DialogResult.OK) { this.ClanInvites.Clear(); DataAccess.ExecuteQuery("ClearClanInvites", new object[0]); this.RefreshClanInviteCount(); this.RefreshClan(string.Format(Loc.Get("<LOC>You have formed the clan {0}\"{1}\""), "clan:", User.Current.ClanName), null, new object[0]); this.RefreshPMWindows(); this.RefreshGathering(); DataAccess.ExecuteQuery("ClearClanInvites", new object[0]); if (callBack == null) { callBack = delegate (object state) { MappedObjectList<Chatroom> persistentRooms = null; if (ConfigSettings.GetBool("DoOldGameList", false)) { persistentRooms = new QuazalQuery("GetPersistentRooms", new object[0]).GetObjects<Chatroom>(); } else { persistentRooms = new QuazalQuery("GetPersistentRooms2", new object[] { GameInformation.SelectedGame.GameID }).GetObjects<Chatroom>(); } base.Invoke((VGen0)delegate { this.GatheringDisplaycontrol.RefreshGatherings(persistentRooms, true); }); }; } ThreadPool.QueueUserWorkItem(callBack); } } else { this.ErrorMessage("<LOC>You are already in a clan.", new object[0]); } }
public IAdditionalContent[] GetMyUploads() { if (!base.ContentType.CurrentUserCanUpload) { return new IAdditionalContent[0]; } QuazalQuery query = new QuazalQuery("GetMyUploadedVideos", new object[0]); return query.GetObjects<Video>().ToArray(); }
public bool FromID(int contentId, out IAdditionalContent content) { CustomMap map; if (!base.ContentType.CurrentUserCanUpload) { content = null; return false; } bool flag = new QuazalQuery("GetMapById", new object[] { contentId }).GetObject<CustomMap>(out map); content = map; return flag; }