Imports System.IO
Me.soundFolder = String.Format("{0}/sound", System.Environment.GetFolderPath (Environment.SpecialFolder.LocalApplicationData))
'System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)是代表本机的C:/Documents and Settings/angelina/Local Settings/Application Data这个地址
If Not System.IO.Directory.Exists(Me.soundFolder) Then
System.IO.Directory.CreateDirectory(Me.soundFolder)
End If
If Not System.IO.File.Exists(Me.soundFolder & "/alert.wav") Then
Dim br As New IO.BinaryReader(My.Resources.alert)
Dim wavData() As Byte
wavData = br.ReadBytes(My.Resources.alert.Length)
br.Close()
Dim bw As New IO.FileStream(Me.soundFolder & "/alert.wav", FileMode.Create)
bw.Write(wavData, 0, wavData.Length)
bw.Close()
End If
本文介绍了一个使用VB.NET实现的声音文件管理系统。该系统能够检查本地应用程序数据目录是否存在,并创建相应目录来存放声音文件。如果指定的声音文件不存在,则从资源中读取声音数据并将其保存到该目录下。

被折叠的 条评论
为什么被折叠?



