private void MountClicked(object sender, RoutedEventArgs e) { List <Title> selected = new List <Title>(); foreach (TitleElement info in ListView.Items) { if (info.Selected) { selected.Add(info.Title); } } List <Title> orderedTitles = Element.OrderTitlesByBest(); Title baseTitle = orderedTitles.FirstOrDefault(t => t.Metadata.Type == TitleType.Application); if (baseTitle == null && orderedTitles.Count == 1) { baseTitle = orderedTitles.First(); } if (!IsMountable(baseTitle, selected)) { MessageBox.Show("The base game isn't available, so the patch cannot be mounted."); return; } Dictionary <NcaFormatType, List <Tuple <SwitchFsNca, int> > > indexed = new Dictionary <NcaFormatType, List <Tuple <SwitchFsNca, int> > >(); foreach (Title title in selected) { SwitchFsNca nca = title.MainNca; if (nca.Nca.Header.ContentType != ContentType.Meta) { for (int i = 0; i < 4; i++) { if (!nca.Nca.Header.IsSectionEnabled(i)) { continue; } NcaFsHeader section = nca.Nca.Header.GetFsHeader(i); if (!indexed.ContainsKey(section.FormatType)) { indexed[section.FormatType] = new List <Tuple <SwitchFsNca, int> >(); } indexed[section.FormatType].Add(new Tuple <SwitchFsNca, int>(nca, i)); } } } Window window = new TitleMountDialog(indexed, baseTitle.MainNca) { Owner = Window.GetWindow(this) }; window.ShowDialog(); }
private void MountClicked(object sender, RoutedEventArgs e) { List <SwitchFsNca> selected = new List <SwitchFsNca>(); foreach (NcaElement info in ListView.Items) { if (info.Selected) { selected.Add(info.Nca); } } Dictionary <NcaFormatType, List <Tuple <SwitchFsNca, int> > > indexed = new Dictionary <NcaFormatType, List <Tuple <SwitchFsNca, int> > >(); foreach (SwitchFsNca nca in selected) { for (int i = 0; i < 4; i++) { if (!nca.Nca.Header.IsSectionEnabled(i)) { continue; } NcaFsHeader section = nca.Nca.Header.GetFsHeader(i); if (!indexed.ContainsKey(section.FormatType)) { indexed[section.FormatType] = new List <Tuple <SwitchFsNca, int> >(); } indexed[section.FormatType].Add(new Tuple <SwitchFsNca, int>(nca, i)); } } Window window = new TitleMountDialog(indexed) { Owner = Window.GetWindow(this) }; window.ShowDialog(); }