Exemple #1
0
        private void MenuItemAddExistingProfile_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (Directory.Exists(UserFolders.XboxProfiles))
            {
                List <ListItem> profiles = new();

                foreach (string profile in Directory.GetFiles(UserFolders.XboxProfiles, "*.*", SearchOption.AllDirectories))
                {
                    profiles.Add(
                        new()
                    {
                        Name  = Path.GetFileName(profile),
                        Value = profile
                    });
                }

                if (profiles.Count > 0)
                {
                    ListItem profile = DialogExtensions.ShowListViewDialog(this, "Load Profile", profiles);

                    if (profile == null)
                    {
                        XtraMessageBox.Show(this, $"You don't have any profiles saved or none was selected.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        LoadProfile(profile.Value);
                    }
                }
                else
                {
                    XtraMessageBox.Show(this, $"You haven't saved any profiled.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Return the user's game region, either automatically by searching existing console
        /// directories or prompt the user to select one.
        /// </summary>
        /// <param name="gameId"> Game Id </param>
        /// <returns> </returns>
        public string GetGameRegion(Form owner, string gameId)
        {
            switch (MainWindow.Settings.RememberGameRegions)
            {
            case true:
            {
                string gameRegion = MainWindow.Settings.GetGameRegion(gameId);

                switch (string.IsNullOrEmpty(gameRegion))
                {
                case false:
                    return(gameRegion);
                }
                break;
            }
            }

            switch (MainWindow.Settings.AutoDetectGameRegions)
            {
            case true:
            {
                List <string> foundRegions = Regions.Where(region => FtpExtensions.DirectoryExists($"/dev_hdd0/game/{region}")).ToList();

                foreach (string region in foundRegions.Where(region => XtraMessageBox.Show($"Game Region: {region} has been found for: {Title}\n\nIs this correct?", "Game Region",
                                                                                           MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes))
                {
                    return(region);
                }

                XtraMessageBox.Show(
                    MainWindow.Window.LookAndFeel,
                    "Could not find any regions on your console for this game title. You must install the game update for this title first.",
                    "No Game Update", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return(null);
            }

            default:
                ListItem selectedItem = DialogExtensions.ShowListViewDialog(owner, "Game Regions", Regions.ToList().ConvertAll(x => new ListItem {
                    Value = x, Name = x
                }));
                return(selectedItem?.Value);
            }
        }