Ejemplo n.º 1
0
        private void SongRefB_Click(object sender, RoutedEventArgs e)
        {
            if (TempNotes.Count > 0)
            {
                if (System.Windows.MessageBox.Show("まだ作業中のデータがありますが続行しますか?" +
                                                   "\n未保存のデータは削除されます",
                                                   "警告", MessageBoxButton.YesNo) == MessageBoxResult.No)
                {
                    return;
                }
            }
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter   = "音楽ファイル|*.mp3;*.wav;*.flac;*.m4a|全てのファイル|*.*";
            ofd.FileName = "";
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                TempNotes.Clear();
                if (!SetSong(ofd.FileName))
                {
                    return;
                }

                SongPathT.Text = ofd.FileName;

                RWTag.TagReader reader = new RWTag.TagReader();
                using (FileStream fs = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read))
                {
                    RWTag.Tag tag = reader.GetTag(fs, System.IO.Path.GetExtension(ofd.FileName));
                    TitleT.Text = tag.Title ?? System.IO.Path.GetFileNameWithoutExtension(ofd.FileName);
                }
            }
        }
Ejemplo n.º 2
0
        private void LoadB_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter   = "Suga Songファイル|*.sgsong";
            ofd.FileName = "";
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Music music = LoadMusicFromFile(ofd.FileName);
                TitleT.Text = music.Title;
                BPMT.Text   = music.BPM.ToString();

                TempNotes.Clear();
                foreach (Note note in music.Notes)
                {
                    TempNotes.Add(note);
                }

                string audio = System.IO.Path.GetDirectoryName(ofd.FileName) + music.Song;
                SetSong(audio);

                SongPathT.Text = audio;
            }
        }