public CProgressBar(CProgressBar pb) { _PartyModeID = pb._PartyModeID; _TextureBackground = pb.TextureBackground; _TextureForeground = pb.TextureForeground; _TextureProgressLeft = pb.TextureProgressLeft; _TextureProgressMid = pb._TextureProgressMid; _TextureProgressRight = pb._TextureProgressRight; _AnimateMovement = pb._AnimateMovement; _AnimateColoring = pb._AnimateColoring; _Direction = pb._Direction; _ProgressColors = pb._ProgressColors; ColorBackground = pb.ColorBackground; ColorForeground = pb.ColorForeground; MaxRect = pb.MaxRect; Reflection = pb.Reflection; ReflectionSpace = pb.ReflectionHeight; ReflectionHeight = pb.ReflectionSpace; AllMonitors = pb.AllMonitors; Alpha = pb.Alpha; Visible = pb.Visible; _AnimTimer = new Stopwatch(); }
public CProfile() { PlayerName = String.Empty; Difficulty = EGameDifficulty.TR_CONFIG_EASY; UserRole = EUserRole.TR_USERROLE_NORMAL; Active = EOffOn.TR_CONFIG_ON; }
private void SaveConfig() { EOffOn NewOffOn = (EOffOn)SelectSlides[htSelectSlides(SelectSlideBackgroundMusic)].Selection; EBackgroundMusicSource NewSource = (EBackgroundMusicSource)SelectSlides[htSelectSlides(SelectSlideBackgroundMusicSource)].Selection; float NewVolume = SelectSlides[htSelectSlides(SelectSlideBackgroundMusicVolume)].Selection * 5; CBackgroundMusic.CheckAndApplyConfig(NewOffOn, NewSource, NewVolume); }
public override void OnShow() { base.OnShow(); _SongSortingOld = CConfig.SongSorting; _TabsOld = CConfig.Tabs; _LanguageOld = CConfig.Language; }
public static void SetActive(Guid profileID, EOffOn option) { if (!IsProfileIDValid(profileID)) { return; } _Profiles[profileID].Active = option; }
public override void OnShow() { base.OnShow(); _BackgroundMusic = CConfig.BackgroundMusic; _BackgroundMusicVolume = CConfig.BackgroundMusicVolume; SelectSlides[htSelectSlides(SelectSlideGameMusicVolume)].Selection = CConfig.GameMusicVolume / 5; SelectSlides[htSelectSlides(SelectSlidePreviewMusicVolume)].Selection = CConfig.PreviewMusicVolume / 5; }
public void SetOptions(ESongSorting songSorting, EOffOn ignoreArticles) { if (songSorting != _SongSorting || ignoreArticles != _IgnoreArticles) { _SongSorting = songSorting; _IgnoreArticles = ignoreArticles; _SetChanged(); } }
public static void SetActive(int ProfileNr, EOffOn Option) { if (ProfileNr < 0 || ProfileNr >= _Profiles.Count) { return; } SProfile profile = _Profiles[ProfileNr]; profile.Active = Option; _Profiles[ProfileNr] = profile; }
public CProgressBar(SThemeProgressBar theme, int partyModeID) { _PartyModeID = partyModeID; _Theme = theme; _Theme.ProgressColors.Sort((x, y) => x.From.CompareTo(y.From)); _ProgressColors = _Theme.ProgressColors; _Direction = _Theme.Direction; _AnimateMovement = _Theme.AnimateMovement; _AnimateColoring = _Theme.AnimateColoring; _UpdateProgress(); ThemeLoaded = true; _AnimTimer = new Stopwatch(); }
public override void OnShow() { base.OnShow(); _BackgroundMusic = CConfig.BackgroundMusic; _BackgroundMusicVolume = CConfig.BackgroundMusicVolume; }
public bool ReadTXTHeader(string FilePath) { if (!File.Exists(FilePath)) { return(false); } this.Folder = Path.GetDirectoryName(FilePath); foreach (string folder in CConfig.SongFolder) { if (this.Folder.Contains(folder)) { if (this.Folder.Length == folder.Length) { this.FolderName = "Songs"; } else { this.FolderName = this.Folder.Substring(folder.Length + 1, this.Folder.Length - folder.Length - 1); string str = this.FolderName; try { str = this.FolderName.Substring(0, this.FolderName.IndexOf("\\")); } catch (Exception) { } this.FolderName = str; } } } this.FileName = Path.GetFileName(FilePath); EHeaderFlags HeaderFlags = new EHeaderFlags(); StreamReader sr; try { sr = new StreamReader(FilePath, Encoding.Default, true); string line = sr.ReadLine(); if (line.Length == 0) { return(false); } int pos = -1; string Identifier = String.Empty; string Value = String.Empty; while ((line.Length == 0) || (line[0].ToString().Equals("#"))) { pos = line.IndexOf(":"); if (pos > 0) { Identifier = line.Substring(1, pos - 1).Trim().ToUpper(); Value = line.Substring(pos + 1, line.Length - pos - 1).Trim(); if (Value.Length > 0) { switch (Identifier) { case "ENCODING": this.Encoding = CEncoding.GetEncoding(Value); sr = new StreamReader(FilePath, this.Encoding); Identifier = String.Empty; line = sr.ReadLine(); while ((line.Length == 0) || (line[0].ToString().Equals("#")) && (Identifier != "ENCODING")) { pos = line.IndexOf(":"); if (pos > 0) { Identifier = line.Substring(1, pos - 1).Trim().ToUpper(); Value = line.Substring(pos + 1, line.Length - pos - 1).Trim(); } if (!sr.EndOfStream) { if (Identifier == "ENCODING") { break; } else { line = sr.ReadLine(); } } else { return(false); } } break; case "TITLE": if (Value != String.Empty) { this.Title = Value; HeaderFlags |= EHeaderFlags.Title; } break; case "ARTIST": if (Value != String.Empty) { this.Artist = Value; HeaderFlags |= EHeaderFlags.Artist; } break; case "TITLE-ON-SORTING": if (Value != String.Empty) { this.TitleSorting = Value; } break; case "ARTIST-ON-SORTING": if (Value != String.Empty) { this.ArtistSorting = Value; } break; case "P1": if (Value != String.Empty) { this.DuetPart1 = Value; } break; case "P2": if (Value != String.Empty) { this.DuetPart2 = Value; } break; case "MP3": if (File.Exists(Path.Combine(this.Folder, Value))) { this.MP3FileName = Value; HeaderFlags |= EHeaderFlags.MP3; } else { CLog.LogError("Can't find audio file: " + Path.Combine(this.Folder, Value)); return(false); } break; case "BPM": if (CHelper.TryParse(Value, out this.BPM)) { this.BPM *= 4; HeaderFlags |= EHeaderFlags.BPM; } break; case "EDITION": if (Value.Length > 1) { this.Edition.Add(Value); } break; case "GENRE": if (Value.Length > 1) { this.Genre.Add(Value); } break; case "YEAR": int num = 0; if (Value.Length == 4 && int.TryParse(Value, out num)) { this.Year = Value; } break; case "LANGUAGE": if (Value.Length > 1) { this.Language.Add(Value); } break; case "COMMENT": if (Value.Length > 1) { this.Comment.Add(Value); } break; case "GAP": if (CHelper.TryParse(Value, out this.Gap)) { this.Gap /= 1000f; } break; case "COVER": if (File.Exists(Path.Combine(this.Folder, Value))) { this.CoverFileName = Value; } break; case "BACKGROUND": if (File.Exists(Path.Combine(this.Folder, Value))) { this.BackgroundFileName = Value; } break; case "VIDEO": if (File.Exists(Path.Combine(this.Folder, Value))) { this.VideoFileName = Value; } else { CLog.LogError("Can't find video file: " + Path.Combine(this.Folder, Value)); } break; case "VIDEOGAP": CHelper.TryParse(Value, out this.VideoGap); break; case "VIDEOASPECT": CHelper.TryParse <EAspect>(Value, out this.VideoAspect, true); break; case "START": CHelper.TryParse(Value, out this.Start); break; case "END": if (CHelper.TryParse(Value, out this.Finish)) { this.Finish /= 1000f; } break; case "PREVIEWSTART": if (CHelper.TryParse(Value, out this.PreviewStart)) { if (this.PreviewStart < 0f) { this.PreviewStart = 0f; } else { HeaderFlags |= EHeaderFlags.PreviewStart; } } break; case "MEDLEYSTARTBEAT": if (int.TryParse(Value, out this.Medley.StartBeat)) { HeaderFlags |= EHeaderFlags.MedleyStartBeat; } break; case "MEDLEYENDBEAT": if (int.TryParse(Value, out this.Medley.EndBeat)) { HeaderFlags |= EHeaderFlags.MedleyEndBeat; } break; case "CALCMEDLEY": if (Value.ToUpper() == "OFF") { this.CalculateMedley = false; } break; case "RELATIVE": if (Value.ToUpper() == "YES" && Value.ToUpper() != "NO") { this.Relative = EOffOn.TR_CONFIG_ON; } break; default: ; break; } } } if (!sr.EndOfStream) { line = sr.ReadLine(); } else { return(false); } } //end of while if ((HeaderFlags & EHeaderFlags.Title) == 0) { CLog.LogError("Title tag missing: " + FilePath); return(false); } if ((HeaderFlags & EHeaderFlags.Artist) == 0) { CLog.LogError("Artist tag missing: " + FilePath); return(false); } if ((HeaderFlags & EHeaderFlags.MP3) == 0) { CLog.LogError("MP3 tag missing: " + FilePath); return(false); } if ((HeaderFlags & EHeaderFlags.BPM) == 0) { CLog.LogError("BPM tag missing: " + FilePath); return(false); } if (this.Relative == EOffOn.TR_CONFIG_ON) { CLog.LogError("Relative songs are not supported by Vocaluxe (perhaps later)! (" + FilePath + ")"); return(false); } #region check medley tags if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0 && (HeaderFlags & EHeaderFlags.MedleyEndBeat) != 0) { if (this.Medley.StartBeat > this.Medley.EndBeat) { CLog.LogError("MedleyStartBeat is bigger than MedleyEndBeat in file: " + FilePath); HeaderFlags = HeaderFlags - EHeaderFlags.MedleyStartBeat - EHeaderFlags.MedleyEndBeat; } } if ((HeaderFlags & EHeaderFlags.PreviewStart) == 0 || this.PreviewStart == 0f) { //PreviewStart is not set or <=0 if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0) { //fallback to MedleyStart this.PreviewStart = CGame.GetTimeFromBeats(this.Medley.StartBeat, this.BPM); } else { //else set to 0, it will be set in FindRefrainStart this.PreviewStart = 0f; } } if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0 && (HeaderFlags & EHeaderFlags.MedleyEndBeat) != 0) { this.Medley.Source = EMedleySource.Tag; this.Medley.FadeInTime = CSettings.DefaultMedleyFadeInTime; this.Medley.FadeOutTime = CSettings.DefaultMedleyFadeOutTime; } #endregion check medley tags this.Encoding = sr.CurrentEncoding; } catch (Exception e) { CLog.LogError("Error reading txt header in file \"" + FilePath + "\": " + e.Message); return(false); } CheckFiles(); //Before saving this tags to .txt: Check, if ArtistSorting and Artist are equal, then don't save this tag. if (this.ArtistSorting == String.Empty) { this.ArtistSorting = this.Artist; } if (this.TitleSorting == String.Empty) { this.TitleSorting = this.Title; } return(true); }
public CSong(CSong song) { this._CoverTextureSmall = song._CoverTextureSmall; this._CoverTextureBig = song._CoverTextureBig; this.Medley = new SMedley(); this.Medley.Source = song.Medley.Source; this.Medley.StartBeat = song.Medley.StartBeat; this.Medley.EndBeat = song.Medley.EndBeat; this.Medley.FadeInTime = song.Medley.FadeInTime; this.Medley.FadeOutTime = song.Medley.FadeOutTime; this.CalculateMedley = song.CalculateMedley; this.PreviewStart = song.PreviewStart; this.ShortEnd = song.ShortEnd; this.DuetPart1 = song.DuetPart1; this.DuetPart2 = song.DuetPart2; this.Encoding = song.Encoding; this.Folder = song.Folder; this.FolderName = song.FolderName; this.FileName = song.FileName; this.Relative = song.Relative; this.MP3FileName = song.MP3FileName; this.CoverFileName = song.CoverFileName; this.BackgroundFileName = song.BackgroundFileName; this.VideoFileName = song.VideoFileName; this.VideoAspect = song.VideoAspect; this._CoverLoaded = song._CoverLoaded; this.CoverBigLoaded = song.CoverBigLoaded; this._NotesLoaded = song._NotesLoaded; this.Artist = song.Artist; this.Title = song.Title; this.Start = song.Start; this.Finish = song.Finish; this.BPM = song.BPM; this.Gap = song.Gap; this.VideoGap = song.VideoGap; this.Comment = new List <string>(); foreach (string value in song.Comment) { this.Comment.Add(value); } this.ID = song.ID; this.Visible = song.Visible; this.CatIndex = song.CatIndex; this.Selected = song.Selected; this.Edition = new List <string>(); foreach (string value in song.Edition) { this.Edition.Add(value); } this.Genre = new List <string>(); foreach (string value in song.Genre) { this.Genre.Add(value); } this.Year = song.Year; this.Language = new List <string>(); foreach (string value in song.Language) { this.Language.Add(value); } this.Notes = new CNotes(song.Notes); }
public static void CheckAndApplyConfig(EOffOn NewOnOff, EBackgroundMusicSource NewSource, float NewVolume) { if (CConfig.BackgroundMusic != NewOnOff) { CConfig.BackgroundMusic = NewOnOff; if (NewOnOff == EOffOn.TR_CONFIG_ON) { Play(); } else { Pause(); } } if (CConfig.BackgroundMusicSource != NewSource) { CConfig.BackgroundMusicSource = NewSource; switch (NewSource) { case EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC: if (!_BackgroundMusicAdded) { AddBackgroundMusic(); } RemoveOwnMusic(); break; case EBackgroundMusicSource.TR_CONFIG_ONLY_OWN_MUSIC: if (!_OwnMusicAdded) { AddOwnMusic(); } RemoveBackgroundMusic(); break; case EBackgroundMusicSource.TR_CONFIG_OWN_MUSIC: if (!_BackgroundMusicAdded) { AddBackgroundMusic(); } if (!_OwnMusicAdded) { AddOwnMusic(); } break; } } if (CConfig.BackgroundMusicVolume != NewVolume) { CConfig.BackgroundMusicVolume = (int)NewVolume; ApplyVolume(); } CConfig.SaveConfig(); }
public bool ReadTXTHeader(string FilePath) { if (!File.Exists(FilePath)) return false; this.Folder = Path.GetDirectoryName(FilePath); foreach (string folder in CConfig.SongFolder) { if (this.Folder.Contains(folder)) { if (this.Folder.Length == folder.Length) this.FolderName = "Songs"; else { this.FolderName = this.Folder.Substring(folder.Length + 1, this.Folder.Length - folder.Length - 1); string str = this.FolderName; try { str = this.FolderName.Substring(0, this.FolderName.IndexOf("\\")); } catch (Exception) { } this.FolderName = str; } } } this.FileName = Path.GetFileName(FilePath); EHeaderFlags HeaderFlags = new EHeaderFlags(); StreamReader sr; try { sr = new StreamReader(FilePath, Encoding.Default, true); string line = sr.ReadLine(); if (line.Length == 0) return false; int pos = -1; string Identifier = String.Empty; string Value = String.Empty; while ((line.Length == 0) || (line[0].ToString().Equals("#"))) { pos = line.IndexOf(":"); if (pos > 0) { Identifier = line.Substring(1, pos - 1).Trim().ToUpper(); Value = line.Substring(pos + 1, line.Length - pos - 1).Trim(); if (Value.Length > 0) { switch (Identifier) { case "ENCODING": this.Encoding = CEncoding.GetEncoding(Value); sr = new StreamReader(FilePath, this.Encoding); Identifier = String.Empty; line = sr.ReadLine(); while ((line.Length == 0) || (line[0].ToString().Equals("#")) && (Identifier != "ENCODING")) { pos = line.IndexOf(":"); if (pos > 0) { Identifier = line.Substring(1, pos - 1).Trim().ToUpper(); Value = line.Substring(pos + 1, line.Length - pos - 1).Trim(); } if (!sr.EndOfStream) if (Identifier == "ENCODING") break; else line = sr.ReadLine(); else { return false; } } break; case "TITLE": if (Value != String.Empty) { this.Title = Value; HeaderFlags |= EHeaderFlags.Title; } break; case "ARTIST": if (Value != String.Empty) { this.Artist = Value; HeaderFlags |= EHeaderFlags.Artist; } break; case "TITLE-ON-SORTING": if (Value != String.Empty) { this.TitleSorting = Value; } break; case "ARTIST-ON-SORTING": if (Value != String.Empty) { this.ArtistSorting = Value; } break; case "P1": if (Value != String.Empty) { this.DuetPart1 = Value; } break; case "P2": if (Value != String.Empty) { this.DuetPart2 = Value; } break; case "MP3": if (File.Exists(Path.Combine(this.Folder, Value))) { this.MP3FileName = Value; HeaderFlags |= EHeaderFlags.MP3; } else { CLog.LogError("Can't find audio file: " + Path.Combine(this.Folder, Value)); return false; } break; case "BPM": if (CHelper.TryParse(Value, out this.BPM)) { this.BPM *= 4; HeaderFlags |= EHeaderFlags.BPM; } break; case "EDITION": if (Value.Length > 1) this.Edition.Add(Value); break; case "GENRE": if (Value.Length > 1) this.Genre.Add(Value); break; case "YEAR": int num = 0; if (Value.Length == 4 && int.TryParse(Value, out num)) { this.Year = Value; } break; case "LANGUAGE": if (Value.Length > 1) this.Language.Add(Value); break; case "COMMENT": if (Value.Length > 1) this.Comment.Add(Value); break; case "GAP": if (CHelper.TryParse(Value, out this.Gap)) this.Gap /= 1000f; break; case "COVER": if (File.Exists(Path.Combine(this.Folder, Value))) this.CoverFileName = Value; break; case "BACKGROUND": if (File.Exists(Path.Combine(this.Folder, Value))) this.BackgroundFileName = Value; break; case "VIDEO": if (File.Exists(Path.Combine(this.Folder, Value))) this.VideoFileName = Value; else CLog.LogError("Can't find video file: " + Path.Combine(this.Folder, Value)); break; case "VIDEOGAP": CHelper.TryParse(Value, out this.VideoGap); break; case "VIDEOASPECT": CHelper.TryParse<EAspect>(Value, out this.VideoAspect, true); break; case "START": CHelper.TryParse(Value, out this.Start); break; case "END": if (CHelper.TryParse(Value, out this.Finish)) this.Finish /= 1000f; break; case "PREVIEWSTART": if (CHelper.TryParse(Value, out this.PreviewStart)) if (this.PreviewStart < 0f) this.PreviewStart = 0f; else HeaderFlags |= EHeaderFlags.PreviewStart; break; case "MEDLEYSTARTBEAT": if (int.TryParse(Value, out this.Medley.StartBeat)) HeaderFlags |= EHeaderFlags.MedleyStartBeat; break; case "MEDLEYENDBEAT": if (int.TryParse(Value, out this.Medley.EndBeat)) HeaderFlags |= EHeaderFlags.MedleyEndBeat; break; case "CALCMEDLEY": if (Value.ToUpper() == "OFF") this.CalculateMedley = false; break; case "RELATIVE": if (Value.ToUpper() == "YES" && Value.ToUpper() != "NO") this.Relative = EOffOn.TR_CONFIG_ON; break; default: ; break; } } } if (!sr.EndOfStream) line = sr.ReadLine(); else { return false; } } //end of while if ((HeaderFlags & EHeaderFlags.Title) == 0) { CLog.LogError("Title tag missing: " + FilePath); return false; } if ((HeaderFlags & EHeaderFlags.Artist) == 0) { CLog.LogError("Artist tag missing: " + FilePath); return false; } if ((HeaderFlags & EHeaderFlags.MP3) == 0) { CLog.LogError("MP3 tag missing: " + FilePath); return false; } if ((HeaderFlags & EHeaderFlags.BPM) == 0) { CLog.LogError("BPM tag missing: " + FilePath); return false; } if (this.Relative == EOffOn.TR_CONFIG_ON) { CLog.LogError("Relative songs are not supported by Vocaluxe (perhaps later)! (" + FilePath + ")"); return false; } #region check medley tags if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0 && (HeaderFlags & EHeaderFlags.MedleyEndBeat) != 0) { if (this.Medley.StartBeat > this.Medley.EndBeat) { CLog.LogError("MedleyStartBeat is bigger than MedleyEndBeat in file: " + FilePath); HeaderFlags = HeaderFlags - EHeaderFlags.MedleyStartBeat - EHeaderFlags.MedleyEndBeat; } } if ((HeaderFlags & EHeaderFlags.PreviewStart) == 0 || this.PreviewStart == 0f) { //PreviewStart is not set or <=0 if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0) //fallback to MedleyStart this.PreviewStart = CGame.GetTimeFromBeats(this.Medley.StartBeat, this.BPM); else //else set to 0, it will be set in FindRefrainStart this.PreviewStart = 0f; } if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0 && (HeaderFlags & EHeaderFlags.MedleyEndBeat) != 0) { this.Medley.Source = EMedleySource.Tag; this.Medley.FadeInTime = CSettings.DefaultMedleyFadeInTime; this.Medley.FadeOutTime = CSettings.DefaultMedleyFadeOutTime; } #endregion check medley tags this.Encoding = sr.CurrentEncoding; } catch (Exception e) { CLog.LogError("Error reading txt header in file \"" + FilePath + "\": " + e.Message); return false; } CheckFiles(); //Before saving this tags to .txt: Check, if ArtistSorting and Artist are equal, then don't save this tag. if (this.ArtistSorting == String.Empty) { this.ArtistSorting = this.Artist; } if (this.TitleSorting == String.Empty) { this.TitleSorting = this.Title; } return true; }
public CSong(CSong song) { this._CoverTextureSmall = song._CoverTextureSmall; this._CoverTextureBig = song._CoverTextureBig; this.Medley = new SMedley(); this.Medley.Source = song.Medley.Source; this.Medley.StartBeat = song.Medley.StartBeat; this.Medley.EndBeat = song.Medley.EndBeat; this.Medley.FadeInTime = song.Medley.FadeInTime; this.Medley.FadeOutTime = song.Medley.FadeOutTime; this.CalculateMedley = song.CalculateMedley; this.PreviewStart = song.PreviewStart; this.ShortEnd = song.ShortEnd; this.DuetPart1 = song.DuetPart1; this.DuetPart2 = song.DuetPart2; this.Encoding = song.Encoding; this.Folder = song.Folder; this.FolderName = song.FolderName; this.FileName = song.FileName; this.Relative = song.Relative; this.MP3FileName = song.MP3FileName; this.CoverFileName = song.CoverFileName; this.BackgroundFileName = song.BackgroundFileName; this.VideoFileName = song.VideoFileName; this.VideoAspect = song.VideoAspect; this._CoverLoaded = song._CoverLoaded; this.CoverBigLoaded = song.CoverBigLoaded; this._NotesLoaded = song._NotesLoaded; this.Artist = song.Artist; this.Title = song.Title; this.Start = song.Start; this.Finish = song.Finish; this.BPM = song.BPM; this.Gap = song.Gap; this.VideoGap = song.VideoGap; this.Comment = new List<string>(); foreach (string value in song.Comment) { this.Comment.Add(value); } this.ID = song.ID; this.Visible = song.Visible; this.CatIndex = song.CatIndex; this.Selected = song.Selected; this.Edition = new List<string>(); foreach (string value in song.Edition) { this.Edition.Add(value); } this.Genre = new List<string>(); foreach (string value in song.Genre) { this.Genre.Add(value); } this.Year = song.Year; this.Language = new List<string>(); foreach (string value in song.Language) { this.Language.Add(value); } this.Notes = new CNotes(song.Notes); }
private static void _Sort(ESongSorting sorting, EOffOn Tabs, string SearchString) { if (_Songs.Count == 0) return; _Categories.Clear(); string category = String.Empty; _Tabs = Tabs; List<SongPointer> _SortList = new List<SongPointer>(); List<CSong> _SongList = new List<CSong>(); foreach (CSong song in _Songs) { if (SearchString == String.Empty) _SongList.Add(song); else { if (song.Title.ToUpper().Contains(SearchString.ToUpper()) || song.Artist.ToUpper().Contains(SearchString.ToUpper())) _SongList.Add(song); } } switch (sorting) { case ESongSorting.TR_CONFIG_EDITION: foreach (CSong song in _SongList) { if (song.Edition.Count == 0) _SortList.Add(new SongPointer(song.ID, String.Empty)); else { for (int i = 0; i < song.Edition.Count; i++) { _SortList.Add(new SongPointer(song.ID, song.Edition[i])); } } } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper()); if (res == 0) { if (CConfig.IgnoreArticles == EOffOn.TR_CONFIG_ON) { res = _Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(_Songs[s2.SongID].ArtistSorting.ToUpper()); if (res == 0) { return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper()); } return res; } else { res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper()); if (res == 0) { return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper()); } return res; } } return res; }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); for (int i = 0; i < _SongsSortList.Length; i++ ) { if (_SongsSortList[i].SortString.Length > 0) { if (_SongsSortList[i].SortString != category) { category = _SongsSortList[i].SortString; _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } else { if (CLanguage.Translate("TR_SCREENSONG_NOEDITION") != category) { category = CLanguage.Translate("TR_SCREENSONG_NOEDITION"); _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } } break; case ESongSorting.TR_CONFIG_GENRE: foreach (CSong song in _SongList) { if (song.Genre.Count == 0) _SortList.Add(new SongPointer(song.ID, String.Empty)); else { for (int i = 0; i < song.Genre.Count; i++) { _SortList.Add(new SongPointer(song.ID, song.Genre[i])); } } } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper()); if (res == 0) { if (CConfig.IgnoreArticles == EOffOn.TR_CONFIG_ON) { res = _Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(_Songs[s2.SongID].ArtistSorting.ToUpper()); if (res == 0) { return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper()); } return res; } else { res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper()); if (res == 0) { return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper()); } return res; } } return res; }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); for (int i = 0; i < _SongsSortList.Length; i++) { if (_SongsSortList[i].SortString.Length > 0) { if (_SongsSortList[i].SortString != category) { category = _SongsSortList[i].SortString; _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } else { if (CLanguage.Translate("TR_SCREENSONG_NOGENRE") != category) { category = CLanguage.Translate("TR_SCREENSONG_NOGENRE"); _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } } break; case ESongSorting.TR_CONFIG_NONE: foreach (CSong song in _SongList) { _SortList.Add(new SongPointer(song.ID, String.Empty)); } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper()); if (res == 0) { return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper()); } return res; }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); for (int i = 0; i < _SongsSortList.Length; i++) { _SongsSortList[i].CatIndex = 0; } category = CLanguage.Translate("TR_SCREENSONG_ALLSONGS"); _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); break; case ESongSorting.TR_CONFIG_FOLDER: foreach (CSong song in _SongList) { _SortList.Add(new SongPointer(song.ID, song.FolderName)); } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper()); if (res == 0) { if (CConfig.IgnoreArticles == EOffOn.TR_CONFIG_ON) { res = _Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(_Songs[s2.SongID].ArtistSorting.ToUpper()); if (res == 0) { return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper()); } return res; } else { res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper()); if (res == 0) { return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper()); } return res; } } return res; }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); for (int i = 0; i < _SongsSortList.Length; i++) { if (_SongsSortList[i].SortString != category) { category = _SongsSortList[i].SortString; _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } break; case ESongSorting.TR_CONFIG_ARTIST: foreach (CSong song in _SongList) { _SortList.Add(new SongPointer(song.ID, song.Artist)); } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { if (CConfig.IgnoreArticles == EOffOn.TR_CONFIG_ON) { int res = _Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(_Songs[s2.SongID].ArtistSorting.ToUpper()); if (res == 0) { return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper()); } return res; } else { int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper()); if (res == 0) { return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper()); } return res; } }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); for (int i = 0; i < _SongsSortList.Length; i++) { if (_SongsSortList[i].SortString != category) { category = _SongsSortList[i].SortString; _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } break; case ESongSorting.TR_CONFIG_ARTIST_LETTER: foreach (CSong song in _SongList) { if (CConfig.IgnoreArticles == EOffOn.TR_CONFIG_ON) _SortList.Add(new SongPointer(song.ID, song.ArtistSorting)); else _SortList.Add(new SongPointer(song.ID, song.Artist)); } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper()); if (res == 0) { if (CConfig.IgnoreArticles == EOffOn.TR_CONFIG_ON) { return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper()); } else { return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper()); } } return res; }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); int NotLetterCat = -1; for (int i=0; i < _SongsSortList.Length; i++) { Char firstLetter = Char.ToUpper(_SongsSortList[i].SortString.Normalize(NormalizationForm.FormD)[0]); if (!Char.IsLetter(firstLetter)) { firstLetter = '#'; } if (firstLetter.ToString() != category) { if (firstLetter != '#' || NotLetterCat == -1) { category = firstLetter.ToString(); _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); _SongsSortList[i].CatIndex = _Categories.Count - 1; if (firstLetter == '#') NotLetterCat = _SongsSortList[i].CatIndex; } else _SongsSortList[i].CatIndex = NotLetterCat; } else _SongsSortList[i].CatIndex = _Categories.Count - 1; } break; case ESongSorting.TR_CONFIG_TITLE_LETTER: foreach (CSong song in _SongList) { if (CConfig.IgnoreArticles == EOffOn.TR_CONFIG_ON) _SortList.Add(new SongPointer(song.ID, song.TitleSorting)); else _SortList.Add(new SongPointer(song.ID, song.Title)); } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper()); if (res == 0) { if (CConfig.IgnoreArticles == EOffOn.TR_CONFIG_ON) { return _Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(_Songs[s2.SongID].ArtistSorting.ToUpper()); } else { return _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper()); } } return res; }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); NotLetterCat = -1; for (int i=0; i < _SongsSortList.Length; i++) { Char firstLetter = Char.ToUpper(_SongsSortList[i].SortString.Normalize(NormalizationForm.FormD)[0]); if (!Char.IsLetter(firstLetter)) { firstLetter = '#'; } if (firstLetter.ToString() != category) { if (firstLetter != '#' || NotLetterCat == -1) { category = firstLetter.ToString(); _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); _SongsSortList[i].CatIndex = _Categories.Count - 1; if (firstLetter == '#') NotLetterCat = _SongsSortList[i].CatIndex; } else _SongsSortList[i].CatIndex = NotLetterCat; } else _SongsSortList[i].CatIndex = _Categories.Count - 1; } break; case ESongSorting.TR_CONFIG_DECADE: foreach (CSong song in _SongList) { _SortList.Add(new SongPointer(song.ID, song.Year)); } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { int res = s1.SortString.CompareTo(s2.SortString); if (res == 0) { if (CConfig.IgnoreArticles == EOffOn.TR_CONFIG_ON) { res = _Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(_Songs[s2.SongID].ArtistSorting.ToUpper()); if (res == 0) { return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper()); } return res; } else { res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper()); if (res == 0) { return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper()); } return res; } } return res; }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); for (int i=0; i < _SongsSortList.Length; i++) { if (_SongsSortList[i].SortString.Length > 0 && !_SongsSortList[i].SortString.Equals("0000")) { String decade = _SongsSortList[i].SortString.Substring(0, 3) + "0 - " + _SongsSortList[i].SortString.Substring(0, 3) + "9"; if (decade != category) { category = decade; _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } else { if (CLanguage.Translate("TR_SCREENSONG_NOYEAR") != category) { category = CLanguage.Translate("TR_SCREENSONG_NOYEAR"); _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } } break; case ESongSorting.TR_CONFIG_YEAR: foreach (CSong song in _SongList) { _SortList.Add(new SongPointer(song.ID, song.Year)); } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { int res = s1.SortString.CompareTo(s2.SortString); if (res == 0) { if (CConfig.IgnoreArticles == EOffOn.TR_CONFIG_ON) { res = _Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(_Songs[s2.SongID].ArtistSorting.ToUpper()); if (res == 0) { return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper()); } return res; } else { res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper()); if (res == 0) { return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper()); } return res; } } return res; }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); for (int i=0; i < _SongsSortList.Length; i++) { if (_SongsSortList[i].SortString.Length > 0 && !_SongsSortList[i].SortString.Equals("0000")) { if (_SongsSortList[i].SortString != category) { category = _SongsSortList[i].SortString; _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } else { if (CLanguage.Translate("TR_SCREENSONG_NOYEAR") != category) { category = CLanguage.Translate("TR_SCREENSONG_NOYEAR"); _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } } break; case ESongSorting.TR_CONFIG_LANGUAGE: foreach (CSong song in _SongList) { if (song.Language.Count == 0) _SortList.Add(new SongPointer(song.ID, String.Empty)); else { for (int i = 0; i < song.Language.Count; i++) { _SortList.Add(new SongPointer(song.ID, song.Language[i])); } } } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { int res = s1.SortString.CompareTo(s2.SortString); if (res == 0) { if (CConfig.IgnoreArticles == EOffOn.TR_CONFIG_ON) { res = _Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(_Songs[s2.SongID].ArtistSorting.ToUpper()); if (res == 0) { return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper()); } return res; } else { res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper()); if (res == 0) { return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper()); } return res; } } return res; }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); for (int i=0; i < _SongsSortList.Length; i++) { if (_SongsSortList[i].SortString.Length > 0) { if (_SongsSortList[i].SortString != category) { category = _SongsSortList[i].SortString; _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } else { if (CLanguage.Translate("TR_SCREENSONG_NOLANGUAGE") != category) { category = CLanguage.Translate("TR_SCREENSONG_NOLANGUAGE"); _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } } break; default: break; } if (_Tabs == EOffOn.TR_CONFIG_OFF) { _Categories.Clear(); _Categories.Add(new CCategory("", new STexture(-1), new STexture(-1))); for (int i = 0; i < _SongsSortList.Length; i++) { _SongsSortList[i].CatIndex = 0; } } foreach (CCategory cat in _Categories) { STexture cover = CCover.Cover(cat.Name); cat.CoverTextureSmall = cover; } }
public static void SetGuestProfile(int ProfileNr, EOffOn Option) { if (ProfileNr < 0 || ProfileNr >= _Profiles.Count) return; SProfile profile = _Profiles[ProfileNr]; profile.GuestProfile = Option; _Profiles[ProfileNr] = profile; }
public static void CheckAndApplyConfig(EOffOn NewOnOff, EBackgroundMusicSource NewSource, float NewVolume) { if (CConfig.BackgroundMusic != NewOnOff) { CConfig.BackgroundMusic = NewOnOff; if (NewOnOff == EOffOn.TR_CONFIG_ON) Play(); else Pause(); } if (CConfig.BackgroundMusicSource != NewSource) { CConfig.BackgroundMusicSource = NewSource; switch (NewSource) { case EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC: if (!_BackgroundMusicAdded) AddBackgroundMusic(); RemoveOwnMusic(); break; case EBackgroundMusicSource.TR_CONFIG_ONLY_OWN_MUSIC: if (!_OwnMusicAdded) AddOwnMusic(); RemoveBackgroundMusic(); break; case EBackgroundMusicSource.TR_CONFIG_OWN_MUSIC: if (!_BackgroundMusicAdded) AddBackgroundMusic(); if (!_OwnMusicAdded) AddOwnMusic(); break; } } if (CConfig.BackgroundMusicVolume != NewVolume) { CConfig.BackgroundMusicVolume = (int)NewVolume; ApplyVolume(); } CConfig.SaveConfig(); }
public void SortSongs(ESongSorting sorting, EOffOn tabs, EOffOn ignoreArticles, String searchString, EDuetOptions duetOptions, int playlistID) { CSongs.Sort(sorting, tabs, ignoreArticles, searchString, duetOptions, playlistID); }
public static void Sort(ESongSorting sorting, EOffOn tabs, EOffOn ignoreArticles, String searchString, EDuetOptions duetOptions, int playlistID) { Filter.SetOptions(searchString, duetOptions, playlistID); Sorter.SetOptions(sorting, ignoreArticles); Categorizer.Tabs = tabs; }
private static void _Sort(ESongSorting sorting, EOffOn Tabs, string SearchString) { if (_Songs.Count == 0) { return; } _Categories.Clear(); string category = String.Empty; _Tabs = Tabs; List <SongPointer> _SortList = new List <SongPointer>(); List <CSong> _SongList = new List <CSong>(); foreach (CSong song in _Songs) { if (SearchString == String.Empty) { _SongList.Add(song); } else { if (song.Title.ToUpper().Contains(SearchString.ToUpper()) || song.Artist.ToUpper().Contains(SearchString.ToUpper())) { _SongList.Add(song); } } } switch (sorting) { case ESongSorting.TR_CONFIG_EDITION: foreach (CSong song in _SongList) { if (song.Edition.Count == 0) { _SortList.Add(new SongPointer(song.ID, String.Empty)); } else { for (int i = 0; i < song.Edition.Count; i++) { _SortList.Add(new SongPointer(song.ID, song.Edition[i])); } } } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper()); if (res == 0) { res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper()); if (res == 0) { return(_Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper())); } return(res); } return(res); }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); for (int i = 0; i < _SongsSortList.Length; i++) { if (_SongsSortList[i].SortString.Length > 0) { if (_SongsSortList[i].SortString != category) { category = _SongsSortList[i].SortString; _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } else { if (CLanguage.Translate("TR_SCREENSONG_NOEDITION") != category) { category = CLanguage.Translate("TR_SCREENSONG_NOEDITION"); _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } } break; case ESongSorting.TR_CONFIG_GENRE: foreach (CSong song in _SongList) { if (song.Genre.Count == 0) { _SortList.Add(new SongPointer(song.ID, String.Empty)); } else { for (int i = 0; i < song.Genre.Count; i++) { _SortList.Add(new SongPointer(song.ID, song.Genre[i])); } } } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper()); if (res == 0) { res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper()); if (res == 0) { return(_Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper())); } return(res); } return(res); }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); for (int i = 0; i < _SongsSortList.Length; i++) { if (_SongsSortList[i].SortString.Length > 0) { if (_SongsSortList[i].SortString != category) { category = _SongsSortList[i].SortString; _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } else { if (CLanguage.Translate("TR_SCREENSONG_NOGENRE") != category) { category = CLanguage.Translate("TR_SCREENSONG_NOGENRE"); _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } } break; case ESongSorting.TR_CONFIG_NONE: foreach (CSong song in _SongList) { _SortList.Add(new SongPointer(song.ID, String.Empty)); } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper()); if (res == 0) { return(_Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper())); } return(res); }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); for (int i = 0; i < _SongsSortList.Length; i++) { _SongsSortList[i].CatIndex = 0; } category = CLanguage.Translate("TR_SCREENSONG_ALLSONGS"); _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); break; case ESongSorting.TR_CONFIG_FOLDER: foreach (CSong song in _SongList) { _SortList.Add(new SongPointer(song.ID, song.FolderName)); } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper()); if (res == 0) { res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper()); if (res == 0) { return(_Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper())); } return(res); } return(res); }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); for (int i = 0; i < _SongsSortList.Length; i++) { if (_SongsSortList[i].SortString != category) { category = _SongsSortList[i].SortString; _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } break; case ESongSorting.TR_CONFIG_ARTIST: foreach (CSong song in _SongList) { _SortList.Add(new SongPointer(song.ID, song.Artist)); } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper()); if (res == 0) { return(_Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper())); } return(res); }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); for (int i = 0; i < _SongsSortList.Length; i++) { if (_SongsSortList[i].SortString != category) { category = _SongsSortList[i].SortString; _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } break; case ESongSorting.TR_CONFIG_ARTIST_LETTER: foreach (CSong song in _SongList) { _SortList.Add(new SongPointer(song.ID, song.Artist)); } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper()); if (res == 0) { return(_Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper())); } return(res); }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); int NotLetterCat = -1; for (int i = 0; i < _SongsSortList.Length; i++) { Char firstLetter = Char.ToUpper(_SongsSortList[i].SortString[0]); if (!Char.IsLetter(firstLetter)) { firstLetter = '#'; } if (firstLetter.ToString() != category) { if (firstLetter != '#' || NotLetterCat == -1) { category = firstLetter.ToString(); _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); _SongsSortList[i].CatIndex = _Categories.Count - 1; if (firstLetter == '#') { NotLetterCat = _SongsSortList[i].CatIndex; } } else { _SongsSortList[i].CatIndex = NotLetterCat; } } else { _SongsSortList[i].CatIndex = _Categories.Count - 1; } } break; case ESongSorting.TR_CONFIG_TITLE_LETTER: foreach (CSong song in _SongList) { _SortList.Add(new SongPointer(song.ID, song.Title)); } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper()); if (res == 0) { return(_Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper())); } return(res); }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); NotLetterCat = -1; for (int i = 0; i < _SongsSortList.Length; i++) { Char firstLetter = Char.ToUpper(_SongsSortList[i].SortString[0]); if (!Char.IsLetter(firstLetter)) { firstLetter = '#'; } if (firstLetter.ToString() != category) { if (firstLetter != '#' || NotLetterCat == -1) { category = firstLetter.ToString(); _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); _SongsSortList[i].CatIndex = _Categories.Count - 1; if (firstLetter == '#') { NotLetterCat = _SongsSortList[i].CatIndex; } } else { _SongsSortList[i].CatIndex = NotLetterCat; } } else { _SongsSortList[i].CatIndex = _Categories.Count - 1; } } break; case ESongSorting.TR_CONFIG_DECADE: foreach (CSong song in _SongList) { _SortList.Add(new SongPointer(song.ID, song.Year)); } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { int res = s1.SortString.CompareTo(s2.SortString); if (res == 0) { res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper()); if (res == 0) { return(_Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper())); } return(res); } return(res); }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); for (int i = 0; i < _SongsSortList.Length; i++) { if (_SongsSortList[i].SortString.Length > 0 && !_SongsSortList[i].SortString.Equals("0000")) { String decade = _SongsSortList[i].SortString.Substring(0, 3) + "0 - " + _SongsSortList[i].SortString.Substring(0, 3) + "9"; if (decade != category) { category = decade; _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } else { if (CLanguage.Translate("TR_SCREENSONG_NOYEAR") != category) { category = CLanguage.Translate("TR_SCREENSONG_NOYEAR"); _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } } break; case ESongSorting.TR_CONFIG_YEAR: foreach (CSong song in _SongList) { _SortList.Add(new SongPointer(song.ID, song.Year)); } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { int res = s1.SortString.CompareTo(s2.SortString); if (res == 0) { res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper()); if (res == 0) { return(_Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper())); } return(res); } return(res); }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); for (int i = 0; i < _SongsSortList.Length; i++) { if (_SongsSortList[i].SortString.Length > 0 && !_SongsSortList[i].SortString.Equals("0000")) { if (_SongsSortList[i].SortString != category) { category = _SongsSortList[i].SortString; _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } else { if (CLanguage.Translate("TR_SCREENSONG_NOYEAR") != category) { category = CLanguage.Translate("TR_SCREENSONG_NOYEAR"); _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } } break; case ESongSorting.TR_CONFIG_LANGUAGE: foreach (CSong song in _SongList) { if (song.Language.Count == 0) { _SortList.Add(new SongPointer(song.ID, String.Empty)); } else { for (int i = 0; i < song.Language.Count; i++) { _SortList.Add(new SongPointer(song.ID, song.Language[i])); } } } _SortList.Sort(delegate(SongPointer s1, SongPointer s2) { int res = s1.SortString.CompareTo(s2.SortString); if (res == 0) { res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper()); if (res == 0) { return(_Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper())); } return(res); } return(res); }); _SongsSortList = _SortList.ToArray(); _Categories.Clear(); for (int i = 0; i < _SongsSortList.Length; i++) { if (_SongsSortList[i].SortString.Length > 0) { if (_SongsSortList[i].SortString != category) { category = _SongsSortList[i].SortString; _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } else { if (CLanguage.Translate("TR_SCREENSONG_NOLANGUAGE") != category) { category = CLanguage.Translate("TR_SCREENSONG_NOLANGUAGE"); _Categories.Add(new CCategory(category, new STexture(-1), new STexture(-1))); } _SongsSortList[i].CatIndex = _Categories.Count - 1; } } break; default: break; } if (_Tabs == EOffOn.TR_CONFIG_OFF) { _Categories.Clear(); _Categories.Add(new CCategory("", new STexture(-1), new STexture(-1))); for (int i = 0; i < _SongsSortList.Length; i++) { _SongsSortList[i].CatIndex = 0; } } foreach (CCategory cat in _Categories) { STexture cover = CCover.Cover(cat.Name); cat.CoverTextureSmall = cover; } }