internal void SaveToServer() { try { var serverScores = LoadFromServer(); serverScores.Sort(); serverScores.Reverse(); var builder = new StringBuilder(); foreach (ScoreboardEntry entry in this) { if (serverScores.IndexOf(entry) < 11 && !serverScores.Contains(entry)) { builder.Append(entry.Score + "#" + entry.Name + "#" + entry.Hash + ","); } } var client = new scoreswsdlPortTypeClient(); client.register(Encryption.EncryptRj256(Encryption.Sky, Encryption.Siv, builder.ToString().TrimEnd(','))); } // ReSharper disable EmptyGeneralCatchClause catch (Exception) // ReSharper restore EmptyGeneralCatchClause { } }
internal static Scoreboard LoadFromServer() { var scoreboard = new Scoreboard(); var client = new scoreswsdlPortTypeClient(); string scores = client.getscores("normal"); string[] scoresArray = scores.Split(','); foreach (string entry in scoresArray) { string[] entryArray = entry.Split('#'); scoreboard.Add(new ScoreboardEntry(entryArray[1], Convert.ToInt32(entryArray[0]), entryArray[2])); } return(scoreboard); }