/// <summary> /// Save <see cref="TagLib.Tag"/> into specified separated file. /// </summary> /// <remarks> /// It is saving only tags. It won't save pictures in it. /// </remarks> /// <param name="tag"></param> /// <param name="fileName"></param> /// <param name="mimeType"></param> /// <param name="style"></param> public static void PutIntoFile(this TagLib.Tag tag, string fileName, string mimeType = "audio/mpeg", TagLib.ReadStyle style = TagLib.ReadStyle.None) { using TagLib.File tlb = TagLib.File.Create(fileName, mimeType, style); tag.CopyTo(tlb.Tag, true); tlb.Save(); }
/// <summary> /// Load <see cref="TagLib.Tag"/> from the specified file location /// </summary> /// <param name="tag"></param> /// <param name="fileName"></param> public static void LoadFromFile(this TagLib.Tag tag, string fileName, string mimeType = "audio/mpeg", TagLib.ReadStyle style = TagLib.ReadStyle.None) { using TagLib.File tlf = TagLib.File.Create(fileName, mimeType, style); tlf.Tag.CopyTo(tag, true); }