/// <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}\"!"); } }
/// <summary> /// Move song to top /// </summary> /// <param name="p_Service">Chat service</param> /// <param name="p_Message">Chat message</param> /// <param name="p_ID">ID of the BSR</param> private void Command_MoveToTop(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(); lock (SongQueue) { var l_BeatMap = SongQueue.Where(x => x.BeatMap.Key.ToLower() == l_Key).FirstOrDefault(); if (l_BeatMap != null) { SongQueue.Remove(l_BeatMap); SongQueue.Insert(0, l_BeatMap); SendChatMessage($"@{p_Message.Sender.UserName} (bsr {l_BeatMap.BeatMap.Key}) {l_BeatMap.BeatMap.Metadata.SongName} / {l_BeatMap.BeatMap.Metadata.LevelAuthorName} is now on top of queue!"); /// Update request manager OnQueueChanged(); return; } SendChatMessage($"@{p_Message.Sender.UserName} No song in queue found with the key \"{l_Key}\"!"); } }
public void RemoveFromQueue(Song parameter) { SongQueue.Remove(parameter); }