Beispiel #1
0
 //--------------------------------------------------------------//
 //MakingGames//
 public void initateGames(int amount, List <Game> games)
 {
     for (int i = 0; i < amount; i++)
     {
         var           parent      = System.IO.Directory.GetParent(Environment.CurrentDirectory);
         var           Location    = parent.Parent.FullName + "\\SaveFiles\\GameLibrary\\GameID.txt";
         List <String> TextStrings = new List <String>();
         TextStrings = File.ReadLines(Location).ToList();
         int gameIDCount = Convert.ToInt32(TextStrings[0]);
         int ratings     = don.RandomRating();
         Console.WriteLine("FAM. GAMEID: " + gameIDCount);
         Game newGame = new Game(gameIDCount.ToString(),
                                 don.RandomizeName("PreName") + " " + don.RandomizeName("SufName"),
                                 don.RandomizeName("PreStudio") + " " + don.RandomizeName("SufStudio"),
                                 don.RandomizeName("Genre"),
                                 don.RandomizePrice(),
                                 don.RandomizeDate(),
                                 ratings,
                                 don.RandomSold(ratings),
                                 0);
         games.Add(newGame);
         gameIDCount++;
         File.WriteAllText(Location, gameIDCount.ToString());
     }
 }
 //--------------------------------------------------------------//
 //MakingGames//
 public void initateGames(int amount, List <Game> games)
 {
     for (int i = 0; i < amount; i++)
     {
         DateTime newDate = new DateTime(2016, 3, 15);
         int      ratings = don.RandomRating();
         Game     newGame = new Game(don.RandomizeName("PreName") + " " + don.RandomizeName("SufName"),
                                     don.RandomizeName("PreStudio") + " " + don.RandomizeName("SufStudio"),
                                     don.RandomizeName("Genre"),
                                     don.RandomizePrice(),
                                     don.RandomizeDate(),
                                     ratings,
                                     don.RandomSold(ratings));
         games.Add(newGame);
     }
 }
        public List <Game> CreateGame(int AmountofGames)     //creates games and returns in a gamelist
        {
            List <Game>   newGames   = new List <Game>();
            RandomizeGame gameRandom = new RandomizeGame();

            for (int i = 0; i < AmountofGames; i++)
            {
                int GameIDCount = getGameID();
                int ratings     = gameRandom.RandomRating();

                Game newGame = gameRandom.RandomGameOut();      //generate new game
                newGame.GameID = GameIDCount.ToString();        //Have to establish gameID

                newGames.Add(newGame);
                GameIDCount++;                                  //Game Count Add
                File.WriteAllText(getLibrary("\\SaveFiles\\GameLibrary\\GameID.txt"), GameIDCount.ToString());
            }
            return(newGames);
        }