Exemplo n.º 1
0
        /// <summary>
        /// Returns a list of all songs of the given type and genre.
        /// </summary>
        /// <param name="musicType">The music type filter.</param>
        /// <param name="genre">The genre filter.</param>
        /// <returns>Null if the genre could not be found in the given music type.</returns>
        public static List <SongData> GetSongList(MusicTypeIndex musicType, string genre)
        {
            if (sMusicData == null)
            {
                return(new List <SongData>());
            }
            int index = (int)musicType;

            if (index >= sMusicData.Count)
            {
                return(new List <SongData>());
            }
            int count = sMusicGenres[index].Count;

            if (count == 0)
            {
                return(new List <SongData>());
            }
            if (count == 1)
            {
                return(sMusicData[index][sMusicGenres[index][0]]);
            }
            List <SongData> songList;

            if (!sMusicData[index].TryGetValue(genre, out songList))
            {
                return(new List <SongData>());
            }
            return(songList);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get the localized string name of the given music type.
        /// </summary>
        /// <param name="musicType">The music type to localize.</param>
        /// <returns>The localized name of the music type.</returns>
        public static string GetLocalizedMusicType(MusicTypeIndex musicType)
        {
            if (gLocalizer == null)
            {
                return(musicType.ToString());
            }
            string result = gLocalizer.GetLocalizedString(kMusicTypeLocalKeys[(int)musicType]);

            if (string.IsNullOrEmpty(result))
            {
                return(musicType.ToString());
            }
            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns a dictionary of song lists for each genre in the given music type.
        /// Stereo is the only type that will have multiple genres.
        /// All other types will just have the "All" genre,
        /// except for Custom, which just has the "Custom" genre.
        /// </summary>
        /// <param name="musicType">The music type of the returned song lists.</param>
        /// <returns>The lists of all songs of the given music type.</returns>
        protected static Dictionary <string, List <SongData> > GetSongData(MusicTypeIndex musicType)
        {
            if (sMusicData == null)
            {
                return(null);
            }
            int index = (int)musicType;

            if (index >= sMusicData.Count)
            {
                return(null);
            }
            return(sMusicData[index]);
        }