public TaikoVisualizer(TaikoParser taiko, string audioFile) : base(audioFile) { BeatmapFile = taiko.BeatmapFile; ReplayFile = taiko.ReplayFile; }
private void StartReplay_Click(object sender, RoutedEventArgs e) { string path = BeatmapFilePath.Text; try { List <string> beatmapFile = File.ReadAllLines(path).ToList(); int keyCount = int.Parse(beatmapFile.FirstOrDefault(x => x.StartsWith("CircleSize:")).Split(':')[1].Trim()); string audioFile = path.Substring(0, path.LastIndexOf('\\') + 1) + beatmapFile.FirstOrDefault(x => x.StartsWith("AudioFilename:")).Split(':')[1].Trim(); int mode = int.Parse(beatmapFile.FirstOrDefault(x => x.StartsWith("Mode:")).Split(':')[1].Trim()); if (mode == 3) { ManiaParser mania = new ManiaParser(); try { mania.ReadReplay(ReplayFilePath.Text.Trim('"')); } catch { MessageBox.Show("Invalid Replay Filepath"); return; } try { mania.ReadBeatmap(beatmapFile, keyCount); } catch { MessageBox.Show("Invalid Beatmap Filepath"); return; } new Thread(() => { ManiaVisualizer maniaVis = new ManiaVisualizer(mania, audioFile); ThisWin.Dispatcher.Invoke(() => visualizer = maniaVis); maniaVis.Start(); }).Start(); } if (mode == 1) { TaikoParser taiko = new TaikoParser(); try { taiko.ReadReplay(ReplayFilePath.Text.Trim('"')); } catch { MessageBox.Show("Invalid Replay Filepath"); return; } try { taiko.ReadBeatmap(beatmapFile, keyCount); } catch { MessageBox.Show("Invalid Beatmap Filepath"); return; } new Thread(() => { TaikoVisualizer taikoVis = new TaikoVisualizer(taiko, audioFile); ThisWin.Dispatcher.Invoke(() => visualizer = taikoVis); taikoVis.Start(); }).Start(); } } catch (Exception) { MessageBox.Show("Invalid Beatmap Filepath"); } }