Example #1
0
        private void Extract_Click(object sender, RoutedEventArgs e)
        {
            if (TrophyFile == null)
            {
                OpenFileDialog fileDialog = new OpenFileDialog
                {
                    DefaultExt  = ".trp",
                    Filter      = "Trophy File|*.trp",
                    Multiselect = false
                };
                if (!fileDialog.ShowDialog(this).GetValueOrDefault(false))
                {
                    return;
                }
                TrophyFile = new TrophyFile(fileDialog.FileName);
            }

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                var dlg = new CommonOpenFileDialog();
                dlg.IsFolderPicker = true;
                if (dlg.ShowDialog() == CommonFileDialogResult.Ok)
                {
                    TrophyFile.ExportExtractedFiles(dlg.FileName);
                    Process.Start("explorer.exe", dlg.FileName);
                }
            }
        }
Example #2
0
        private void OpenButton_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog
            {
                DefaultExt  = ".trp",
                Filter      = "Trophy File|*.trp",
                Multiselect = false
            };

            if (!fileDialog.ShowDialog(this).GetValueOrDefault(false))
            {
                return;
            }
            TrophyFile = new TrophyFile(fileDialog.FileName);

            int i = 0;

            Tabs.Clear();
            foreach (SFMFile configFile in TrophyFile.ConfigFiles)
            {
                Tabs.Add(new TabItem {
                    Header = "Config #" + i, ConfigFile = configFile
                });
                i++;
            }
            DataContext = null;
            DataContext = this;
            ProfileTab.SelectedIndex = 0;
        }