ASP.NET中的音频文件的获取大小 [英] Getting size of an audio file in ASP.NET

查看:237
本文介绍了ASP.NET中的音频文件的获取大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于音频文件(MP3或WAV),是这里的方式来获得持续时间,大小(以字节为单位)和文件等其他属性?

Given an audio file (mp3 or wav), is here a way to get the duration, size (in bytes) and other other attributes of the file?

感谢

推荐答案

有关文件大小的FileInfo将是值得考虑的。

For file size FileInfo would be worth looking at

System.IO.FileInfo file = new System.IO.FileInfo(string filename);
long fileSize = file.Length;

这可以让你的文件大小

和获得像隐藏状态的属性。像下面这样才能得到它

and to get attributes like Hidden status. something like the following can get it

  if (file.Attributes & System.IO.FileAttributes.Hidden == System.IO.FileAttributes.Hidden)
  {
       // hidden file
  }

予第二查找磁道的持续时间[在秒] n音讯文库

I second the NAudio library for finding the duration of a track [in seconds]

这篇关于ASP.NET中的音频文件的获取大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆