public static ID3v1Tag FromV2Tag(TagBase tag, IGenreManager genreManager) { if (tag == null) { throw new ArgumentNullException("tag", "Argument 'tag' can not be null."); } ID3v1Tag information = new ID3v1Tag(); Frames.AlbumTextFrame album = tag.SearchForFrame(typeof(Frames.AlbumTextFrame)) as Frames.AlbumTextFrame; Frames.ArtistTextFrame artist = tag.SearchForFrame(typeof(Frames.ArtistTextFrame)) as Frames.ArtistTextFrame; Frames.CommentExtendedTextFrame comment = tag.SearchForFrame(typeof(Frames.CommentExtendedTextFrame)) as Frames.CommentExtendedTextFrame; Frames.GenreTextFrame genre = tag.SearchForFrame(typeof(Frames.GenreTextFrame)) as Frames.GenreTextFrame; Frames.ReleaseTimeTextFrame releaseTime = tag.SearchForFrame(typeof(Frames.ReleaseTimeTextFrame)) as Frames.ReleaseTimeTextFrame; Frames.TitleTextFrame title = tag.SearchForFrame(typeof(Frames.TitleTextFrame)) as Frames.TitleTextFrame; Frames.TrackTextFrame track = tag.SearchForFrame(typeof(Frames.TrackTextFrame)) as Frames.TrackTextFrame; Frames.YearTextFrame year = tag.SearchForFrame(typeof(Frames.YearTextFrame)) as Frames.YearTextFrame; if (album != null) { information.Album = album.Text; } if (artist != null) { information.Artist = album.Text; } if (comment != null) { information.Comment = album.Text; } if (genre != null) { information.GenreCode = genreManager.GetGenreCode(genre.Text); } if (releaseTime != null) { information.Year = releaseTime.Text.Substring(0, 4); } else if (year != null) { information.Year = year.Text; } if (track != null) { information.TrackNumber = (byte)track.TrackNumber; } if (title != null) { information.Title = title.Text; } return(information); }
public static ID3v1Tag FromV2Tag(TagBase tag, IGenreManager genreManager) { if(tag==null) { throw new ArgumentNullException("tag", "Argument 'tag' can not be null."); } ID3v1Tag information=new ID3v1Tag(); Frames.AlbumTextFrame album=tag.SearchForFrame(typeof(Frames.AlbumTextFrame)) as Frames.AlbumTextFrame; Frames.ArtistTextFrame artist=tag.SearchForFrame(typeof(Frames.ArtistTextFrame)) as Frames.ArtistTextFrame; Frames.CommentExtendedTextFrame comment=tag.SearchForFrame(typeof(Frames.CommentExtendedTextFrame)) as Frames.CommentExtendedTextFrame; Frames.GenreTextFrame genre=tag.SearchForFrame(typeof(Frames.GenreTextFrame)) as Frames.GenreTextFrame; Frames.ReleaseTimeTextFrame releaseTime=tag.SearchForFrame(typeof(Frames.ReleaseTimeTextFrame)) as Frames.ReleaseTimeTextFrame; Frames.TitleTextFrame title=tag.SearchForFrame(typeof(Frames.TitleTextFrame)) as Frames.TitleTextFrame; Frames.TrackTextFrame track=tag.SearchForFrame(typeof(Frames.TrackTextFrame)) as Frames.TrackTextFrame; Frames.YearTextFrame year=tag.SearchForFrame(typeof(Frames.YearTextFrame)) as Frames.YearTextFrame; if(album!=null) information.Album=album.Text; if(artist!=null) information.Artist=album.Text; if(comment!=null) information.Comment=album.Text; if(genre!=null) information.GenreCode=genreManager.GetGenreCode(genre.Text); if(releaseTime!=null) information.Year=releaseTime.Text.Substring(0, 4); else if(year!=null) information.Year=year.Text; if(track!=null) information.TrackNumber=(byte)track.TrackNumber; if (title != null) information.Title=title.Text; return information; }