private void PlaySound(string path, bool forceRead = false) { _playingSound = true; byte[] soundBytes = (byte[])_soundBuffer[path]; if ((soundBytes == null) || forceRead) { GT.StorageDevice sd = sdCard.GetStorageDevice(); soundBytes = sd.ReadFile(path); _soundBuffer[path] = soundBytes; } music.Play(soundBytes); }
public string GetTextFile(string fileName) { GT.StorageDevice sdStorage = sdCard.GetStorageDevice(); string[] fileList = sdStorage.ListRootDirectoryFiles(); if (this.indexOf(fileList, fileName) >= 0) { byte[] fileBytes = sdStorage.ReadFile(fileName); Encoding utf8 = new UTF8Encoding(); char[] fileChars = utf8.GetChars(fileBytes); return(new string(fileChars)); } return(null); }