private void _CreateCategories() { _AdjustCategoryNames(); CCategory lastCategory = null; CCategory noCategory = null; foreach (CSongPointer songPointer in CSongs.Sorter.SortedSongs) { if (songPointer.SortString != "") { if (lastCategory == null || String.Compare(songPointer.SortString, lastCategory.Name, StringComparison.CurrentCultureIgnoreCase) != 0) { lastCategory = new CCategory(songPointer.SortString); _Categories.Add(lastCategory); } lastCategory.Songs.Add(songPointer); } else { if (noCategory == null) { noCategory = new CCategory(_GetNoCategoryName()); _Categories.Add(noCategory); } noCategory.Songs.Add(songPointer); } } }
private static int _GetCategoryNumber(CCategory category) { for (int i = 0; i < Categories.Count; i++) { if (Categories[i] == category) { return(i); } } return(-1); }
public static int GetRandomCategory() { if (_CategoriesForRandom.Count == 0) { UpdateRandomCategoryList(); } if (_CategoriesForRandom.Count == 0) { return(-1); } CCategory category = _CategoriesForRandom[CGame.Rand.Next(0, _CategoriesForRandom.Count - 1)]; _CategoriesForRandom.Remove(category); return(_GetCategoryNumber(category)); }
private static int GetCategoryNumber(CCategory category) { for (int i = 0; i < Categories.Length; i++) { if (Categories[i] == category) return i; } return -1; }