Beispiel #1
0
        static void dumpPlayListItem(IPlaylistItem itm, string itdel)
        {
            string txtline = "				"+ itdel + "{";

            txtline = txtline + "'EndOffset': '" + itm.EndOffset + "'";
            txtline = txtline + ", 'Length': '" + itm.Length + "'";
            txtline = txtline + ", 'Position': '" + itm.Position + "'";
            txtline = txtline + ", 'StartOffset': '" + itm.StartOffset + "'";
            if (itm.GetType() == typeof(PatternPlaylistItem))
            {
                PatternPlaylistItem pli = (PatternPlaylistItem)itm;
                txtline = txtline + ", 'pattern_id': '" + pli.Pattern.Id + "'";
                txtline = txtline + ", 'channel_id': null";
                txtline = txtline + ", 'muted': '" + pli.Muted + "'";
            }
            else
            {
                if (itm.GetType() == typeof(ChannelPlaylistItem))
                {
                    ChannelPlaylistItem chpli = (ChannelPlaylistItem)itm;
                    txtline = txtline + ", 'pattern_id': null";
                    txtline = txtline + ", 'channel_id': '" + chpli.Channel.Id + "'";
                    txtline = txtline + ", 'muted': '" + chpli.Muted + "'";
                }
                else
                {
                    txtline = txtline + ", 'pattern_id': null";
                    txtline = txtline + ", 'channel_id': null";
                    txtline = txtline + ", 'muted': null";
                }
            }
            txtline = txtline + "}";
            Console.WriteLine(txtline);
        }
Beispiel #2
0
        // initializes a playlist item using a corresponding STON value
        private static void InitializeFromSton(IPlaylistItem item, IStonDocument document, IStonComplexEntity entity, IDictionary <IStonValuedEntity, object> builtObjects)
        {
            item.Name = FromSton <string>(document, GetValue(document, document.GetMember(entity, new StonBindingName("Name"))), builtObjects) ?? item.GetType().Name;

            // playlist never declares its path explicitly
            // in general, it should be based on the playlist location instead
            if (!(item is Playlist))
            {
                item.Path = FromSton <string>(document, GetValue(document, document.GetMember(entity, new StonBindingName("Path"))), builtObjects) ?? "";
            }

            // loading subitems of a container
            if (item is IPlaylistContainer)
            {
                var container = item as IPlaylistContainer;
                foreach (var subitemData in entity.CollectionInit.Elements)
                {
                    var subitem = FromSton <IPlaylistItem>(document, GetValue(document, subitemData), builtObjects);
                    container.Add(subitem);
                }
            }

            // loading the loop provider of a playlist
            if (item is Track)
            {
                (item as Track).StreamProvider = FromSton <IStreamProvider>(document, GetValue(document, document.GetMember(entity, new StonBindingName("Stream"))), builtObjects);
            }
        }