private async Task StartGameAsync(GameSystemVM system, IFileInfo file)
        {
            var dependenciesMet = await system.CheckDependenciesMetAsync();

            if (!dependenciesMet)
            {
                ResetSystemsSelection();
                await DisplayNotification(SystemUnmetDependenciesAlertTitleKey, SystemUnmetDependenciesAlertMessageKey);

                return;
            }

            var            folderNeeded = system.CheckRootFolderRequired(file);
            IDirectoryInfo folder       = null;

            if (folderNeeded)
            {
                await DisplayNotification(SelectFolderRequestAlertTitleKey, SelectFolderRequestAlertMessageKey);

                folder = await FileSystem.PickDirectoryAsync();

                if (folder == null)
                {
                    ResetSystemsSelection();
                    return;
                }

                if (!Path.GetDirectoryName(file.FullName).StartsWith(folder.FullName))
                {
                    ResetSystemsSelection();
                    await DisplayNotification(SelectFolderInvalidAlertTitleKey, SelectFolderInvalidAlertMessageKey);

                    return;
                }
            }

            var startSuccess = await EmulationService.StartGameAsync(system, file, folder);

            if (!startSuccess)
            {
                ResetSystemsSelection();
                await DisplayNotification(GameLoadingFailAlertTitleKey, GameLoadingFailAlertMessageKey);
            }
        }
Esempio n. 2
0
        private async Task StartGameAsync(T system, IFile file)
        {
            var     folderNeeded = EmulationService.CheckRootFolderRequired(system, file);
            IFolder folder       = null;

            if (folderNeeded)
            {
                await DisplayNotification(SelectFolderRequestAlertTitleKey, SelectFolderRequestAlertMessageKey);

                folder = await PlatformService.SelectFolderAsync();

                if (folder == null)
                {
                    return;
                }

                if (!Path.GetDirectoryName(file.Path).StartsWith(folder.Path))
                {
                    await DisplayNotification(SelectFolderInvalidAlertTitleKey, SelectFolderInvalidAlertMessageKey);

                    return;
                }
            }

            var startSuccess = await EmulationService.StartGameAsync(system, file, folder);

            if (!startSuccess)
            {
                var dependenciesMet = await EmulationService.CheckDependenciesMetAsync(system);

                if (dependenciesMet)
                {
                    await DisplayNotification(GameLoadingFailAlertTitleKey, GameLoadingFailAlertMessageKey);
                }
                else
                {
                    await DisplayNotification(SystemUnmetDependenciesAlertTitleKey, SystemUnmetDependenciesAlertMessageKey);
                }
            }
        }