我試過了幾種不同的方法,但保存時不會打開。我怎樣才能做到這一點?C#將MP4資源保存到文件
基本上我希望能夠將當前是資源文件的MP4文件保存到我可以作爲路徑訪問的臨時位置。
這裏的東西我已經試過:
public static void WriteResourceToFile(string resourceName, string fileName)
{
using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
{
if (s != null)
{
byte[] buffer = new byte[s.Length];
char[] sb = new char[s.Length];
s.Read(buffer, 0, (int)(s.Length));
/* convert the byte into ASCII text */
for (int i = 0; i <= buffer.Length - 1; i++)
{
sb[i] = (char)buffer[i];
}
using (StreamWriter sw = new StreamWriter(fileName))
{
sw.Write(sb);
sw.Flush();
}
}
}}
什麼* *究竟是你想怎麼辦?你有什麼嘗試?發佈一些代碼... – tomfanning
我試圖在axwindowsmediaplayer插件中播放資源視頻。 –