@@ -18,7 +18,9 @@ public record TrackMetadata
1818 public TimeSpan Duration { get ; private set ; }
1919 public byte [ ] ? Cover { get ; private set ; }
2020 private string _path = null ! ;
21+
2122 public Action ? MetadataLoaded ;
23+ public Action ? MetadataEdited ;
2224
2325 public void Init ( string path ) => _path = path ;
2426
@@ -45,13 +47,15 @@ public void FillTrackMetaData()
4547 }
4648
4749 [ Obsolete ( "Obsolete" ) ]
48- public void RewriteTags ( string title , string album , string artist , string genre , int year , string lyric , byte [ ] ? cover )
50+ public void RewriteTags ( string title , string album , string ? artist , string ? genre , int year , string lyric , byte [ ] ? cover )
4951 {
5052 using var file = File . Create ( _path ) ;
5153 file . Tag . Title = title ;
5254 file . Tag . Album = album ;
53- file . Tag . Artists = [ artist ] ;
54- file . Tag . Genres = [ genre ] ;
55+ if ( artist != null )
56+ file . Tag . Artists = [ artist ] ;
57+ if ( genre != null )
58+ file . Tag . Genres = [ genre ] ;
5559 file . Tag . Year = ( uint ) year ;
5660 file . Tag . Lyrics = lyric ;
5761
@@ -68,6 +72,8 @@ public void RewriteTags(string title, string album, string artist, string genre,
6872 }
6973
7074 file . Save ( ) ;
75+ FillTrackMetaData ( ) ;
76+ MetadataEdited ? . Invoke ( ) ;
7177 }
7278
7379 public override string ToString ( )
0 commit comments