private void CreateProfiles()
        {
            foreach(string game in gamesToAdd)
            {
                GameProfile.Create(null, game, GetGameName.GetName(game));
            }

            Console.WriteLine("Game profiles created!");
            Back();
        }
예제 #2
0
        private void ISOBrowser_Button_Click(object sender, RoutedEventArgs e)
        {
            VistaOpenFileDialog ISODialog = new VistaOpenFileDialog();

            ISODialog.Title = "Navigate to game file!";

            //Catch, when file filter is empty for future reference
            var empty = ISODialog.Filter;

            foreach (var type in SupportedGames.GameFiles)
            {
                //Forge a file dialog Filter Entry
                string fileType    = type.ToLower();
                string FilterEntry = $"{fileType} Files (*.{fileType})|*.{fileType}";

                if (ISODialog.Filter == empty)
                {
                    //If filter has no entries, simply add one
                    ISODialog.Filter = FilterEntry;
                }
                else
                {
                    //If filter has entries, check if current entry already exists
                    if (ISODialog.Filter.ToString().Contains(fileType) == false)
                    {
                        //If current entry doesn't exist, forge an entry and add it to filter
                        ISODialog.Filter = ISODialog.Filter + "|" + FilterEntry;
                    }
                }
            }
            if (ISODialog.ShowDialog().Value == true)
            {
                if (Properties.Settings.Default.titleAsFile)
                {
                    title = Path.GetFileNameWithoutExtension(ISODialog.FileName);
                }
                else
                {
                    title = GetGameName.GetName(ISODialog.FileName);
                }

                var file = ISODialog.FileName;
                title = GameProfile.Create(null, file, title);

                //Change initial button and text
                ISOBrowser_Text.Text         = $"{title} was added!";
                ISOBrowser_Button.Visibility = Visibility.Collapsed;

                Name_Textbox.Text = title;

                if (Properties.Settings.Default.autoBoxart == true)
                {
                    ProgressBar.Visibility = Visibility.Visible;
                    ISOBrowser_Text.Text   = $"Downloading boxart for {title}";
                    scrapingWorker.RunWorkerAsync();
                }
                else
                {
                    FadeButton();
                    FadeText();
                    FadeGrid();
                }
            }
        }