【发布时间】:2014-02-03 16:44:01
【问题描述】:
我有一个 MP3 文件列表,我想将它们合并到一个文件中。我将文件本地下载到隔离存储中,但我不知道如何合并它们。谷歌也没有帮助。我不知道它是否可能在 WP8 中。 (2) 如果不可能的话,你可以建议什么具体的解决方案(我的文件也在网上)。
我在下面写了合并代码,但这总是写最后一个文件。
string[] files = new string[] { "001000.mp3", "001001.mp3", "001002.mp3", "001003.mp3", "001004.mp3", "001005.mp3", "001006.mp3", "001007.mp3" };
using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
{
string newFileName = "001.mp3";
foreach (string _fileName in files)
{
if (storage.FileExists(_fileName))
{
byte[] bytes = new byte[1];
using (var f = new IsolatedStorageFileStream(_fileName, FileMode.Open, storage))
{
bytes = new byte[f.Length];
int byteCount;
using (var isfs = new IsolatedStorageFileStream(newFileName, FileMode.OpenOrCreate, storage))
{
while ((byteCount = f.Read(bytes, 0, bytes.Length)) > 0)
{
isfs.Write(bytes, 0, byteCount);
isfs.Flush();
}
}
}
}
}
}
如何将文件添加(合并)到新创建文件的末尾?
【问题讨论】:
-
只是将字节放在一个新文件中不会很好地结束:mpgedit.org/mpgedit/mpeg_format/MP3Format.html
-
通过追加合并文件不会做你认为它会做的事情。它不是文本,它具有特定的文件格式。
标签: c# windows-phone-8 merge mp3