public static void SaveRepo(GameRepo repo, string filePath)
 {
     var writer = new XmlSerializer(typeof(GameRepo));
     using (FileStream file = File.OpenWrite(filePath))
     {
         writer.Serialize(file, repo);
     }
 }
Example #2
0
 public GameService()
 {
     _saveFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "PingPong");
     if (!Directory.Exists(_saveFilePath))
     {
         Directory.CreateDirectory(_saveFilePath);
     }
     _saveFilePath = Path.Combine(_saveFilePath, FileName);
     ResetData();
     _repository = GameDataUtility.LoadRepo(_saveFilePath);
 }
Example #3
0
 internal GameService(GameRepo repository)
 {
     ResetData();
     _repository = repository;
 }