国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

利用C#顯示MP3的標簽信息

2024-07-21 02:19:04
字體:
來源:轉載
供稿:網友
//目的:列出mp3的一些標簽信息
//作者:李艷慶
using system;
using system.io;

namespace mp3infons
{
class mp3info
{
struct mp3infostruct
{
public string mp3flag;
public string title;
public string singer;
public string album;
public string year;
public string comment;
}
private string mp3file;
mp3infostruct mp3struct;

public mp3info(string mp3name)
{
mp3file = mp3name;
mp3struct = new mp3infostruct();
}
public bool readmp3info()
{
bool isset=false;
byte[] b = new byte[128];
try
{
filestream fs = new filestream(mp3file, filemode.open);
fs.seek(-128, seekorigin.end);
fs.read(b, 0, 128);

mp3struct.mp3flag = system.text.encoding.default.getstring(b, 0, 3);
if (mp3struct.mp3flag.compareto("tag")==0)
{
//檢查是否設置了標簽
isset=true;
mp3struct.title = system.text.encoding.default.getstring (b,3,30);
mp3struct.singer = system.text.encoding.default.getstring (b,33,30);
mp3struct.album = system.text.encoding.default.getstring (b,63,30);
mp3struct.year = system.text.encoding.default.getstring (b,93,4);
mp3struct.comment = system.text.encoding.default.getstring (b,97,30);
}
fs.close();
}
catch(exception e)
{
system.console.writeline(e.message);
}
return isset;
}
public void printmp3info()
{
system.console.writeline("mp3附加信息:");
system.console.writeline("-----------------------------");
system.console.writeline("標 題: " + mp3struct.title);
system.console.writeline("歌 手: " + mp3struct.singer);
system.console.writeline("唱片集: " + mp3struct.album);
system.console.writeline("出版期: " + mp3struct.year);
system.console.writeline("備 注: " + mp3struct.comment);
}
}
public class mainmp3
{
static void main(string[] args)
{
if (args.length == 1)
{
mp3info mp3 = new mp3info(args[0]);
bool f = mp3.readmp3info();
if (f)
{
mp3.printmp3info();
}
else
{
system.console.writeline("該mp3沒有標注");
}
}
else
{
system.console.writeline("參數不正確,只能跟一個參數");
}
}
}
}


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 文水县| 重庆市| 雷波县| 邵阳县| 巴中市| 萍乡市| 葫芦岛市| 突泉县| 凤山县| 双柏县| 铁岭市| 泰来县| 鹤岗市| 钟祥市| 尼勒克县| 英山县| 米泉市| 策勒县| 康乐县| 麻江县| 五大连池市| 寿光市| 大丰市| 沙田区| 明水县| 阿巴嘎旗| 昂仁县| 安徽省| 蓝田县| 嵊泗县| 天柱县| 明星| 库伦旗| 龙州县| 兰考县| 邵阳市| 白河县| 浏阳市| 盐源县| 临泉县| 如皋市|