public static void CloseFileStream() { if (m_fileStream != null) { m_fileStream.Close(); GetAllStatus.SetIsWaveDataWrite(false); GetAllStatus.SetIsWaveDataRead(false); } }
public static void SetFileStreamRead(string path) { if (!File.Exists(path)) { m_fileStream = null;//如果不存在则清空文件流 } else { m_fileStream = new FileStream(path, FileMode.Open, FileAccess.Read); GetAllStatus.SetIsWaveDataWrite(false); GetAllStatus.SetIsWaveDataRead(true); } }
public static void SetFileStreamWrite(string path) { if (!File.Exists(path)) { m_fileStream = new FileStream(path, FileMode.Create, FileAccess.Write);//如果不存在则创建文件 } else { m_fileStream = new FileStream(path, FileMode.Append, FileAccess.Write); } GetAllStatus.SetIsWaveDataWrite(true); GetAllStatus.SetIsWaveDataRead(false); }
public static bool WriteByteArray(byte[] data) { if (m_fileStream == null || GetAllStatus.GetIsWaveDataRead() || !GetAllStatus.GetIsWaveDataWrite()) { return(false); } try { m_fileStream.Write(data, 0, data.Length); GetAllStatus.SetIsWaveDataWrite(true);; return(true); } catch (Exception) { return(false); } }