shell32 获取文件(MP3)详细信息

public Mp3Info GetMP3Info(string songPath)
        {

            Mp3Info mp3info = new Mp3Info();
            

            string file = songPath;
            ShellClass sh = new ShellClass();
            Folder dir = sh.NameSpace(Path.GetDirectoryName(file));
            FolderItem item = dir.ParseName(Path.GetFileName(file));


            //获取Tags
            string tag = dir.GetDetailsOf(item,18);
            mp3info.tag = tag.ToString();

            //获取歌名 
            string songName = dir.GetDetailsOf(item,21);
            mp3info.Title = songName.ToString();

            //获取歌手
            string artist = dir.GetDetailsOf(item,13);
            mp3info.Artist = artist.ToString();

            //获取歌曲路径
            mp3info.songPath = songPath;


            //获取歌曲时长
            string songTime =  dir.GetDetailsOf(item, 27);
            mp3info.songTime = songTime.Substring(3);

            
            return mp3info;

            //GetDetailsOf第二个参数实际意义如下:


            //0   => Name
            //1   => Size
            //2   => Type
            //3   => Date modified
            //4   => Date created
            //5   => Date accessed
            //6   => Attributes
            //7   => Offline status
            //8   => Offline availability
            //9   => Perceived type
            //10  => Owner
            //11  => Kinds
            //12  => Date taken
            //13  => Artists
            //14  => Album
            //15  => Year
            //16  => Genre
            //17  => Conductors
            //18  => Tags
            //19  => Rating
            //20  => Authors
            //21  => Title
            //22  => Subject
            //23  => Categories
            //24  => Comments
            //25  => Copyright
            //26  => #
            //27  => Length
            //28  => Bit rate
            //29  => Protected
            //30  => Camera model
            //31  => Dimensions
            //32  => Camera maker
            //33  => Company
            //34  => File description
            //35  => Program name
            //36  => Duration
            //37  => Is online
            //38  => Is recurring
            //39  => Location
            //40  => Optional attendee addresses
            //41  => Optional attendees
            //42  => Organizer address
            //43  => Organizer name
            //44  => Reminder time
            //45  => Required attendee addresses
            //46  => Required attendees
            //47  => Resources
            //48  => Free/busy status
            //49  => Total size
            //50  => Account name
            //51  => Computer
            //52  => Anniversary
            //53  => Assistant's name
            //54  => Assistant's phone
            //55  => Birthday
            //56  => Business address
            //57  => Business city
            //58  => Business country/region
            //59  => Business P.O. box
            //60  => Business postal code
            //61  => Business state or province
            //62  => Business street
            //63  => Business fax
            //64  => Business home page
            //65  => Business phone
            //66  => Callback number
            //67  => Car phone
            //68  => Children
            //69  => Company main phone
            //70  => Department
            //71  => E-mail Address
            //72  => E-mail2
            //73  => E-mail3
            //74  => E-mail list
            //75  => E-mail display name
            //76  => File as
            //77  => First name
            //78  => Full name
            //79  => Gender
            //80  => Given name
            //81  => Hobbies
            //82  => Home address
            //83  => Home city
            //84  => Home country/region
            //85  => Home P.O. box
            //86  => Home postal code


转载于:https://my.oschina.net/qq2636472828/blog/209946

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值