コード例 #1
0
        public void initialize(Song song)
        {
            if (song.usingTagLib) {

                metaFile = song.tagFile;

                this.Text = song.ToString();
                textBox_Title.Text = metaFile.Tag.Title;
                textBox_Artist.Text = metaFile.Tag.FirstPerformer;
                if (metaFile.Tag.Genres.Length > 0)
                    textBox_Genre.Text = metaFile.Tag.Genres[0];
                foreach (String genre in metaFile.Tag.Genres)
                    textBox_Genre.Text += "; " + genre;
                textBox_Album.Text = metaFile.Tag.Album;
                textBox_Year.Text = "" + metaFile.Tag.Year;
                textBox_Comments.Text = metaFile.Tag.Comment;

                button_SaveChanges.Enabled = true;

            } else if (song.usingId3Tag && !song.fileCorrupted) {

                id3Tag = song.id3Tag;

                this.Text = song.ToString();
                textBox_Title.Text = id3Tag.Title.Value;
                textBox_Artist.Text = id3Tag.Artists.Value;
                textBox_Genre.Text = id3Tag.Genre.Value;
                textBox_Album.Text = id3Tag.Album.Value;
                textBox_Year.Text = "" + id3Tag.Year.Value;
                foreach (CommentFrame comment in id3Tag.Comments)
                    textBox_Comments.Text += comment.Comment + "\n";

                button_SaveChanges.Enabled = true;

            } else {
                //initialized = false;

                textBox_Title.Text = null;
                textBox_Artist.Text = null;
                textBox_Genre.Text = null;
                textBox_Album.Text = null;
                textBox_Year.Text = null;
                textBox_Comments.Text = null;

                button_SaveChanges.Enabled = false;
            }
        }