public static IntPtr MarshalArray(ResultsInfo[] MyArray) { int num = Marshal.SizeOf(typeof(ResultsInfo)); IntPtr ptr = Marshal.AllocCoTaskMem(num * MyArray.Length); int num2 = 0; foreach (ResultsInfo info in MyArray) { int num4 = ptr.ToInt32() + (num2 * num); IntPtr ptr2 = new IntPtr(num4); Marshal.StructureToPtr(info, ptr2, false); num2++; } return ptr; }
public bool ReportGame(int GameID, int Kills, int Deaths, ResultsInfo[] results) { bool flag; Lobby.Lock(); try { if (Lobby.sProtocol != null) { return Lobby.sProtocol.ReportGame(GameID, Kills, Deaths, results); } ArrayList list = new ArrayList(); foreach (ResultsInfo info in results) { list.Add(info.PlayerName); list.Add(info.WonGame.ToString()); } flag = mReportGame(GameID, Kills, Deaths, list.Count, list.ToArray(typeof(string)) as string[]); } finally { Lobby.Unlock(); } return flag; }
public bool ReportGame(int GameID, int Kills, int Deaths, ResultsInfo[] results) { throw new Exception("Report Game is depricated. This was GPGnet 1.5.37 original supcom gold."); }
public static bool ReportWin(int gathering, string loserteam, string winnerteam, string gamexml, List<SupComStatsInfo> playerstats) { if (gamexml == null) { EventLog.WriteLine("GameXML is null and we are returning false", LogCategory.Get("Game"), new object[0]); } else { EventLog.WriteLine("GameXML was added: " + gamexml, LogCategory.Get("Game"), new object[0]); } if ((gamexml == null) || (gamexml.Length < ConfigSettings.GetInt("MinReportLength", 200))) { return false; } try { List<ResultsInfo> list = new List<ResultsInfo>(); ResultsInfo item = new ResultsInfo { PlayerName = winnerteam, WonGame = 1 }; list.Add(item); item = new ResultsInfo { PlayerName = loserteam, WonGame = 0 }; list.Add(item); DataList list2 = DataAccess.GetQueryDataSet("GetGameGatheringID", true, new object[0]); int num = -1; if (list2.Count > 0) { EventLog.WriteLine("We have a data row.", LogCategory.Get("Game"), new object[0]); if (list2[0].Count > 0) { num = Convert.ToInt32(list2[0][0]); } } bool flag = false; if ((winnerteam == User.Current.ID.ToString()) || !flag) { if (ConfigSettings.GetBool("ReportOldWay", false) || (playerstats.Count == 0)) { EventLog.WriteLine("OLD Reporting Game", LogCategory.Get("Game"), new object[0]); Lobby.GetLobby().competitionHelper.ReportGame(gathering, 0, 0, list.ToArray()); EventLog.WriteLine("OLD Getting game identification", LogCategory.Get("Game"), new object[0]); } else { EventLog.WriteLine("NEW Reporting Game", LogCategory.Get("Game"), new object[0]); Lobby.GetLobby().competitionHelper.CreateGameReport(gathering, playerstats[0].map, playerstats[0].duration, playerstats[0].gametype); foreach (SupComStatsInfo info2 in playerstats) { string teamName = winnerteam; int num2 = Lobby.GetLobby().authenticationHelper.FindIDByPlayerName(info2.playername); if ((teamName + " ").IndexOf(num2.ToString() + " ") < 0) { teamName = loserteam; } teamName = teamName.Trim(); Lobby.GetLobby().competitionHelper.AddResult(gathering, info2.playername, info2.faction, info2.kills, info2.lost, info2.built, info2.damageDone, info2.damageReceived, teamName, info2.energyConsumed, info2.energyProduced, info2.massConsumed, info2.massProduced, info2.result); foreach (SupcomStatUnitInfo info3 in info2.UnitInfo) { Lobby.GetLobby().competitionHelper.AddUnit(gathering, info2.playername, info3.unitid, info3.built, info3.lost, info3.killed, info3.damagedealt, info3.damagereceived); } } Lobby.GetLobby().competitionHelper.SubmitGameReport(); EventLog.WriteLine("NEW Getting game identification", LogCategory.Get("Game"), new object[0]); } } DataAccess.ExecuteQuery("UpdateGameResult", new object[0]); EventLog.WriteLine("Sending game report.", LogCategory.Get("Game"), new object[0]); string s = gamexml.Replace("<?xml version=\"1.0\" encoding=\"utf-8\" ?>", "").Replace("<GameInfo", "<GameInfo gameid=\"" + num.ToString() + "\""); EventLog.WriteLine("Game XML:\r\n " + s, LogCategory.Get("Game"), new object[0]); if (ConfigSettings.GetBool("LogGameToQuazal", false)) { string str3 = Convert.ToBase64String(Compression.CompressData(Encoding.ASCII.GetBytes(s))); EventLog.WriteLine("Updating game to Quazal.", new object[0]); DataAccess.ExecuteQuery("LogGameReport", new object[] { num, str3 }); } ConfigSettings.GetBool("LogDetailsToQuazal", true); if (DataAccess.GetBool("GetConfigSetting", new object[] { "log_games" })) { byte[] bytes = Encoding.UTF8.GetBytes(s); new GPG.Multiplayer.Quazal.com.gaspowered.gpgnet.Service { Url = ConfigSettings.GetString("GameStatsService", "http://gpgnet.gaspowered.com/gamereport/Service.asmx?WSDL") }.SubmitGameReport(Lobby.GetLobby().authenticationHelper.Server + "_" + Lobby.GetLobby().authenticationHelper.Port.ToString() + "_" + num.ToString(), User.Current.Name, bytes); DataAccess.ExecuteQuery("SubmissionComplete", new object[] { num }); } return false; } catch (Exception exception) { ErrorLog.WriteLine(exception); return false; } }