Beispiel #1
0
 internal static int Count <T>(CountFunc <T> countFunc, T param, CountArguments arguments)
 {
     using (var filter = QueryArguments.ToNativeHandle(arguments))
     {
         countFunc(param, filter, out var count).ThrowIfError("Failed to query count");
         return(count);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Retrieves the number of media information under the folder with the <see cref="CountArguments"/>.
        /// </summary>
        /// <param name="folderId">The ID of the folder to count media in the folder.</param>
        /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
        /// <returns>The number of media information.</returns>
        /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
        /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
        /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="folderId"/> is null.</exception>
        /// <exception cref="ArgumentException"><paramref name="folderId"/> is a zero-length string, contains only white space.</exception>
        /// <since_tizen> 4 </since_tizen>
        public int CountMedia(string folderId, CountArguments arguments)
        {
            ValidateDatabase();

            ValidationUtil.ValidateNotNullOrEmpty(folderId, nameof(folderId));

            return(CommandHelper.Count(Interop.Folder.GetMediaCountFromDb, folderId, arguments));
        }
Beispiel #3
0
        public int CountMedia(string storageId, CountArguments arguments)
        {
            if (Exists(storageId) == false)
            {
                return(0);
            }

            return(CommandHelper.Count(Interop.Storage.GetMediaCountFromDb, storageId, arguments));
        }
Beispiel #4
0
        public void CountMedia_WITH_ARGS_RETURN()
        {
            var arguments = new CountArguments()
            {
                FilterExpression = $"{MediaInfoColumns.MediaType}={(int)MediaType.Music}"
            };

            Assert.That(_cmd.CountMedia(_tagId, arguments), Is.GreaterThan(0));
        }
Beispiel #5
0
        public void Count_WITH_ARGUMENTS()
        {
            CountArguments arguments = new CountArguments
            {
                FilterExpression = $"{TagColumns.Id}='{_tagId}'"
            };

            Assert.That(_cmd.Count(arguments), Is.EqualTo(1));
        }
Beispiel #6
0
        public void Test()
        {
            var count = new CountArguments(10);

            _generateManager.Handle(count);
            var text             = _fileReader.Handle(new FileInfoDto(((IHasDestFileInfo)_generateManager)._pathToDestinationFile));
            var toOverloadsCount = CSharpSyntaxTree.ParseText(text).GetRoot()
                                   .DescendantNodes().OfType <MethodDeclarationSyntax>()
                                   .Count(x => x.Identifier.ValueText == "To");

            Assert.AreEqual(toOverloadsCount, count.ArgumentCount);
        }
Beispiel #7
0
        /// <summary>
        /// Retrieves the number of the media information of the tag with the <see cref="CountArguments"/>.
        /// </summary>
        /// <param name="tagId">The tag ID to query with.</param>
        /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
        /// <returns>The number of the media information.</returns>
        /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
        /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
        /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="tagId"/> is less than or equal to zero.</exception>
        /// <since_tizen> 4 </since_tizen>
        public int CountMedia(int tagId, CountArguments arguments)
        {
            ValidateDatabase();

            if (tagId <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(tagId), tagId,
                                                      "Tag id can't be less than or equal to zero.");
            }

            return(CommandHelper.Count(Interop.Tag.GetMediaCount, tagId, arguments));
        }
Beispiel #8
0
        /// <summary>
        /// Retrieves the number of media information that belongs to the album with <see cref="CountArguments"/>.
        /// </summary>
        /// <param name="albumId">The ID of the album to count media.</param>
        /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
        /// <returns>The number of media information.</returns>
        /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
        /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="albumId"/> is equal to or less than zero.</exception>
        /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
        /// <since_tizen> 4 </since_tizen>
        public int CountMember(int albumId, CountArguments arguments)
        {
            ValidateDatabase();

            if (albumId <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(albumId), albumId,
                                                      "The album id can't be equal to or less than zero.");
            }

            return(CommandHelper.Count(Interop.Album.GetMediaCountFromDb, albumId, arguments));
        }
Beispiel #9
0
        /// <summary>
        /// Retrieves the number of media information of the playlist with the <see cref="CountArguments"/>.
        /// </summary>
        /// <param name="playlistId">The playlist ID to count the media added to the playlist.</param>
        /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
        /// <returns>The number of media information.</returns>
        /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
        /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
        /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
        /// <since_tizen> 4 </since_tizen>
        public int CountMember(int playlistId, CountArguments arguments)
        {
            ValidateDatabase();

            if (playlistId <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(playlistId), playlistId,
                                                      "Playlist id can't be less than or equal to zero.");
            }

            return(CommandHelper.Count(Interop.Playlist.GetMediaCountFromDb, playlistId, arguments));
        }
Beispiel #10
0
        /// <summary>
        /// Retrieves the number of tags with the <see cref="CountArguments"/>.
        /// </summary>
        /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
        /// <returns>The number of tags filtered.</returns>
        /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
        /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
        /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
        /// <since_tizen> 4 </since_tizen>
        public int Count(CountArguments arguments)
        {
            ValidateDatabase();

            return(CommandHelper.Count(Interop.Tag.GetTagCount, arguments));
        }
Beispiel #11
0
        /// <summary>
        /// Retrieves the number of folders with the <see cref="CountArguments"/>.
        /// </summary>
        /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
        /// <returns>The number of folders.</returns>
        /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
        /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
        /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
        /// <since_tizen> 4 </since_tizen>
        public int Count(CountArguments arguments)
        {
            ValidateDatabase();

            return(CommandHelper.Count(Interop.Folder.GetFolderCountFromDb, arguments));
        }
Beispiel #12
0
        /// <summary>
        /// Retrieves the number of playlists with the <see cref="CountArguments"/>.
        /// </summary>
        /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
        /// <returns>The number of playlists.</returns>
        /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
        /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
        /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
        /// <since_tizen> 4 </since_tizen>
        public int Count(CountArguments arguments)
        {
            ValidateDatabase();

            return(CommandHelper.Count(Interop.Playlist.GetPlaylistCount, arguments));
        }
Beispiel #13
0
        public int Count(CountArguments arguments)
        {
            ValidateDatabase();

            return(CommandHelper.Count(Interop.Storage.GetStorageCountFromDb, arguments));
        }