/// <summary>Tries to the get frame with the specified properties.</summary> /// <param name="name">The name.</param> /// <param name="frame">The frame.</param> /// <returns></returns> public bool TryGetTXXXFrame(string name, out ID3v2TXXXFrame frame) { foreach (ID3v2Frame f in frames) { frame = f as ID3v2TXXXFrame; if (frame == null) { continue; } if (!string.Equals(name, frame.Name, StringComparison.InvariantCultureIgnoreCase)) { continue; } return(true); } frame = default(ID3v2TXXXFrame); return(false); }
bool ParseFrames(ID3v2Reader reader) { while (reader.State == ID3v2ReaderState.ReadFrames) { if (!reader.ReadFrame(out var frame)) { if (frames.Count > 0) { if (reader.Available > 0) { Trace.WriteLine(string.Format("Invalid frame in id3v2 tag, ignoring remaining data of {0} bytes.", reader.Available)); ParserError = true; } return(true); } return(false); } if (frame == null) { continue; } switch (frame.ID) { case "APIC": frame = new ID3v2APICFrame(frame); break; case "COMM": frame = new ID3v2COMMFrame(frame); break; case "ETCO": frame = new ID3v2ETCOFrame(frame); break; case "GEOB": /*TODO*/ break; case "IPLS": frame = new ID3v2IPLSFrame(frame); break; case "MCDI": frame = new ID3v2MCDIFrame(frame); break; case "MLLT": frame = new ID3v2MLLTFrame(frame); break; case "NCON": /*TODO*/ break; case "PCNT": frame = new ID3v2PCNTFrame(frame); break; case "PRIV": frame = new ID3v2PRIVFrame(frame); break; case "SYLT": frame = new ID3v2SYLTFrame(frame); break; case "SYTC": frame = new ID3v2SYTCFrame(frame); break; case "TXXX": frame = new ID3v2TXXXFrame(frame); break; case "UFID": frame = new ID3v2UFIDFrame(frame); break; case "USLT": frame = new ID3v2USLTFrame(frame); break; case "WXXX": frame = new ID3v2WXXXFrame(frame); break; case "XSLT": frame = new ID3v2XSLTFrame(frame); break; default: // TODO IMPLEMENT ME switch (frame.ID[0]) { case 'W': frame = new ID3v2WebFrame(frame); break; case 'T': frame = new ID3v2TextFrame(frame); break; default: Trace.WriteLine(string.Format("Unknown ID3v2 frame type {0}", frame.ID)); break; } break; } frames.Add(frame); } return(true); }