public TetrisHighScoreData(XElement Source, object PersistenceData) { if (Source.HasElements) { XElement LevelTimeNode = Source.Element("LevelTimes"); XElement PieceCountsNode = Source.Element("PieceCounts"); TotalLines = Source.GetAttributeInt("Lines", 0); if (LevelTimeNode != null) { Dictionary <int, TimeSpan> ConstructListing = new Dictionary <int, TimeSpan>(); foreach (XElement loopelement in LevelTimeNode.Elements("LevelTime")) { int Level = loopelement.GetAttributeInt("Level"); long ticks = loopelement.GetAttributeLong("Time"); if (!ConstructListing.ContainsKey(Level)) { ConstructListing.Add(Level, new TimeSpan(ticks)); } } LevelReachedTimes = (from s in ConstructListing orderby s.Key select s.Value).ToArray(); } else { LevelReachedTimes = new TimeSpan[] { } }; if (PieceCountsNode != null) { TetronimoPieceCounts = new Dictionary <string, int>(); TetronimoLineCounts = new Dictionary <string, int>(); foreach (var NodePiece in PieceCountsNode.Elements("PieceCount")) { String sPiece = NodePiece.GetAttributeString("Piece"); int iCount = NodePiece.GetAttributeInt("Count"); int pieceLines = NodePiece.GetAttributeInt("Lines"); TetronimoPieceCounts.Add(sPiece, iCount); TetronimoLineCounts.Add(sPiece, pieceLines); } } } }