首页 技术 正文
技术 2022年11月15日
0 收藏 829 点赞 2,946 浏览 1722 个字
引用
using Shell32;
        private void Open_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "MP3 Files(.mp3)|*.mp3|WMA Files(*.wma)|*.WMA";
//ofd.Multiselect = true; //允许多选
ofd.RestoreDirectory = true; //记住上一次的文件路径
ofd.ShowDialog();
FilePath = ofd.FileName;
if (FilePath != "")
{
string OpenFileType = Path.GetExtension(FilePath);
FileInfo FileLenght = new FileInfo(FilePath);
if (FileLenght.Length > )
{
FuncClass.ShowError("Too Large!");
}
else
{
ShellClass sh = new ShellClass();
Folder dir = sh.NameSpace(Path.GetDirectoryName(FilePath));
FolderItem item = dir.ParseName(Path.GetFileName(FilePath));
string NewPath = Path.GetDirectoryName(FilePath) + "\\" + dir.GetDetailsOf(item, ) + " - " +
dir.GetDetailsOf(item, ) + OpenFileType;
if (!File.Exists(NewPath))
{
File.Move(FilePath, NewPath);//重命名其实就是move
}
dir = sh.NameSpace(Path.GetDirectoryName(NewPath));
item = dir.ParseName(Path.GetFileName(NewPath));
PathFile.Text = NewPath;
FileName.Text = Path.GetFileNameWithoutExtension(NewPath) + OpenFileType;
MusicName.Text = dir.GetDetailsOf(item, );
WriteWords.Text = "";
WriteMusic.Text = "";
Singer.Text = dir.GetDetailsOf(item, );
Album.Text = dir.GetDetailsOf(item, );
Time.Text = dir.GetDetailsOf(item, );
}
}
}

解析说明:例子周杰伦 – 青花瓷.mp3

-1 项目类型:MP3文件
大小:3.62
参与创作的艺术家:周杰伦
长度:00:03:57
0:青花瓷.mp3(文件名)
1: 3.62MB(大小)
2: MP3文件(项目类型)
3:xxxx-xx-xx xx:xx(修改时间)
9: 音频(文件类型)
10:Administrators(用户名)
11:音乐(所属)
13:周杰伦(演唱)
14:一人一首成名曲(专辑)
15: 2002(年份)
19:未分级
20:周杰伦(演唱)
21:青花瓷(歌名)
27: 00:03:57
28:128kbps
29:否

修改后周杰伦 – 青花瓷.mp3

图例:

c# 通过解析mp3规范命名并上传服务器

打开后显示已修正得到歌曲信息:

c# 通过解析mp3规范命名并上传服务器

        private void UpLoad()
{  //wenserver需自己定义
WebClient webclient = new WebClient();
byte[] responseArray = webclient.UploadFile("http://192.168.1.11/WebForm1.aspx ", "POST", @"" + FilePath + "");//http路径
string getPath = Encoding.GetEncoding("UTF-8").GetString(responseArray);
FuncClass.ShowInformation("歌曲已"+getPath + "上传到服务器");//返回信息
}
上一篇: 索引Log
下一篇: gulp使用入门
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,028
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,518
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,365
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,146
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,780
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,857