//音效保存到SDK里 public void SaveAudioValue() { byte[] data; MemoryStream ms = new MemoryStream(2 * 4); for (int i = 0; i < 2; ++i) { if (i == 0) { data = System.BitConverter.GetBytes(m_BgValue); } else { data = System.BitConverter.GetBytes(m_Value); } ms.Write(data, 0, data.Length); } bool bRet = RuntimeInfo.SaveLocalFile(RuntimeInfo.GetAudioFileName(), ms.ToArray()); ms.Close(); }
public bool LoadAudioValue() { //读取SD卡的版本 byte[] data = RuntimeInfo.GetLocalFile(RuntimeInfo.GetAudioFileName()); if (data == null || data.Length != 2 * 4) { return(false); } for (int i = 0, idx = 0; i < 2; ++i, idx += 4) { float value = System.BitConverter.ToSingle(data, idx); if (i == 0) { m_BgValue = value; } else { m_Value = value; } } return(true); }