public override void Write(Writer writer, Frame f) { CheckPreconditions(f); int size = TagDescriptionV1_0.SizeByFrameId[f.FrameId]; FrameDescription.FrameType type = DescriptionMap[f.FrameId].Type; System.IO.MemoryStream stream = new System.IO.MemoryStream(); (f.Content.Codec as FrameContentCodec1_0).FrameId = f.FrameId; f.Content.Codec.Write(stream, f.Content); byte[] buffer = stream.GetBuffer(); for (int i = 0; i < size; ++i) { if (i < stream.Length) { writer.WriteByte(buffer[i]); } else { writer.WriteByte(0); } } }
private void UpdateIsFixed(object sender, PropertyChangedEventArgs e) { Clear(); MultiTagItems.Clear(); if (IsFixed.Value) { foreach (var fm in FixedMeanings) { TagDescription desc = TagDescriptionMap.Instance[ID3.Version.v2_3]; Frame frame = new Frame(desc, fm); FrameDescription.FrameType type = desc[fm].Type; TagModelItem item = TagModelItemFactory.Create(type); item.Frame = frame; MultiTagModelItem mtmi = MultiTagModelItemFactory.Create(type); mtmi.InitFixed(item); MultiTagModelItems.Add(mtmi); } } adapter.UpdateItems(); }
public FrameContentCodecGeneric(FrameContentCodecGeneric other) { this.codecItems = other.codecItems; this.state.TextCodecSet = other.state.TextCodecSet; this.supportedVersions = other.supportedVersions; this.type = other.type; }
public FrameContentCodecGeneric(CodecDescription codec) { this.codecItems = codec.Entries; this.state.TextCodecSet = codec.TextCodecSet; this.supportedVersions = codec.SupportedVersions; this.type = codec.Type; }
public FrameContentCodecGeneric( IList <CodecItem> codecItems, TextCodecSet textCodecSet, Version[] supportedVersions, FrameDescription.FrameType type) { this.codecItems = codecItems; this.state.TextCodecSet = textCodecSet; this.supportedVersions = supportedVersions; this.type = type; }
public FrameContentCodecBase Parser(Version v, FrameDescription.FrameType t) { if (v == Version.v1_0 && t == FrameDescription.FrameType.Text) { return(FrameContentCodec1_0.instance); } else { return(new FrameContentCodecGeneric(Codec(v, t))); } }
public override int ReadContent(Reader reader, Frame f) { CheckPreconditions(f); FrameDescription.FrameType type = DescriptionMap[f.FrameId].Type; using (ReaderStream stream = new ReaderStream(reader, SizeContent, Reader.UnsyncMode.CountExcludesUnsyncBytes)) { (f.Content.Codec as FrameContentCodec1_0).FrameId = f.FrameId; f.Content.Codec.Read(stream, SizeContent, f.Content); stream.SeekToStreamEnd(); } return(SizeContent); }
public FrameContentCodecBase CreateContentCodec(FrameDescription.FrameType _type) { FrameContentCodecBase result = null; if (CodecRepository.Instance.HasCodec(Version, _type)) { result = CodecRepository.Instance.Parser(Version, _type); } else { result = CodecRepository.Instance.Parser(Version, FrameDescription.FrameType.Binary); } return(result); }
public FrameContent CreateContent(FrameDescription.FrameType _type) { FrameContent content = null; if (contentClasses.ContainsKey(_type)) { content = (FrameContent)Activator.CreateInstance(contentClasses[_type], new object[] { this }); } else { content = new FrameContentBinary(this); } content.DescriptionMap = this; return(content); }
public void AddContentClass(FrameDescription.FrameType _frameType, Type _contentClass) { contentClasses.Add(_frameType, _contentClass); }
public Type ContentClass(FrameDescription.FrameType _type) { return(contentClasses[_type]); }
public bool HasCodec(Version v, FrameDescription.FrameType t) { return((v == Version.v1_0 && t == FrameDescription.FrameType.Text) || (codecRepository.ContainsKey(v) && codecRepository[v].ContainsKey(t))); }
public CodecDescription Codec(Version v, FrameDescription.FrameType t) { return(codecRepository[v][t]); }
public CodecDescription(Version[] versions, FrameDescription.FrameType type) { this.supportedVersions = versions; this.type = type; this.textCodecSet = new TextCodecSet(versions); }