/// <param name="path">The file path to add.</param>
/// <returns>The <see cref="MediaInfo"/> instance that contains the record information in the database.</returns>
/// <remarks>
- /// If the media already exists in the database, it returns the existing information.\n
- /// \n
- /// The <see cref="MediaDatabase.ScanFile(string)"/> or the <see cref="MediaDatabase.ScanFolderAsync(string)"/> can be used instead.\n
- /// \n
- /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.\n
+ /// If the media already exists in the database, it returns the existing information.<br/>
+ /// <br/>
+ /// The <see cref="MediaDatabase.ScanFile(string)"/> or the <see cref="MediaDatabase.ScanFolderAsync(string)"/> can be used instead.<br/>
+ /// <br/>
+ /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.<br/>
/// If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
/// </remarks>
/// <privilege>http://tizen.org/privilege/content.write</privilege>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentException">
- /// <paramref name="path"/> is a zero-length string, contains only white space.\n
- /// -or-\n
- /// <paramref name="path"/> contains a hidden path that starts with '.'.\n
- /// -or-\n
+ /// <paramref name="path"/> is a zero-length string, contains only white space.<br/>
+ /// -or-<br/>
+ /// <paramref name="path"/> contains a hidden path that starts with '.'.<br/>
+ /// -or-<br/>
/// <paramref name="path"/> contains a directory containing the ".scan_ignore" file.
/// </exception>
/// <exception cref="FileNotFoundException"><paramref name="path"/> does not exists.</exception>
/// Adds media files into the media database.
/// </summary>
/// <remarks>
- /// The paths that already exist in the database will be ignored.\n
- /// At most 300 items can be added at once.\n
- /// \n
- /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.\n
+ /// The paths that already exist in the database will be ignored.<br/>
+ /// At most 300 items can be added at once.<br/>
+ /// <br/>
+ /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.<br/>
/// If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
/// </remarks>
/// <privilege>http://tizen.org/privilege/content.write</privilege>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentNullException"><paramref name="paths"/> is null.</exception>
/// <exception cref="ArgumentException">
- /// <paramref name="paths"/> contains null.\n
- /// -or-\n
- /// <paramref name="paths"/> contains the invalid path.\n
- /// -or-\n
+ /// <paramref name="paths"/> contains null.<br/>
+ /// -or-<br/>
+ /// <paramref name="paths"/> contains the invalid path.<br/>
+ /// -or-<br/>
/// The number of <paramref name="paths"/> is 300 or more items.
/// </exception>
/// <exception cref="FileNotFoundException"><paramref name="paths"/> contains a path that does not exist.</exception>
}
}
- private static void SetUpdateValue<T>(Interop.MediaInfoHandle handle, T value,
- Func<Interop.MediaInfoHandle, T, MediaContentError> func)
- {
- if (value != null)
- {
- func(handle, value).ThrowIfError("Failed to update");
- }
- }
-
- private static void SetUpdateValue<T>(Interop.MediaInfoHandle handle, Nullable<T> value,
- Func<Interop.MediaInfoHandle, T, MediaContentError> func) where T : struct
- {
- if (value.HasValue)
- {
- func(handle, value.Value).ThrowIfError("Failed to update");
- }
- }
-
/// <summary>
- /// Updates the media with the specified values.
+ /// Updates the media with the favorite value.
/// </summary>
/// <privilege>http://tizen.org/privilege/content.write</privilege>
/// <param name="mediaId">The media ID to update.</param>
- /// <param name="values">The values for update.</param>
+ /// <param name="value">The value indicating whether the media is favorite.</param>
/// <returns>true if the matched record was found and updated, otherwise false.</returns>
- /// <remarks>Only values set in the <see cref="MediaInfoUpdateValues"/> are updated.</remarks>
/// <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="ArgumentNullException">
- /// <paramref name="mediaId"/> is null.\n
- /// -or-\n
- /// <paramref name="values"/> is null.
- /// </exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
/// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
- public bool Update(string mediaId, MediaInfoUpdateValues values)
+ public bool UpdateFavorite(string mediaId, bool value)
{
ValidateDatabase();
ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
- if (values == null)
- {
- throw new ArgumentNullException(nameof(values));
- }
-
if (CommandHelper.Count(
Interop.MediaInfo.GetMediaCount, $"{MediaInfoColumns.Id}='{mediaId}'") == 0)
{
try
{
- SetUpdateValue(handle, values.Weather, Interop.MediaInfo.SetWeather);
- SetUpdateValue(handle, values.IsFavorite, Interop.MediaInfo.SetFavorite);
- SetUpdateValue(handle, values.Provider, Interop.MediaInfo.SetProvider);
- SetUpdateValue(handle, values.Category, Interop.MediaInfo.SetCategory);
- SetUpdateValue(handle, values.LocationTag, Interop.MediaInfo.SetLocationTag);
- SetUpdateValue(handle, values.AgeRating, Interop.MediaInfo.SetAgeRating);
+ Interop.MediaInfo.SetFavorite(handle, value).ThrowIfError("Failed to update");
Interop.MediaInfo.UpdateToDB(handle).ThrowIfError("Failed to update");
return true;
/// <param name="newPath">The path that the media has been moved to.</param>
/// <returns>true if the matched record was found and updated, otherwise false.</returns>
/// <remarks>
- /// Usually, it is used after the media file is moved to the another path.\n
- /// \n
- /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.\n
+ /// Usually, it is used after the media file is moved to the another path.<br/>
+ /// <br/>
+ /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.<br/>
/// If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
/// </remarks>
/// <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="ArgumentNullException">
- /// <paramref name="mediaId"/> is null.\n
- /// -or-\n
+ /// <paramref name="mediaId"/> is null.<br/>
+ /// -or-<br/>
/// <paramref name="newPath"/> is null.
/// </exception>
/// <exception cref="ArgumentException">
- /// <paramref name="mediaId"/> is a zero-length string, contains only white space.\n
- /// -or-\n
- /// <paramref name="newPath"/> is a zero-length string, contains only white space.\n
- /// -or-\n
- /// <paramref name="newPath"/> contains a hidden directory that starts with '.'.\n
- /// -or-\n
+ /// <paramref name="mediaId"/> is a zero-length string, contains only white space.<br/>
+ /// -or-<br/>
+ /// <paramref name="newPath"/> is a zero-length string, contains only white space.<br/>
+ /// -or-<br/>
+ /// <paramref name="newPath"/> contains a hidden directory that starts with '.'.<br/>
+ /// -or-<br/>
/// <paramref name="newPath"/> contains a directory containing the ".scan_ignore" file.
/// </exception>
/// <exception cref="FileNotFoundException"><paramref name="newPath"/> does not exists.</exception>
/// <param name="mediaId">The media ID to create the thumbnail.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the thumbnail path.</returns>
/// <exception cref="InvalidOperationException">
- /// The <see cref="MediaDatabase"/> is disconnected.\n
- /// -or-\n
+ /// The <see cref="MediaDatabase"/> is disconnected.<br/>
+ /// -or-<br/>
/// An internal error occurred while executing.
/// </exception>
/// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
/// </exception>
/// <exception cref="FileNotFoundException">The file of the media does not exists; moved or deleted.</exception>
/// <exception cref="UnsupportedContentException">
- /// The thumbnail is not available for the given media.\n
- /// -or-\n
+ /// The thumbnail is not available for the given media.<br/>
+ /// -or-<br/>
/// The media is in the external USB storage (<see cref="MediaInfo.StorageType"/> is <see cref="StorageType.ExternalUsb"/>).
/// </exception>
public Task<string> CreateThumbnailAsync(string mediaId)
/// <param name="cancellationToken">The token to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the thumbnail path.</returns>
/// <exception cref="InvalidOperationException">
- /// The <see cref="MediaDatabase"/> is disconnected.\n
- /// -or-\n
+ /// The <see cref="MediaDatabase"/> is disconnected.<br/>
+ /// -or-<br/>
/// An internal error occurred while executing.
/// </exception>
/// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
/// </exception>
/// <exception cref="FileNotFoundException">The file of the media does not exists; moved or deleted.</exception>
/// <exception cref="UnsupportedContentException">
- /// The thumbnail is not available for the given media.\n
- /// -or-\n
+ /// The thumbnail is not available for the given media.<br/>
+ /// -or-<br/>
/// The media is in the external USB storage (<see cref="MediaInfo.StorageType"/> is <see cref="StorageType.ExternalUsb"/>).
/// </exception>
public Task<string> CreateThumbnailAsync(string mediaId, CancellationToken cancellationToken)
/// <param name="mediaId">The media ID to create the thumbnail.</param>
/// <returns>A task that represents the asynchronous add operation. The task result contains the number of faces detected.</returns>
/// <exception cref="InvalidOperationException">
- /// The <see cref="MediaDatabase"/> is disconnected.\n
- /// -or-\n
+ /// The <see cref="MediaDatabase"/> is disconnected.<br/>
+ /// -or-<br/>
/// An internal error occurred while executing.
/// </exception>
/// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
/// <param name="cancellationToken">The token to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the number of faces detected.</returns>
/// <exception cref="InvalidOperationException">
- /// The <see cref="MediaDatabase"/> is disconnected.\n
- /// -or-\n
+ /// The <see cref="MediaDatabase"/> is disconnected.<br/>
+ /// -or-<br/>
/// An internal error occurred while executing.
/// </exception>
/// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
/// </exception>
/// <exception cref="FileNotFoundException">The file of the media does not exists; moved or deleted.</exception>
/// <exception cref="UnsupportedContentException">
- /// Face detection is not available for the given media.\n
- /// -or-\n
+ /// Face detection is not available for the given media.<br/>
+ /// -or-<br/>
/// The media is in the external USB storage (<see cref="MediaInfo.StorageType"/> is <see cref="StorageType.ExternalUsb"/>).
/// </exception>
/// <exception cref="NotSupportedException">The required feature is not supported.</exception>