From ad1682b0a7eb2fe2971ee5a744fee21f250ec53b Mon Sep 17 00:00:00 2001 From: tmokmss Date: Sat, 20 Oct 2018 01:46:38 +0900 Subject: [PATCH] add selectors to choose which game mode to convert --- Osu2Saber/Model/BatchProcessor.cs | 13 +++++++++---- Osu2Saber/Model/OszProcessor.cs | 3 +-- Osu2Saber/View/ConfigPanel.xaml | 4 ++++ Osu2Saber/ViewModel/ConfigPanelViewModel.cs | 20 +++++++++++++++++++- 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/Osu2Saber/Model/BatchProcessor.cs b/Osu2Saber/Model/BatchProcessor.cs index fc4fe60..99083fb 100644 --- a/Osu2Saber/Model/BatchProcessor.cs +++ b/Osu2Saber/Model/BatchProcessor.cs @@ -8,6 +8,10 @@ namespace Osu2Saber.Model { class BatchProcessor : BindableBase { + public static bool IncludeTaiko { set; get; } = false; + public static bool IncludeCtB { set; get; } = true; + public static bool IncludeMania { set; get; } = true; + object progressLock = new object(); double progress; Logger logger; @@ -75,10 +79,11 @@ Osu2BsConverter ConvertBeatmap(OszProcessor oszp) OutputDir = Osu2BsConverter.WorkDir; var o2b = new Osu2BsConverter(oszp.OutDir, oszp.OszName); - foreach (var osufile in oszp.LoadOsuFiles()) - { - o2b.AddBeatmap(osufile); - } + oszp.LoadOsuFiles() + .Where(osuFile => IncludeTaiko || osuFile.Mode != 1) + .Where(osuFile => IncludeCtB || osuFile.Mode != 2) + .Where(osuFile => IncludeMania || osuFile.Mode != 3) + .ToList().ForEach(osufile => o2b.AddBeatmap(osufile)); o2b.ProcessAll(); diff --git a/Osu2Saber/Model/OszProcessor.cs b/Osu2Saber/Model/OszProcessor.cs index 53ac03e..5caaf10 100644 --- a/Osu2Saber/Model/OszProcessor.cs +++ b/Osu2Saber/Model/OszProcessor.cs @@ -78,8 +78,7 @@ public IEnumerable LoadOsuFiles() { var beatmaps = OsuFiles .Select(file => LoadOsuFile(file)) - .Where(map => map != null) - .Where(map => map.Mode != 1); // exclude taiko map + .Where(map => map != null); return beatmaps; } } diff --git a/Osu2Saber/View/ConfigPanel.xaml b/Osu2Saber/View/ConfigPanel.xaml index 5c7ae67..069c375 100644 --- a/Osu2Saber/View/ConfigPanel.xaml +++ b/Osu2Saber/View/ConfigPanel.xaml @@ -23,6 +23,10 @@ +