Ejemplo n.º 1
0
        public DesignMainViewModel()
        {
            MainMenuVisible     = false;
            GameMenuVisible     = false;
            SettingsMenuVisible = false;
            GameListVisible     = true;
            GameDetailsVisible  = false;
            FilterPanelVisible  = true;
            ProgressStatus      = "Status example in progress...";
            ProgressValue       = 50;
            ProgressTotal       = 100;
            ProgressVisible     = true;

            var database = new InMemoryGameDatabase();

            Game.DatabaseReference = database;
            GameDatabase.GenerateSampleData(database);
            var designGame = database.Games.First();

            designGame.CoverImage      = "pack://application:,,,/Playnite;component/Resources/Images/DesignCover.jpg";
            designGame.BackgroundImage = "pack://application:,,,/Playnite;component/Resources/Images/DesignBackground.jpg";
            designGame.Icon            = "pack://application:,,,/Playnite;component/Resources/Images/DesignIcon.png";

            GamesView = new FullscreenCollectionView(
                database,
                new PlayniteSettings(),
                new ExtensionFactory(database, new GameControllerFactory()));

            GameDetailsEntry    = GamesView.Items[0];
            SelectedGame        = GamesView.Items[0];
            SelectedGameDetails = new GameDetailsViewModel(GamesView.Items[0]);

            MainMenuVisible     = false;
            SettingsMenuVisible = false;
            AppSettings         = new PlayniteSettings();
            AppSettings.Fullscreen.ShowBattery           = true;
            AppSettings.Fullscreen.ShowBatteryPercentage = true;
            AppSettings.Fullscreen.ShowClock             = true;
            PlayniteApi = new PlayniteAPI(null, null, null, null, null, null, null, new NotificationsAPI(), null, null);
            PlayniteApi.Notifications.Add(new NotificationMessage("1", "Some testing notification message.", NotificationType.Info));
            PlayniteApi.Notifications.Add(new NotificationMessage("2", "Some really long testing notification message that should be on more lines of text.", NotificationType.Error));
        }
Ejemplo n.º 2
0
        public void ExpandVariablesReferenceTest()
        {
            var database = new InMemoryGameDatabase();

            Game.DatabaseReference = database;
            GameDatabase.GenerateSampleData(database);

            var game = new Game()
            {
                Name             = "test game",
                InstallDirectory = @"{PlayniteDir}\test\test2\",
                Roms             = new ObservableCollection <GameRom> {
                    new GameRom("test", @"{InstallDir}\test.iso")
                }
            };

            var expanded = game.ExpandVariables("{ImagePath}");

            StringAssert.DoesNotContain("{ImagePath}", expanded);
            StringAssert.DoesNotContain("{PlayniteDir}", expanded);
        }
Ejemplo n.º 3
0
        public void ExpandVariablesTest()
        {
            var database = new InMemoryGameDatabase();

            Game.DatabaseReference = database;
            GameDatabase.GenerateSampleData(database);

            var dir  = @"c:\test\test2\";
            var game = new Game()
            {
                Name             = "test game",
                InstallDirectory = dir,
                Roms             = new ObservableCollection <GameRom> {
                    new GameRom("test", Path.Combine(dir, "test.iso"))
                },
                PlatformIds = new List <Guid> {
                    database.Platforms.First().Id
                },
                Version  = "1.0",
                PluginId = Guid.NewGuid(),
                GameId   = "game_id",
                Id       = Guid.NewGuid()
            };

            Assert.AreEqual(string.Empty, game.ExpandVariables(string.Empty));
            Assert.AreEqual("teststring", game.ExpandVariables("teststring"));
            Assert.AreEqual(dir + "teststring", game.ExpandVariables("{InstallDir}teststring"));
            Assert.AreEqual(game.InstallDirectory, game.ExpandVariables("{InstallDir}"));
            Assert.AreEqual("test", game.ExpandVariables("{ImageNameNoExt}"));
            Assert.AreEqual("test.iso", game.ExpandVariables("{ImageName}"));
            Assert.AreEqual(PlaynitePaths.ProgramPath, game.ExpandVariables("{PlayniteDir}"));
            Assert.AreEqual("test game", game.ExpandVariables("{Name}"));
            Assert.AreEqual("test2", game.ExpandVariables("{InstallDirName}"));
            Assert.AreEqual(game.Platforms[0].Name, game.ExpandVariables("{Platform}"));
            Assert.AreEqual(game.PluginId.ToString(), game.ExpandVariables("{PluginId}"));
            Assert.AreEqual(game.GameId, game.ExpandVariables("{GameId}"));
            Assert.AreEqual(game.Id.ToString(), game.ExpandVariables("{DatabaseId}"));
            Assert.AreEqual(game.Version, game.ExpandVariables("{Version}"));
            Assert.AreEqual(Path.Combine(dir, "test.iso"), game.ExpandVariables("{ImagePath}"));
        }
Ejemplo n.º 4
0
        public DesignMainViewModel()
        {
            ProgressStatus  = "Status example in progress...";
            ProgressValue   = 50;
            ProgressTotal   = 100;
            ProgressVisible = true;

            var database = new InMemoryGameDatabase();

            Game.DatabaseReference = database;
            GameDatabase.GenerateSampleData(database);
            var designGame = database.Games.First();

            designGame.CoverImage      = "pack://application:,,,/Playnite;component/Resources/Images/DesignCover.jpg";
            designGame.BackgroundImage = "pack://application:,,,/Playnite;component/Resources/Images/DesignBackground.jpg";
            designGame.Icon            = "pack://application:,,,/Playnite;component/Resources/Images/DesignIcon.png";

            AppSettings = new PlayniteSettings();
            AppSettings.ExplorerPanelVisible               = true;
            AppSettings.GridViewSideBarVisible             = true;
            AppSettings.ShowNamesUnderCovers               = true;
            AppSettings.ShowNameEmptyCover                 = true;
            AppSettings.ViewSettings.SelectedExplorerField = GroupableField.LastActivity;

            Extensions = new ExtensionFactory(database, new GameControllerFactory());
            GamesView  = new DesktopCollectionView(database, AppSettings, Extensions);

            SelectedGame  = GamesView.Items[0];
            SelectedGames = new List <GamesCollectionViewEntry>()
            {
                SelectedGame
            };
            SelectedGameDetails = new GameDetailsViewModel(GamesView.Items[0], AppSettings);
            DatabaseExplorer    = new DatabaseExplorer(database, Extensions, AppSettings);

            PlayniteApi = new PlayniteAPI(null, null, null, null, null, null, null, new NotificationsAPI(), null, null);
            PlayniteApi.Notifications.Add(new NotificationMessage("1", "Some testing notification message.", NotificationType.Info));
            PlayniteApi.Notifications.Add(new NotificationMessage("2", "Some really long testing notification message that should be on more lines of text.", NotificationType.Error));
        }
Ejemplo n.º 5
0
        public DesignMainViewModel()
        {
            MainMenuVisible     = false;
            GameMenuVisible     = false;
            SettingsMenuVisible = false;
            GameListVisible     = true;
            GameDetailsVisible  = false;
            FilterPanelVisible  = true;
            ProgressStatus      = "Status example in progress...";
            ProgressValue       = 50;
            ProgressTotal       = 100;
            ProgressVisible     = true;

            var database = new InMemoryGameDatabase();

            for (int i = 0; i < 25; i++)
            {
                database.Games.Add(new Game($"Test Game {i}")
                {
                    //Icon = ThemeFile.GetFilePath("Images/custom_cover_background.png", ThemeFile.GetDesignTimeDefaultTheme())
                });
            }

            GamesView = new FullscreenCollectionView(
                database,
                new PlayniteSettings(),
                new ExtensionFactory(database, new GameControllerFactory()));

            MainMenuVisible     = false;
            SettingsMenuVisible = false;
            AppSettings         = new PlayniteSettings();
            AppSettings.Fullscreen.ShowBattery           = true;
            AppSettings.Fullscreen.ShowBatteryPercentage = true;
            AppSettings.Fullscreen.ShowClock             = true;
            PlayniteApi = new PlayniteAPI(null, null, null, null, null, null, null, new NotificationsAPI());
            PlayniteApi.Notifications.Add(new NotificationMessage("1", "Some testing notification message.", NotificationType.Info));
            PlayniteApi.Notifications.Add(new NotificationMessage("2", "Some really long testing notification message that should be on more lines of text.", NotificationType.Error));
        }