private void Read(ReadStyle propertiesStyle) { // Look for an ID3v1 tag long id3v1Location = FindId3v1(); if (id3v1Location >= 0) { id3v1Tag = new Id3v1Tag(this, id3v1Location); } // Look for an APE tag long apeLocation = FindApe(id3v1Location != -1); if (apeLocation >= 0) { apeTag = new ApeTag(this, apeLocation); } tag.SetTags(apeTag, id3v1Tag); FindWavPackTag(TagTypes.Ape, true); // Look for MPC metadata if (propertiesStyle != ReadStyle.None) { Seek(0); properties = new WavPackProperties(ReadBlock((int)WavPackProperties.HeaderSize), apeLocation + ApeFooter.Size - apeTag.Footer.CompleteTagSize); } }
private Tag FindMpcTag(TagTypes type, bool create) { switch (type) { case TagTypes.Id3v2: { if (create && id3v2Tag == null) { id3v2Tag = new Id3v2Tag(); if (tag != null) { TagLib.Tag.Duplicate(tag, id3v2Tag, true); } tag.SetTags(apeTag, id3v2Tag, id3v1Tag); } return(id3v2Tag); } case TagTypes.Id3v1: { if (create && id3v1Tag == null) { id3v1Tag = new Id3v1Tag(); if (tag != null) { TagLib.Tag.Duplicate(tag, id3v1Tag, true); } tag.SetTags(apeTag, id3v2Tag, id3v1Tag); } return(id3v1Tag); } case TagTypes.Ape: { if (create && apeTag == null) { apeTag = new ApeTag(); if (tag != null) { TagLib.Tag.Duplicate(tag, apeTag, true); } tag.SetTags(apeTag, id3v2Tag, id3v1Tag); } return(apeTag); } default: return(null); } }
public void Remove(TagTypes types) { if ((types & TagTypes.Id3v1) != 0) { id3v1Tag = null; } if ((types & TagTypes.Ape) != 0) { apeTag = null; } tag.SetTags(apeTag, id3v1Tag); }
private void Read(ReadStyle propertiesStyle) { // Look for an ID3v1 tag long id3v1Location = FindId3v1(); if (id3v1Location >= 0) { id3v1Tag = new Id3v1Tag(this, id3v1Location); } // Look for an APE tag long apeLocation = FindApe(id3v1Location != 0); if (apeLocation >= 0) { apeTag = new ApeTag(this, apeLocation); } // Look for an ID3v2 tag long id3v2Location = FindId3v2(); if (id3v2Location >= 0) { id3v2Tag = new Id3v2Tag(this, id3v2Location); } tag.SetTags(apeTag, id3v2Tag, id3v1Tag); FindMpcTag(TagTypes.Ape, true); // Look for MPC metadata Seek((id3v2Location >= 0) ? (id3v2Location + id3v2Tag.Header.CompleteTagSize) : 0); if (propertiesStyle != ReadStyle.None) { properties = new MpcProperties(ReadBlock((int)MpcProperties.HeaderSize), Length - Tell - apeTag.Footer.CompleteTagSize); } }
private void Read(ReadStyle propertiesStyle) { // Look for an ID3v2 tag long id3v2_location = FindId3v2(); if (id3v2_location >= 0) { id3v2_tag = new Id3v2Tag(this, id3v2_location); } // Look for an ID3v1 tag long id3v1_location = FindId3v1(); if (id3v1_location >= 0) { id3v1_tag = new Id3v1Tag(this, id3v1_location); } // Look for an APE tag long ape_location = FindApe(id3v1_location >= 0); if (ape_location >= 0) { ape_tag = new ApeTag(this, ape_location); } tag.SetTags(id3v2_tag, ape_tag, id3v1_tag); FindMpegTag(TagTypes.Id3v2, true); if (propertiesStyle != ReadStyle.None) { properties = new MpegProperties(this, propertiesStyle); } }
private Tag FindWavPackTag(TagTypes type, bool create) { switch (type) { case TagTypes.Id3v1: { if (create && id3v1Tag == null) { id3v1Tag = new Id3v1Tag(); if (tag != null) TagLib.Tag.Duplicate(tag, id3v1Tag, true); tag.SetTags(apeTag, id3v1Tag); } return id3v1Tag; } case TagTypes.Ape: { if (create && apeTag == null) { apeTag = new ApeTag(); if (tag != null) TagLib.Tag.Duplicate(tag, apeTag, true); tag.SetTags(apeTag, id3v1Tag); } return apeTag; } default: return null; } }
public void Remove(TagTypes types) { if ((types & TagTypes.Id3v1) != 0) id3v1Tag = null; if ((types & TagTypes.Ape) != 0) apeTag = null; tag.SetTags(apeTag, id3v1Tag); }
private void Read(ReadStyle propertiesStyle) { // Look for an ID3v1 tag long id3v1Location = FindId3v1(); if (id3v1Location >= 0) id3v1Tag = new Id3v1Tag(this, id3v1Location); // Look for an APE tag long apeLocation = FindApe(id3v1Location != -1); if (apeLocation >= 0) apeTag = new ApeTag(this, apeLocation); tag.SetTags(apeTag, id3v1Tag); FindWavPackTag(TagTypes.Ape, true); // Look for MPC metadata if (propertiesStyle != ReadStyle.None) { Seek(0); properties = new WavPackProperties(ReadBlock((int)WavPackProperties.HeaderSize), apeLocation + ApeFooter.Size - apeTag.Footer.CompleteTagSize); } }
public bool Strip (TagTypes types, bool freeMemory) { FileAccessMode original_mode = Mode; if(IsReadOnly) { TagLibDebugger.Debug("Mpeg.File.Strip() - Cannot strip tags from a read only file."); return false; } try { Mode = FileAccessMode.Write; } catch (TagLibException) { TagLibDebugger.Debug("Mpeg.File.Strip() - Cannot strip tags from a read only file."); return false; } if ((types & TagTypes.Id3v2) != 0) { long id3v2_location = FindId3v2 (); if (id3v2_location >= 0) { Seek(id3v2_location); Id3v2Header header = new Id3v2Header (ReadBlock ((int)Id3v2Header.Size)); if (header.TagSize == 0) TagLibDebugger.Debug ("Mpc.File.Save() -- Id3v2 header is broken. Ignoring."); else RemoveBlock (id3v2_location, (int) header.CompleteTagSize); } if (freeMemory) id3v2_tag = null; } long id3v1_location = FindId3v1 (); if ((types & TagTypes.Id3v1) != 0) { if (id3v1_location >= 0) { Truncate(id3v1_location); id3v1_location = -1; } if (freeMemory) id3v1_tag = null; } if ((types & TagTypes.Ape) != 0) { long ape_location = FindApe (id3v1_location >= 0); if (ape_location != -1) { Seek(ape_location); int ape_size = (int) (new ApeFooter(ReadBlock((int) ApeFooter.Size))).CompleteTagSize; ape_location = ape_location + ApeFooter.Size - ape_size; RemoveBlock(ape_location, ape_size); } if (freeMemory) ape_tag = null; } tag.SetTags(id3v2_tag, ape_tag, id3v1_tag); Mode = original_mode; return true; }
private void Read(ReadStyle propertiesStyle) { // Look for an ID3v2 tag long id3v2_location = FindId3v2(); if (id3v2_location >= 0) id3v2_tag = new Id3v2Tag(this, id3v2_location); // Look for an ID3v1 tag long id3v1_location = FindId3v1(); if (id3v1_location >= 0) id3v1_tag = new Id3v1Tag(this, id3v1_location); // Look for an APE tag long ape_location = FindApe(id3v1_location >= 0); if (ape_location >= 0) ape_tag = new ApeTag(this, ape_location); tag.SetTags(id3v2_tag, ape_tag, id3v1_tag); FindMpegTag(TagTypes.Id3v2, true); if (propertiesStyle != ReadStyle.None) properties = new MpegProperties(this, propertiesStyle); }
private void Read(ReadStyle propertiesStyle) { // Look for an ID3v1 tag long id3v1Location = FindId3v1(); if (id3v1Location >= 0) { id3v1Tag = new Id3v1Tag(this, id3v1Location); } // Look for an APE tag long apeLocation = FindApe(id3v1Location != 0); if (apeLocation >= 0) apeTag = new ApeTag(this, apeLocation); // Look for an ID3v2 tag long id3v2Location = FindId3v2(); if (id3v2Location >= 0) id3v2Tag = new Id3v2Tag(this, id3v2Location); tag.SetTags(apeTag, id3v2Tag, id3v1Tag); FindMpcTag(TagTypes.Ape, true); // Look for MPC metadata Seek((id3v2Location >= 0) ? (id3v2Location + id3v2Tag.Header.CompleteTagSize) : 0); if (propertiesStyle != ReadStyle.None) properties = new MpcProperties(ReadBlock((int)MpcProperties.HeaderSize), Length - Tell - apeTag.Footer.CompleteTagSize); }
public bool Strip(TagTypes types, bool freeMemory) { FileAccessMode original_mode = Mode; if (IsReadOnly) { TagLibDebugger.Debug("Mpeg.File.Strip() - Cannot strip tags from a read only file."); return(false); } try { Mode = FileAccessMode.Write; } catch (TagLibException) { TagLibDebugger.Debug("Mpeg.File.Strip() - Cannot strip tags from a read only file."); return(false); } if ((types & TagTypes.Id3v2) != 0) { long id3v2_location = FindId3v2(); if (id3v2_location >= 0) { Seek(id3v2_location); Id3v2Header header = new Id3v2Header(ReadBlock((int)Id3v2Header.Size)); if (header.TagSize == 0) { TagLibDebugger.Debug("Mpc.File.Save() -- Id3v2 header is broken. Ignoring."); } else { RemoveBlock(id3v2_location, (int)header.CompleteTagSize); } } if (freeMemory) { id3v2_tag = null; } } long id3v1_location = FindId3v1(); if ((types & TagTypes.Id3v1) != 0) { if (id3v1_location >= 0) { Truncate(id3v1_location); id3v1_location = -1; } if (freeMemory) { id3v1_tag = null; } } if ((types & TagTypes.Ape) != 0) { long ape_location = FindApe(id3v1_location >= 0); if (ape_location != -1) { Seek(ape_location); int ape_size = (int)(new ApeFooter(ReadBlock((int)ApeFooter.Size))).CompleteTagSize; ape_location = ape_location + ApeFooter.Size - ape_size; RemoveBlock(ape_location, ape_size); } if (freeMemory) { ape_tag = null; } } tag.SetTags(id3v2_tag, ape_tag, id3v1_tag); Mode = original_mode; return(true); }