コード例 #1
0
ファイル: Tracklist.cs プロジェクト: ume05rw/MopidySharp
        /// <summary>
        /// Filter the tracklist by the given criteria.
        /// </summary>
        /// <param name="tlId">one or more rules to match by</param>
        /// <param name="uri">one or more rules to match by</param>
        /// <returns></returns>
        /// <remarks>
        /// Each rule in the criteria consists of a model field
        /// and a list of values to compare it against.
        /// If the model field matches any of the values, it may be returned.
        /// Only tracks that match all the given criteria are returned.
        /// </remarks>
        public static Task <(bool Succeeded, TlTrack[] Result)> Filter(
            int?tlId   = null,
            string uri = null
            )
        {
            var criteria = new Criteria();

            if (tlId != null)
            {
                criteria.TlId.Add((int)tlId);
            }
            if (uri != null)
            {
                criteria.Uri.Add(uri);
            }

            return(Tracklist.Filter(criteria));
        }
コード例 #2
0
ファイル: Tracklist.cs プロジェクト: ume05rw/MopidySharp
        /// <summary>
        /// Filter the tracklist by the given criteria.
        /// </summary>
        /// <param name="tlId">one or more rules to match by</param>
        /// <param name="uri">one or more rules to match by</param>
        /// <returns></returns>
        /// <remarks>
        /// Each rule in the criteria consists of a model field
        /// and a list of values to compare it against.
        /// If the model field matches any of the values, it may be returned.
        /// Only tracks that match all the given criteria are returned.
        /// </remarks>
        public static Task <(bool Succeeded, TlTrack[] Result)> Filter(
            int[] tlId   = null,
            string[] uri = null
            )
        {
            var criteria = new Criteria();

            if (tlId != null && 0 < tlId.Length)
            {
                criteria.TlId.AddRange(tlId);
            }
            if (uri != null && 0 < uri.Length)
            {
                criteria.Uri.AddRange(uri);
            }

            return(Tracklist.Filter(criteria));
        }