From 8f42e7577ebe819a151f8e1abaad0b31a258e685 Mon Sep 17 00:00:00 2001 From: "alexis.drai" Date: Wed, 28 Sep 2022 11:32:04 +0200 Subject: [PATCH] Add comments, break keyboard..? --- Sources/Model/Games/GameRunner.cs | 147 +++++++++++++++++------------- 1 file changed, 83 insertions(+), 64 deletions(-) diff --git a/Sources/Model/Games/GameRunner.cs b/Sources/Model/Games/GameRunner.cs index a3aefdc..b4acd01 100644 --- a/Sources/Model/Games/GameRunner.cs +++ b/Sources/Model/Games/GameRunner.cs @@ -1,64 +1,83 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Model.Dice; -using Model.Dice.Faces; -using Model.Players; - -namespace Model.Games -{ - public class GameRunner - { - private readonly IManager globalPlayerManager; - private readonly IManager>>> globalDieManager; - private readonly List games; - - public GameRunner(IManager globalPlayerManager, IManager>>> globalDieManager, List games) - { - this.globalPlayerManager = globalPlayerManager; - this.globalDieManager = globalDieManager; - this.games = games ?? new(); - } - - public IEnumerable GetAllGames() => games.AsEnumerable(); - - /// - /// finds the game with that name and returns it - ///
- /// that copy does not belong to this gamerunner's games, so it should not be modified - ///
- /// a games's name - /// game with said name, or null if no such game was found - public Game GetOneGameByName(string name) - { - if (!string.IsNullOrWhiteSpace(name)) - { - Game result = games.FirstOrDefault(g => g.Name == name); - return result; // may return null - } - throw new ArgumentException("param should not be null or blank", nameof(name)); - } - - public void SaveGame(Game game) - { - throw new NotSupportedException(); - } - - public Game LoadGame(string name) - { - throw new NotSupportedException(); - } - - public void StartNewGame() - { - throw new NotSupportedException(); - } - - public void DeleteGame(Game game) - { - throw new NotSupportedException(); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Model.Dice; +using Model.Dice.Faces; +using Model.Players; + +namespace Model.Games +{ + public class GameRunner + { + private readonly IManager globalPlayerManager; + private readonly IManager>>> globalDieManager; + private readonly List games; + + public GameRunner(IManager globalPlayerManager, IManager>>> globalDieManager, List games) + { + this.globalPlayerManager = globalPlayerManager; + this.globalDieManager = globalDieManager; + this.games = games ?? new(); + } + + public IEnumerable GetAllGames() => games.AsEnumerable(); + + /// + /// finds the game with that name and returns it + ///
+ /// that copy does not belong to this gamerunner's games, so it should not be modified + ///
+ /// a games's name + /// game with said name, or null if no such game was found + public Game GetOneGameByName(string name) + { + if (!string.IsNullOrWhiteSpace(name)) + { + Game result = games.FirstOrDefault(g => g.Name == name); + return result; // may return null + } + throw new ArgumentException("param should not be null or blank", nameof(name)); + } + + /// + /// saves a given game + /// + /// a game to save + /// + public void SaveGame(Game game) + { + throw new NotSupportedException(); + } + + /// + /// loads a game by name + /// + /// name of game to be loaded + /// loaded game + /// + public Game LoadGame(string name) + { + throw new NotSupportedException(); + } + + /// + /// creates a new game + /// + /// + public void StartNewGame() + { + throw new NotSupportedException(); + } + + public void DeleteGame(Game game) + { + throw new NotSupportedException(); + } + private void PlayGame(Game game) + { + throw new NotSupportedException(); + } + } +}