private void UpdateValues(Stream stream) { this.v1Info = new ID3v1(stream); this.v2Info = new ID3v2(stream); artist = longest(v2Info.Artist, v1Info.Artist); album = longest(v2Info.Album, v1Info.Album); title = longest(v2Info.Title, v1Info.Title); if (this.ID3v2.TrackNumber > 0 && ID3v1.TrackNumber > 0) trackstring = ID3v2.TrackString; else if (ID3v1.TrackNumber <= 0) trackstring = ID3v2.TrackString; else trackstring = ID3v1.TrackNumber.ToString("0"); if (ID3v2.TrackNumber >= 0) tracknumber = ID3v2.TrackNumber; else tracknumber = ID3v1.TrackNumber; searchstring = (artist + " " + album + " " + title + file.Name.Substring(0, file.Name.LastIndexOf('.'))).ToLower(); while (searchstring.Contains(" ")) searchstring = searchstring.Replace(" ", " "); searchstring = searchstring.Trim(); }
/// <summary> /// internal - Initializes a new, and empty, instance of the <see cref="ID3info"/> class. /// </summary> internal ID3info() { this.artist = null; this.album = null; this.title = null; this.trackstring = null; this.tracknumber = -1; this.file = null; this.v1Info = null; this.v2Info = null; }
public void UpdateValues() { if (!this.FileExists) { this.artist = null; this.album = null; this.title = null; this.trackstring = null; this.tracknumber = -1; this.v1Info = null; this.v2Info = null; return; } using (FileStream fs = new FileStream(this.file.FullName, FileMode.Open)) UpdateValues(fs); }