public static void updateLeaderBoard(int score, String id, bool isSpeed) { initialize(); if (!isSpeed) { string [] lines = File.ReadAllLines(path + scores); string [] trueOutput = new string [3] { "", "", "", }; PlayerObj [] po = new PlayerObj[4]; for (int i = 0; i < lines.Length; i++) { if (lines[i].Length != 0) { String [] temp = lines[i].Split(':'); if (temp.Length == 2) { po[i] = new PlayerObj(temp[0], Int32.Parse(temp[1])); } } } po[3] = new PlayerObj(id, score); Array.Sort(po, PlayerObj.sortScoreDescending()); for (int i = 0; i < trueOutput.Length; i++) { if (po[i] != null) { trueOutput[i] = po[i].id.ToUpper() + ": " + po[i].score; } } File.WriteAllLines(path + scores, trueOutput); } else { string [] lines = File.ReadAllLines(path + scoresSpeed); string [] trueOutput = new string [3] { "", "", "", }; PlayerObj [] po = new PlayerObj[4]; for (int i = 0; i < lines.Length; i++) { if (lines[i].Length != 0) { String [] temp = lines[i].Split(':'); if (temp.Length == 2) { po[i] = new PlayerObj(temp[0], Int32.Parse(temp[1])); } } } po[3] = new PlayerObj(id, score); Array.Sort(po, PlayerObj.sortScoreDescending()); for (int i = 0; i < trueOutput.Length; i++) { if (po[i] != null) { trueOutput[i] = po[i].id.ToUpper() + ": " + po[i].score; } } File.WriteAllLines(path + scoresSpeed, trueOutput); } }