/// <summary> /// UnBlacklist song /// </summary> /// <param name="p_Entry">Song to blacklist</param> internal void UnBlacklistSong(SongEntry p_Entry) { if (p_Entry == null) { return; } lock (SongQueue) { lock (SongHistory) { lock (SongBlackList) { /// Remove from blacklist if (SongBlackList.Contains(p_Entry)) { SongBlackList.Remove(p_Entry); } /// Move at top of history SongHistory.RemoveAll(x => x.BeatMap.Hash == p_Entry.BeatMap.Hash); SongHistory.Insert(0, p_Entry); /// Reduce history size while (SongHistory.Count > Config.ChatRequest.HistorySize) { SongHistory.RemoveAt(SongHistory.Count - 1); } } } } /// Update request manager OnQueueChanged(false); }
/// <summary> /// Internal method call to run the test. /// </summary> /// <param name="song">The song to check.</param> /// <param name="songFile">The parsed file as a string array.</param> /// <param name="bytes">The parsed file as a byte array.</param> /// <param name="songEntries">All song entries already found.</param> /// <returns><c>true</c> if an error was found; otherwise <c>false</c>.</returns> protected override bool onRun(SongEntry song, string[] songFile, byte[] bytes, List <SongEntry> songEntries) { bool error = false; // Default assume NO error foreach (string line in songFile) { if (line.ToUpper().StartsWith("#GAP:")) { string gap = line.Substring(5).Trim(); if (gap == "") { break; } char[] numbers = "-0123456789.,".ToCharArray(); foreach (char c in gap) { if (!numbers.Contains(c)) { error = true; } } } } if (error) { logOutput.Add(" => Invalid GAP tag found: " + song.FileName); } return(error); }
/// <summary> /// Command wrong /// </summary> /// <param name="p_Service">Chat service</param> /// <param name="p_Message">Chat message</param> private void Command_Wrong(IChatService p_Service, IChatMessage p_Message) { SongEntry l_SongEntry = null; lock (SongQueue) { l_SongEntry = SongQueue.Where(x => x.RequesterName == p_Message.Sender.UserName).LastOrDefault(); if (l_SongEntry != null) { SongQueue.Remove(l_SongEntry); } } if (l_SongEntry != null) { SendChatMessage($"@{p_Message.Sender.UserName} (bsr {l_SongEntry.BeatMap.Key}) {l_SongEntry.BeatMap.Metadata.SongName} / {l_SongEntry.BeatMap.Metadata.LevelAuthorName} is removed from queue!"); /// Update request manager OnQueueChanged(); } else { SendChatMessage($"@{p_Message.Sender.UserName} You have no song in queue!"); } }
/// <summary> /// Command remove /// </summary> /// <param name="p_Service">Chat service</param> /// <param name="p_Message">Chat message</param> private void Command_Remove(IChatService p_Service, IChatMessage p_Message, string p_ID) { if (!HasPower(p_Message.Sender)) { SendChatMessage($"@{p_Message.Sender.UserName} You have no power here!"); return; } string l_Key = p_ID.ToLower(); SongEntry l_SongEntry = null; lock (SongQueue) { l_SongEntry = SongQueue.Where(x => x.BeatMap.Key.ToLower() == l_Key).FirstOrDefault(); if (l_SongEntry != null) { SongQueue.Remove(l_SongEntry); } } if (l_SongEntry != null) { SendChatMessage($"@{p_Message.Sender.UserName} (bsr {l_SongEntry.BeatMap.Key}) {l_SongEntry.BeatMap.Metadata.SongName} / {l_SongEntry.BeatMap.Metadata.LevelAuthorName} is removed from queue!"); /// Update request manager OnQueueChanged(); } else { SendChatMessage($"@{p_Message.Sender.UserName} No song in queue found with the key \"{l_Key}\"!"); } }
public void UpdateSongsList() { entries.Clear(); if (content.childCount > 0) { GameObject[] children = new GameObject[content.childCount]; int i = 0; foreach (Transform childTransform in content) { children[i] = childTransform.gameObject; i++; } foreach (GameObject child in children) { Destroy(child); } } foreach (string supportedAudioFormat in BeatmapLoader.SupportedAudioFormats) { foreach (string audioFile in Directory.EnumerateFiles(Application.streamingAssetsPath + "/Songs", $"*{supportedAudioFormat}")) { SongEntry entry = Instantiate(SongEntryModel, content); entry.gameObject.name = entries.Count + " - " + Path.GetFileNameWithoutExtension(audioFile); entry.ScrollView = this; entry.SetSong(entries.Count, audioFile); entries.Add(entry); } } //string[] songFolders = Directory.GetDirectories(Application.streamingAssetsPath + "/Songs"); //foreach (string songFolder in songFolders) //{ // string[] bmFiles = Directory.GetFiles(songFolder, "*.icebm"); // foreach (string bmFile in bmFiles) // { // SongEntry entry = Instantiate(SongEntryModel, content); // entry.gameObject.name = entries.Count + " - " + Path.GetFileNameWithoutExtension(bmFile); // entry.ScrollView = this; // entry.SetSong(entries.Count, bmFile); // entries.Add(entry); // } //} if (entries.Count > 0) { // Add some padding on top and bottom of the list VerticalLayoutGroup vlg = content.GetComponent <VerticalLayoutGroup>(); RectTransform viewportRect = viewport.GetComponent <RectTransform>(); RectTransform entryRect = SongEntryModel.GetComponent <RectTransform>(); int padding = (int)((viewportRect.rect.height / 2) - (entryRect.rect.height / 2)); if (padding > 0) { vlg.padding.top = padding; vlg.padding.bottom = padding; } } }
/// <summary> /// Blacklist song /// </summary> /// <param name="p_Entry">Song to blacklist</param> internal void BlacklistSong(SongEntry p_Entry) { if (p_Entry == null) { return; } lock (SongQueue) { lock (SongHistory) { lock (SongBlackList) { /// Remove from queue if (SongQueue.Contains(p_Entry)) { SongQueue.Remove(p_Entry); } /// Remove from history SongHistory.RemoveAll(x => x.BeatMap.Hash == p_Entry.BeatMap.Hash); /// Add to blacklist SongBlackList.RemoveAll(x => x.BeatMap.Hash == p_Entry.BeatMap.Hash); SongBlackList.Insert(0, p_Entry); } } } /// Update request manager OnQueueChanged(false); }
/// <summary> /// Internal method call to run the test. /// </summary> /// <param name="song">The song to check.</param> /// <param name="songFile">The parsed file as a string array.</param> /// <param name="bytes">The parsed file as a byte array.</param> /// <param name="songEntries">All song entries already found.</param> /// <returns><c>true</c> if an error was found; otherwise <c>false</c>.</returns> protected override bool onRun(SongEntry song, string[] songFile, byte[] bytes, List <SongEntry> songEntries) { byte prevByte = bytes[0]; bool windowsLineTermination = false; bool linuxLineTermination = false; for (int i = 1; i < bytes.Length; i++) { if (bytes[i] == 0x0A && prevByte == 0x0D) { windowsLineTermination = true; } if (bytes[i] == 0x0A && prevByte != 0x0D) { linuxLineTermination = true; } prevByte = bytes[i]; } if (windowsLineTermination && linuxLineTermination) { logOutput.Add(" => Mixed line termination found: " + song.FileName); return(true); } else { return(false); } }
// Token: 0x06001E76 RID: 7798 RVA: 0x000FBEA0 File Offset: 0x000FA0A0 private static int smethod_19(SongEntry songEntry_0) { int result = 0; switch (SongDirectory.sortedInstrument) { case GStruct2.GEnum11.Guitar: case GStruct2.GEnum11.GuitarCoop: result = (int)songEntry_0.guitarDifficulty; break; case GStruct2.GEnum11.Bass: result = (int)songEntry_0.bassDifficulty; break; case GStruct2.GEnum11.Rhythm: result = (int)songEntry_0.rhythmDifficulty; break; case GStruct2.GEnum11.GHLGuitar: result = (int)songEntry_0.ghlGuitarDifficulty; break; case GStruct2.GEnum11.GHLBass: result = (int)songEntry_0.ghlBassDifficulty; break; case GStruct2.GEnum11.Keys: result = (int)songEntry_0.keysDifficulty; break; } return(result); }
public static bool AddPlayingSongToCollection() { using (var s_Db = Database.GetConnection()) { var s_Song = s_Db.SingleById <SongEntry>(Application.Library.Broadcast.PlayingSongID); if (s_Song != null) { return(false); } s_Song = new SongEntry() { AlbumID = Application.Library.Broadcast.PlayingAlbumID, AlbumName = Application.Library.Broadcast.PlayingSongAlbum, ArtistID = Application.Library.Broadcast.PlayingArtistID, ArtistName = Application.Library.Broadcast.PlayingSongArtist, SongID = Application.Library.Broadcast.PlayingSongID, SongName = Application.Library.Broadcast.PlayingSongName }; s_Db.Insert(s_Song); CollectionSongs.Add(s_Song.SongID); return(true); } }
// Token: 0x0600014F RID: 335 RVA: 0x0001C690 File Offset: 0x0001A890 public void method_18(SongEntry songEntry_0) { if (!base.enabled) { return; } this.gclass2_0.string_1 = "-"; this.gclass2_0.string_0 = songEntry_0.artistName + "/preview" + songEntry_0.songName; this.method_0(); GClass1.smethod_33(this.gclass2_0); }
// Token: 0x0600017E RID: 382 RVA: 0x0001CF28 File Offset: 0x0001B128 public void method_42(SongEntry songEntry_0) { if (!base.enabled) { return; } this.gclass2_0.string_1 = "Gameplay"; this.gclass2_0.string_0 = songEntry_0.artistName + "setlistSongCountSingular" + songEntry_0.songName; this.method_0(); GClass1.smethod_4(this.gclass2_0); }
// Token: 0x06000179 RID: 377 RVA: 0x0001CED0 File Offset: 0x0001B0D0 public void method_39(SongEntry songEntry_0) { if (!base.enabled) { return; } this.gclass2_0.string_1 = "volume"; this.gclass2_0.string_0 = songEntry_0.artistName + "+" + songEntry_0.songName; this.method_53(); GClass1.smethod_14(this.gclass2_0); }
// Token: 0x06000175 RID: 373 RVA: 0x0001CE2C File Offset: 0x0001B02C public void method_37(SongEntry songEntry_0) { if (!base.enabled) { return; } this.gclass2_0.string_1 = "Songs Scanned"; this.gclass2_0.string_0 = songEntry_0.artistName + "No Part" + songEntry_0.songName; this.method_50(); GClass1.smethod_12(this.gclass2_0); }
// Token: 0x0600016A RID: 362 RVA: 0x0001CB80 File Offset: 0x0001AD80 public void method_31(SongEntry songEntry_0) { if (!base.enabled) { return; } this.gclass2_0.string_1 = "In Menus: Song Select"; this.gclass2_0.string_0 = songEntry_0.artistName + " - " + songEntry_0.songName; this.method_34(); GClass1.smethod_6(this.gclass2_0); }
// Token: 0x06000166 RID: 358 RVA: 0x0001CADC File Offset: 0x0001ACDC public void method_28(SongEntry songEntry_0) { if (!base.enabled) { return; } this.gclass2_0.string_1 = "Highway SP Effects"; this.gclass2_0.string_0 = songEntry_0.artistName + "Disabled" + songEntry_0.songName; this.method_34(); GClass1.smethod_33(this.gclass2_0); }
// Token: 0x06000163 RID: 355 RVA: 0x0001C9D0 File Offset: 0x0001ABD0 public void method_26(SongEntry songEntry_0) { if (!base.enabled) { return; } this.gclass2_0.string_1 = ":"; this.gclass2_0.string_0 = songEntry_0.artistName + ".png" + songEntry_0.songName; this.method_53(); GClass1.smethod_40(this.gclass2_0); }
// Token: 0x060010F4 RID: 4340 RVA: 0x00081354 File Offset: 0x0007F554 public void method_83(string string_3) { SongEntry item = SongDirectory.songEntries[base.Int32_0]; SongDirectory.smethod_15((string_3 == null) ? null : string_3); this.vmethod_3(); this.sortText.text = GClass4.gclass4_0.method_41("</color>") + "Rhythm Guitar" + SongDirectory.String_1 + "scores_backup.bin"; this.vmethod_23(SongDirectory.songEntries.IndexOf(item)); this.bool_5 = true; this.bool_1 = true; }
// Token: 0x060010CB RID: 4299 RVA: 0x00080274 File Offset: 0x0007E474 public void method_60(string string_3) { SongEntry item = SongDirectory.songEntries[base.Int32_0]; SongDirectory.smethod_15((string_3 == null) ? null : string_3); this.vmethod_67(); this.sortText.text = GClass4.gclass4_0.method_13("SORTING BY") + ": <color=#FDB400FF>" + SongDirectory.String_1 + "</color>"; this.vmethod_23(SongDirectory.songEntries.IndexOf(item)); this.bool_5 = false; this.bool_1 = false; }
/// <summary> /// Internal method call to run the test. /// </summary> /// <param name="song">The song to check.</param> /// <param name="songFile">The parsed file as a string array.</param> /// <param name="bytes">The parsed file as a byte array.</param> /// <param name="songEntries">All song entries already found.</param> /// <returns><c>true</c> if an error was found; otherwise <c>false</c>.</returns> protected override bool onRun(SongEntry song, string[] songFile, byte[] bytes, List <SongEntry> songEntries) { if (song.Title == "" || song.Artist == "" || song.MP3 == "") { logOutput.Add(" => Invalid song found: " + song.FileName); return(true); } else { return(false); } }
/// <summary> /// Internal method call to run the test. /// </summary> /// <param name="song">The song to check.</param> /// <param name="songFile">The parsed file as a string array.</param> /// <param name="bytes">The parsed file as a byte array.</param> /// <param name="songEntries">All song entries already found.</param> /// <returns><c>true</c> if an error was found; otherwise <c>false</c>.</returns> protected override bool onRun(SongEntry song, string[] songFile, byte[] bytes, List <SongEntry> songEntries) { if (song.Language == "") { logOutput.Add(" => Empty or missing language tag found: " + song.FileName); return(true); } else { return(false); } }
/// <summary> /// Internal method call to run the test. /// </summary> /// <param name="song">The song to check.</param> /// <param name="songFile">The parsed file as a string array.</param> /// <param name="bytes">The parsed file as a byte array.</param> /// <param name="songEntries">All song entries already found.</param> /// <returns><c>true</c> if an error was found; otherwise <c>false</c>.</returns> protected override bool onRun(SongEntry song, string[] songFile, byte[] bytes, List <SongEntry> songEntries) { if (songEntries.Contains(song)) { logOutput.Add(" => Duplicate song found: " + song.FileName); logOutput.Add(" " + songEntries[songEntries.IndexOf(song, 0)].FileName); return(true); } else { return(false); } }
/// <summary> /// Runs the test. /// </summary> /// <param name="song">The song to check.</param> /// <param name="songFile">The parsed file as a string array.</param> /// <param name="bytes">The parsed file as a byte array.</param> /// <param name="songEntries">All song entries already found.</param> /// <returns><c>true</c> if an error was found; otherwise <c>false</c>.</returns> public bool Run(SongEntry song, string[] songFile, byte[] bytes, List <SongEntry> songEntries) { if (Enabled) { bool result = onRun(song, songFile, bytes, songEntries); if (result) { ErrorCounter++; } return(result); } else { return(false); } }
/// <summary> /// Internal method call to run the test. /// </summary> /// <param name="song">The song to check.</param> /// <param name="songFile">The parsed file as a string array.</param> /// <param name="bytes">The parsed file as a byte array.</param> /// <param name="songEntries">All song entries already found.</param> /// <returns><c>true</c> if an error was found; otherwise <c>false</c>.</returns> protected override bool onRun(SongEntry song, string[] songFile, byte[] bytes, List <SongEntry> songEntries) { bool error = false; // Default assume NO error foreach (string line in songFile) { if (line.ToUpper().StartsWith("#LANGAUGE:")) { error = true; } } if (error) { logOutput.Add(" => Wrong tag found: " + song.FileName); } return(error); }
/// <summary> /// Internal method call to run the test. /// </summary> /// <param name="song">The song to check.</param> /// <param name="songFile">The parsed file as a string array.</param> /// <param name="bytes">The parsed file as a byte array.</param> /// <param name="songEntries">All song entries already found.</param> /// <returns><c>true</c> if an error was found; otherwise <c>false</c>.</returns> protected override bool onRun(SongEntry song, string[] songFile, byte[] bytes, List <SongEntry> songEntries) { // Basic check if (song.Language == "") { return(false); // Nothing written in file } // Test for PascalCase if (song.Language.All(char.IsUpper) || song.Language.All(char.IsLower) || song.Language[0] != song.Language.ToUpper()[0]) { logOutput.Add(" => Invalid language format found: " + song.FileName); return(true); } else { return(false); } }
public SongSelect() : base("Song Select") { songs = Directory.GetFiles(Directory.GetCurrentDirectory() + "\\Songs").Where(f => f.Substring(f.LastIndexOf('.')).Equals(".mp3")).Select(fullPath => { var temp = fullPath.LastIndexOf("\\Songs") + 7; var length = fullPath.LastIndexOf(".") - temp; return(new songInfo { songName = fullPath.Substring(temp, length), songPath = fullPath }); }).ToArray(); foreach (songInfo song in songs) { SongEntry temp = new SongEntry(song); temp.Selected += SelectedSong;// attach an event here MenuEntries.Add(temp); } }
/// <summary> /// When a beatmap get fully loaded /// </summary> /// <param name="p_Task">Task instance</param> private void OnBeatmapPopulated(Task p_Task, SongEntry p_Entry) { if (p_Task.Status != TaskStatus.RanToCompletion) { return; } if (p_Entry.BeatMap.Partial) { lock (SongQueue) { lock (SongHistory) { lock (SongBlackList) { SongQueue.RemoveAll(x => x == p_Entry); SongHistory.RemoveAll(y => y == p_Entry); SongBlackList.RemoveAll(z => z == p_Entry); } } } } /// Update request manager OnQueueChanged(); }
/// <summary> /// Internal method call to run the test. /// </summary> /// <param name="song">The song to check.</param> /// <param name="songFile">The parsed file as a string array.</param> /// <param name="bytes">The parsed file as a byte array.</param> /// <param name="songEntries">All song entries already found.</param> /// <returns><c>true</c> if an error was found; otherwise <c>false</c>.</returns> protected override bool onRun(SongEntry song, string[] songFile, byte[] bytes, List <SongEntry> songEntries) { bool error = false; // Default assume NO error foreach (string line in songFile) { if (line.ToUpper().StartsWith("#YEAR:")) { string year = line.Substring(6).Trim(); if (year == "") { break; } char[] numbers = "0123456789".ToCharArray(); foreach (char c in year) { if (!numbers.Contains(c)) { error = true; } } if (year.Length > 4) { error = true; } if (!error) { int iYear = Convert.ToInt32(year); if (iYear < 0 || iYear > 2100) { error = true; } } } } if (error) { logOutput.Add(" => Invalid year tag found: " + song.FileName); } return(error); }
private void KeyDownMethod(KeyEventArgs e) { if (e.Key == Key.Delete && Songs.Count != 0) { try { var firstToDelete = Songs.Where(x => x.IsSelected).Min(x => x.Index) - 1; foreach (var x in Songs.ToList().Where(x => x.IsSelected)) { Songs.Remove(x); } if (Songs.Count == 0) { CurrentSong = new SongEntry(); } else if (firstToDelete == 0) { CurrentSong = Songs[0]; } else if (Songs.Count == firstToDelete) { CurrentSong = Songs[0]; } else if (Songs.Count > firstToDelete) { CurrentSong = Songs[firstToDelete]; } foreach (var item in Songs) { item.Index = Songs.IndexOf(item) + 1; } } catch (Exception) { // ignored } } else if (e.Key == Key.Enter && CurrentSong != null) { PlayMethod(); } }
/// <summary> /// Internal method call to run the test. /// </summary> /// <param name="song">The song to check.</param> /// <param name="songFile">The parsed file as a string array.</param> /// <param name="bytes">The parsed file as a byte array.</param> /// <param name="songEntries">All song entries already found.</param> /// <returns><c>true</c> if an error was found; otherwise <c>false</c>.</returns> protected override bool onRun(SongEntry song, string[] songFile, byte[] bytes, List <SongEntry> songEntries) { int count = 0; foreach (string line in songFile) { if (line.Trim() == "") { count++; } } if (count >= 1) { logOutput.Add(" => Multiple empty lines found: " + song.FileName); return(true); } else { return(false); } }
/// <summary> /// Internal method call to run the test. /// </summary> /// <param name="song">The song to check.</param> /// <param name="songFile">The parsed file as a string array.</param> /// <param name="bytes">The parsed file as a byte array.</param> /// <param name="songEntries">All song entries already found.</param> /// <returns><c>true</c> if an error was found; otherwise <c>false</c>.</returns> protected override bool onRun(SongEntry song, string[] songFile, byte[] bytes, List <SongEntry> songEntries) { bool error = false; // Default assume NO error foreach (string line in songFile) { if (line.StartsWith("#") && line.Contains(':')) { string tagName = line.Substring(1, line.IndexOf(':') - 1); if (tagName.Any(char.IsLower)) { error = true; } } } if (error) { logOutput.Add(" => Lower-case characters found: " + song.FileName); } return(error); }