110,539
社区成员
发帖
与我相关
我的任务
分享
string len="";
string[] str = new string[0];
int sum = 0;
try
{
Shell32.Shell shell = new Shell32.Shell();
//文件路径
Shell32.Folder folder = shell.NameSpace(path.Substring(0, path.LastIndexOf("\\")));
//文件名称
Shell32.FolderItem folderitem = folder.ParseName(path.Substring(path.LastIndexOf("\\") + 1));
if (Environment.OSVersion.Version.Major >= 6)
{
len = folder.GetDetailsOf(folderitem, 27);
}
else
{
len = folder.GetDetailsOf(folderitem, 21);
}
str = len.Split(new char[] { ':' });
sum = int.Parse(str[0]) * 60 * 60 + int.Parse(str[1]) * 60 + int.Parse(str[2]);
return sum;
}
catch (Exception ex)
{
return 0;
}