예제 #1
0
        private void btnAddGame_Click(object sender, EventArgs e)
        {
            NewGameForm newGameForm = new NewGameForm();

            newGameForm.ShowDialog();

            library.ImportGamesFromFile();

            lblGames.DataSource = null;
            lblGames.DataSource = library.GetGames();
        }
예제 #2
0
 public MainForm()
 {
     InitializeComponent();
     library = new GameLibrary();
     library.ImportGamesFromFile();
     lblGames.DataSource = library.GetGames();
 }
예제 #3
0
        static void Main(string[] args)
        {
            GameLibrary gameLibrary = new GameLibrary();

            var games = gameLibrary.GetGames();

            foreach (var item in games)
            {
                Console.WriteLine(item.Source + "\t" + item.Name + " " + item.InstallDirectory);
            }

            string selected;
            int    index;

            do
            {
                selected = Console.ReadLine();
            } while (!int.TryParse(selected, out index));

            if (index >= 0 && index < games.Count())
            {
                gameLibrary.PlayGame(games.ElementAt(index));
            }

            Console.ReadLine();
        }
예제 #4
0
        public async Task GameLibraryIntegrationQuery_Test()
        {
            var path = new DirectoryInfo(Path.GetTempPath())
                       .CreateSubdirectory(Path.GetFileNameWithoutExtension(Path.GetTempFileName()));
            var fs  = new PhysicalFileSystem();
            var gfs = fs.GetOrCreateSubFileSystem(fs.ConvertPathFromInternal(path.FullName));

            var optionsBuilder = new DbContextOptionsBuilder <DatabaseContext>();

            optionsBuilder.UseSqlite($"Data Source={Path.GetTempFileName()}");
            var glib = new GameRecordLibrary(optionsBuilder);
            var gl   = new GameLibrary(glib);
            var game = gl.CreateGame("NINTENDO_NES");

            Assert.NotEmpty(gl.QueryGames(g => g.PlatformID == "NINTENDO_NES"));
            Assert.NotEmpty(gl.GetGames(g => g.PlatformID == "NINTENDO_NES"));
            Assert.NotEmpty(gl.GetAllGames());
            Assert.NotNull(gl.GetGame(game.Record.RecordID));
        }