在BIN/DEBUG中执行mp3文件 [英] execute mp3 File in BIN/DEBUG

查看:110
本文介绍了在BIN/DEBUG中执行mp3文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的音乐文件位于bin/debug文件夹中.
我已经执行了音乐文件.但无法执行.
我需要一个示例代码:

My Music File is in bin/debug Folders .
i have execute music file . but cannot execute.
i need a example Code :

string Path = "MusicFile" + Environment.CurrentDirectory;



Btnplymusic.click(,)
{
///现在此路径为Paly音乐执行????? !!!!!!!
}

ex适用于英国语言.我无法正确说英语.
请帮助我.thnx



Btnplymusic.click(,)
{
/// NOW this Path execute for Paly music ?????!!!!!!!
}

ex for languages U.K . i cannot speak languages U.K Correctly.
Please Help me .thnx

推荐答案

不要将数据文件放在可执行文件文件夹中.这是很糟糕的做法.

像MP3这样的文件应位于用户文件夹下(最好在我的音乐"中).

顺便说一句,您的路径肯定是错误的...

1)"MusicFile"永远不会位于开头(在当前目录之前)
2)通常不应该使用CurrentDirectory,因为它可能取决于启动应用程序的方式(通过调试器,stanalone,通过快捷方式...)
3)如上所述,您应该使用特定于当前用户的文件夹.
4)您应该使用 GetFolderPath [ Path.Combine [ ^ ]来建立完整的文件名
Don''t put data file in executable folder. It is a bad pratice.

A file like a MP3 should be under user folder (and preferably in "My music".

By the way, your Path is wrong for sure...

1) "MusicFile" would never be at the beginning (before the current directory)
2) You should normally not use CurrentDirectory as it might be anything depending on how the application was started (from debugger, stanalone, from a shortcut...)
3) As mentionned above, you should use a folder specific to the current user.
4) You should use GetFolderPath[^] to get the desired parent folder.
5) You should then use Path.Combine[^] to build the complete filename.


感谢Mori先生.................................... .......
Thanks Mr Mori ..........................................


这篇关于在BIN/DEBUG中执行mp3文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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