public void UpdatePlayer(System.Xml.XmlNode _PlayerNode, Contributor _Contributor, Func <int, VF.SQLUploadID> _GetSQLUploadIDFunc) { string playerName = PlayerData.DataParser.ParsePlayerName(_PlayerNode); DateTime lastSeen = PlayerData.DataParser.ParseLastSeenUTC(_PlayerNode); if (lastSeen > DateTime.UtcNow) { if (lastSeen > DateTime.UtcNow.AddMinutes(2)) { //Tillåt inte data som är från framtiden(wtf) flagga Contributor som opålitlig _Contributor.SetWarningFlag(Contributor.WarningFlag.DataFromFuture); return; } lastSeen = DateTime.UtcNow; //Om det är OK så sätter vi LastSeen till UtcNow istället. } if ((DateTime.UtcNow - lastSeen).TotalDays > 5) //Tillåt inte data som är äldre än 5 dagar { return; } //if (lastSeen < DATE_HONOR_CORRUPTION)// Honor corruption occured the 16th January, uncomment this line after 5 days have passed! //{ // Logger.ConsoleWriteLine("Someone submitted data that was during the Honor Corruption. Good thing i implemented this code!!!", ConsoleColor.Red); // return; //} var uploadID = _Contributor.GetUploadID(lastSeen); PlayerData.Player currPlayer = GetPlayer(playerName); PlayerData.PlayerHistory currPlayerHistory = GetPlayerHistory(playerName); currPlayer.Update(_PlayerNode, uploadID, lastSeen, currPlayerHistory, WowVersion, _GetSQLUploadIDFunc); try { //ANVÄND INTE = tecken innuti savedvariables data!!!!!!!!! då buggar det ur totalt string extraData = XMLUtility.GetChildValue(_PlayerNode, "ExtraData", ""); if (extraData != "") { VF.SQLPlayerID playerID; using (VF.SQLComm comm = new VF.SQLComm()) { if (comm.GetPlayerID(Realm, playerName, out playerID) == false) { Logger.ConsoleWriteLine("Could not find SQL PlayerID for Player \"" + playerName + "\""); } } var currPlayerExtraData = GetPlayerExtraData(playerName); currPlayerExtraData.AddData(uploadID, extraData, playerID, _GetSQLUploadIDFunc); } } catch (NpgsqlException ex) { throw ex; } catch (Exception ex) { Logger.LogException(ex); } Updated = true; }
public void UpdatePlayer(System.Xml.XmlNode _PlayerNode, Contributor _Contributor, Func <int, VF.SQLUploadID> _GetSQLUploadIDFunc) { string playerName = PlayerData.DataParser.ParsePlayerName(_PlayerNode); DateTime lastSeen = PlayerData.DataParser.ParseLastSeenUTC(_PlayerNode); if (lastSeen > DateTime.UtcNow) { if (lastSeen > DateTime.UtcNow.AddMinutes(2)) { //Tillåt inte data som är från framtiden(wtf) flagga Contributor som opålitlig _Contributor.SetWarningFlag(Contributor.WarningFlag.DataFromFuture); return; } lastSeen = DateTime.UtcNow; //Om det är OK så sätter vi LastSeen till UtcNow istället. } if ((DateTime.UtcNow - lastSeen).TotalDays > 5) //Tillåt inte data som är äldre än 5 dagar { if (Realm == WowRealm.Northdale && lastSeen < new DateTime(2018, 6, 23, 12, 0, 0)) //Do not allow inspects before server even opened... { return; } if (DateTime.UtcNow < new DateTime(2018, 9, 1) && lastSeen > new DateTime(2018, 4, 1)) { //Special case, allow this! We are temporary allowing adding some old data! } else { return; } } //if (lastSeen < DATE_HONOR_CORRUPTION)// Honor corruption occured the 16th January, uncomment this line after 5 days have passed! //{ // Logger.ConsoleWriteLine("Someone submitted data that was during the Honor Corruption. Good thing i implemented this code!!!", ConsoleColor.Red); // return; //} var uploadID = _Contributor.GetUploadID(lastSeen); PlayerData.Player currPlayer = GetPlayer(playerName); PlayerData.PlayerHistory currPlayerHistory = GetPlayerHistory(playerName); currPlayer.Update(_PlayerNode, uploadID, lastSeen, currPlayerHistory, WowVersion, _GetSQLUploadIDFunc); try { //ANVÄND INTE = tecken innuti savedvariables data!!!!!!!!! då buggar det ur totalt string extraData = XMLUtility.GetChildValue(_PlayerNode, "ExtraData", ""); if (extraData != "") { #if UPDATE_SQL_DB VF.SQLPlayerID playerID; using (VF.SQLComm comm = new VF.SQLComm()) { if (comm.GetPlayerID(Realm, playerName, out playerID) == false) { Logger.ConsoleWriteLine("Could not find SQL PlayerID for Player \"" + playerName + "\""); } } var currPlayerExtraData = GetPlayerExtraData(playerName); currPlayerExtraData.AddData(uploadID, extraData, playerID, _GetSQLUploadIDFunc); #else if (_GetSQLUploadIDFunc != null) { while (true) { Console.WriteLine("ERROR, SQL USAGE CONFUSION"); System.Threading.Thread.Sleep(5000); } } var currPlayerExtraData = GetPlayerExtraData(playerName); currPlayerExtraData.AddData(uploadID, extraData, null, null); #endif } } catch (NpgsqlException ex) { throw ex; } catch (Exception ex) { Logger.LogException(ex); } Updated = true; }