public bool AddDisc(Item item) { bool flag = item.GetBaseItem().InteractionType != InteractionType.MUSIC_DISC; bool result; if (flag) { result = false; } else { int id; bool flag2 = !int.TryParse(item.ExtraData, out id); if (flag2) { result = false; } else { TraxMusicData music = TraxSoundManager.GetMusic(id); bool flag3 = music == null; if (flag3) { result = false; } else { bool flag4 = this.Playlist.Contains(item); if (flag4) { result = false; } else { bool isPlaying = this.IsPlaying; if (isPlaying) { result = false; } else { using (IQueryAdapter queryReactor = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery("INSERT INTO room_jukebox_songs (room_id, item_id) VALUES (@room, @item)"); queryReactor.AddParameter("room", this.Room.Id); queryReactor.AddParameter("item", item.Id); queryReactor.RunQuery(); } this.Playlist.Add(item); this.Room.SendMessage(new SetJukeboxPlayListComposer(this.Room), false); this.Room.SendMessage(new LoadJukeboxUserMusicItemsComposer(this.Room), false); result = true; } } } } } return(result); }
public TraxMusicData GetMusicByItem(Item item) { return((item != null) ? TraxSoundManager.GetMusic(item.ExtradataInt) : null); }