private void playNextList() { lock (sound_lists) { current_list_id = (current_list_id + 1) % MAX_LISTS; if (sound_lists[current_list_id] == null) { /* nothing to play */ current_list_id = -1; } } if (current_list_id == -1) { return; } current_list_item = 0; current_list = (SoundList)CRunTime.getRegisteredObject(sound_lists[current_list_id].Value); if ((current_list.streams == null) || (current_list.streams.Length != current_list.count)) { current_list.streams = new Stream[current_list.count]; } for (int i = 0; i < current_list.count; i++) { try { if (_soundDir.Equals("")) { current_list.streams[i] = App.GetResourceStream(new Uri(current_list.list[i], UriKind.Relative)).Stream; } else { // This is a downloaded lock (sound_lists) { string soundFilename = _soundDir + "/" + current_list.list[i]; string resourceSoundName = soundFilename.Replace("Userstore:///sound", "/WazeWP7;component/resources/sound"); if (!Syscalls.FileExists(soundFilename)) { if (Syscalls.FileExists(resourceSoundName)) { Syscalls.CopyFile(resourceSoundName, soundFilename.Replace("Userstore:///", "/")); } } if (Syscalls.FileExists(soundFilename)) { current_list.streams[i] = Syscalls.GetFileStream(soundFilename, FileMode.Open); } else { Logger.log("Could not find sound file : " + _soundDir + "/" + current_list.list[i]); UIWorker.addUIEventLog("Could not find sound file : " + _soundDir + "/" + current_list.list[i]); } } } } catch (Exception e) { Logger.log("Error creating sound stream:" + current_list.list[i] + "excp : " + e.ToString()); UIWorker.addUIEventLog("Error creating sound stream:" + current_list.list[i] + "excp : " + e); } } playNextItem(); }