
โค้ด
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้public static void SetTitleFile(string _File, string _Artist, string _Album)
{
string f = _File;
string Artist = _Artist;
string Album = _Album;
if (!System.IO.File.Exists(f)) return;
/* try
{*/
var file = TagLib.File.Create(f);
string title = Path.GetFileNameWithoutExtension(f);
if (file.Tag.FirstAlbumArtist != Artist || file.Tag.Album != Album || file.Tag.Title != title)
{
FileAttributes attributes = System.IO.File.GetAttributes(f);
bool isReadOnly = (attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly;
if (isReadOnly)
{
// เปลี่ยนสถานะเป็น writeable
System.IO.File.SetAttributes(f, attributes & ~FileAttributes.ReadOnly);
}
file.Tag.Performers = new string[] { Artist };
file.Tag.Album = Album;
file.Tag.Title = title;
file.Save();
}
/* }
catch{ }*/
}
โค้ด นี้ ใช้กับ .net core แล้ว Error แต่ใช้กับ .net 4.8 กลับใช้ได้ปกติ ครับ
ไม่ทราบว่าเกิดจากอะไร
C# TagLib Sharp ใช้กับ .net core ไม่ได้ แต่ใช้กับ .net framwork ได้ปกติ ไม่ทราบว่าเพราะอะไร ครับ
โค้ด
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้
โค้ด นี้ ใช้กับ .net core แล้ว Error แต่ใช้กับ .net 4.8 กลับใช้ได้ปกติ ครับ
ไม่ทราบว่าเกิดจากอะไร