예제 #1
0
        private string findSoundFileByID(string soundID)
        {
            string soundFile = string.Empty;
            var    result    = from soundDfn in modData.SoundInfos
                               where soundDfn.ID == soundID
                               select soundDfn;

            if (result.Count() == 1)
            {
                if (CurrentSound != null)
                {
                    CurrentSound.Stop();
                }
                currentSound = new GameSound();
                soundFile    = string.Format("{0}//Music//{1}", modData.BasicInfo.InstallPath, result.First().File);
                if (File.Exists(soundFile))
                {
                    return(soundFile);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
예제 #2
0
        public void PlayTrack()
        {
            SongEnded = false;
            if (CurrentSound != null)
            {
                CurrentSound.Stop();
            }
            if (CurrentTrack != null)
            {
                CurrentSound = engine.PlayFile(CurrentTrack.Value.FullPath);
                if (CurrentSound != null)
                {
                    CurrentSound.setSoundStopEventReceiver(this);
                }

                CurrentTrack.Value.PlayPosition = CurrentSound.PlayPosition;
                IsPlaying = true;
            }
            else
            {
                IsPlaying = false;
                Playlist.Clear();
            }
            ToggleButtons();
        }
예제 #3
0
        public void StopCurrentTrack()
        {
            IsPlaying = false;
            if (CurrentSound != null)
            {
                CurrentSound.Stop();
            }
            if (CurrentTrack != null && CurrentTrack.Value != null)
            {
                CurrentTrack.Value.PlayPosition = 0;
            }

            ToggleButtons();
        }
예제 #4
0
        private string findMusicFileByID(string musicID)
        {
            string musicfile = string.Empty;
            var    result    = from musicDfn in modData.MusicInfos
                               where musicDfn.ID == musicID
                               select musicDfn;

            if (result.Count() == 1)
            {
                if (CurrentSound != null)
                {
                    CurrentSound.Stop();
                }
                currentSound = new GameSound();
                if (result.First().Type == Mods.XML.TrackType.EngineTrack)
                {
                    musicfile = string.Format("{0}//{1}//{2}", Environment.CurrentDirectory, modData.MusicDir, result.First().File);
                }
                else if (result.First().Type == Mods.XML.TrackType.ModuleTrack)
                {
                    musicfile = string.Format("{0}//{1}//{2}", modData.BasicInfo.InstallPath, modData.MusicDir, result.First().File);
                }
                if (File.Exists(musicfile))
                {
                    return(musicfile);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }