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);
        }
Exemple #2
0
        public static void Init()
        {
            TraxSoundManager.Songs.Clear();
            DataTable table;

            using (IQueryAdapter queryReactor = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                queryReactor.RunQuery("SELECT * FROM jukebox_songs_data");
                table = queryReactor.getTable();
            }
            foreach (DataRow row in table.Rows)
            {
                TraxSoundManager.Songs.Add(TraxMusicData.Parse(row));
            }
            string CurrentTime = DateTime.Now.ToString("HH:mm:ss" + " | ");

            Console.WriteLine(CurrentTime + "» Jukebox " + TraxSoundManager.Songs.Count + " nummers");
        }
        public Dictionary <int, Item> GetPlayLine()
        {
            int num = 0;
            Dictionary <int, Item> dictionary = new Dictionary <int, Item>();

            checked
            {
                foreach (Item current in this.Playlist)
                {
                    TraxMusicData musicByItem = this.GetMusicByItem(current);
                    bool          flag        = musicByItem == null;
                    if (!flag)
                    {
                        dictionary.Add(num, current);
                        num += musicByItem.Length;
                    }
                }
                return(dictionary);
            }
        }