// Multiple values for text tags are separated by ';'. void AddTextFrame(string Key, string Value) { if (TextFrames.ContainsKey(Key)) { TextFrames[Key] += ";" + Value; } else { TextFrames.Add(Key, Value); } }
/// <summary> /// Add Frame information to where it must store /// </summary> /// <param name="Data">FileStream contain Frame</param> /// <param name="FrameID">FrameID of frame</param> /// <param name="Length">Maximum available length to read</param> /// <param name="Flags">Flags of frame</param> private bool AddFrame(string FrameID, int Length, FrameFlags Flags, Stream FS) { // NOTE: All FrameIDs must be capital letters if (!FramesInfo.IsValidFrameID(FrameID)) { AddError(new ID3Exception("nonValid Frame found and dropped", FrameID, ExceptionLevels.Repaired)); return(false); } int IsText = FramesInfo.IsTextFrame(FrameID, _Version.Minor); if (IsText == 1) { TextFrame TempTextFrame = new TextFrame(FrameID, Flags, Length, FS); if (TempTextFrame.IsValid && !TextFrames.ContainsKey(FrameID)) { TextFrames.Add(FrameID, TempTextFrame); return(true); } return(false); } else if (IsText == 2) { UserTextFrame TempUserTextFrame = new UserTextFrame(FrameID, Flags, Length, FS); if (TempUserTextFrame.IsValid && FrameID != "TXXX" && !UserTextFrames.ContainsKey(FrameID)) { UserTextFrames.Add(FrameID, TempUserTextFrame); return(true); } return(false); } else if (FrameID == "LINK") { LinkFrame LF = new LinkFrame(FrameID, Flags, Length, FS); if (LF.IsValid && !LinkFrames.ContainsKey(FrameID)) { LinkFrames.Add(FrameID, LF); if (_LoadLinkedFrames) { LoadFrameFromFile(LF.FrameIdentifier, LF.URL); return(true); } } else { AddError(LF.Exception); } } Frame F = null; if (!FramesInfo.ExcludedList.Any(t => t == FrameID)) { FrameInfo Info = FramesInfo.GetFrame(FrameID); if (Info == null || Info.ClassType == null) { AddError(new ID3Exception("Unknown Frame found and dropped according to setting", FrameID, ExceptionLevels.Warning)); return(true); } try { F = Info.Constuctor(FrameID, Flags, Length, TStream.FS); } catch { } try { if (Info.IsSingle) { if (_SingleFrames.Contains(FrameID)) { _SingleFrames.Remove(FrameID); } _SingleFrames.Add(FrameID, F); return(true); } else { foreach (FrameCollectionBase Coll in _CollectionFrames.Values) { if (Coll.CollectionType == Info.ClassType) { Coll.Remove(F.FrameID); Coll.Add(F.FrameID, F); return(true); } } } AddError(new ID3Exception("ClassType not found in Collection list", FrameID, ExceptionLevels.Error)); } catch {} } return(false); }