/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App/Helpers/MediaFileHelper.cs
30 строк
711 B
yair100
Feature: Added support for removing album cover (#18611)
19 июн 2026, 00:03
Не верифицирован
19 июн 2026, 00:03
28dfdbc
Код
Авторство
О чём код?
using TagLib; namespace Files.App.Helpers { internal sealed class MediaFileHelper { /// <summary> /// Changes the album cover for a given <paramref name="filePath"/>. /// </summary> /// <param name="filePath">The file path to change the album cover.</param> /// <param name="albumCover">The album cover to use, or <c>null</c> to clear any embedded cover.</param> public static bool ChangeAlbumCover(string filePath, Picture albumCover) { try { File mediaFile = File.Create(filePath); mediaFile.Tag.Pictures = albumCover is null ? [] : [albumCover]; mediaFile.Save(); mediaFile.Dispose(); return true; } catch (Exception) { return false; } } } }