/// <summary>
/// Provides the ability to connect to and manage the database.
/// </summary>
+ /// <since_tizen> 4 </since_tizen>
public class MediaDatabase : IDisposable
{
/// <summary>
/// Initializes a new instance of the <see cref="MediaDatabase"/> class.
/// </summary>
+ /// <since_tizen> 4 </since_tizen>
public MediaDatabase()
{
}
/// Connects to the database.
/// </summary>
/// <exception cref="InvalidOperationException">The database is already connected.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while connecting.</exception>
+ /// <since_tizen> 4 </since_tizen>
public void Connect()
{
ValidateNotDisposed();
/// Disconnects from the media database.
/// </summary>
/// <exception cref="InvalidOperationException">The database is not connected.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while connecting.</exception>
+ /// <since_tizen> 4 </since_tizen>
public void Disconnect()
{
ValidateNotDisposed();
/// <summary>
/// Occurs when there is a change for media in the database.
/// </summary>
+ /// <since_tizen> 4 </since_tizen>
public static event EventHandler<MediaInfoUpdatedEventArgs> MediaInfoUpdated
{
add
}
}
-
private static readonly Interop.Content.MediaContentDBUpdatedCallback _folderUpdatedCb = (
MediaContentError error, int pid, ItemType updateItem, OperationType updateType,
MediaType mediaType, string uuid, string filePath, string mimeType, IntPtr _) =>
/// <summary>
/// Occurs when there is a change for the folder in the database.
/// </summary>
+ /// <since_tizen> 4 </since_tizen>
public static event EventHandler<FolderUpdatedEventArgs> FolderUpdated
{
add
/// </summary>
/// <param name="path">The path of the media to be scanned.</param>
/// <remarks>
- /// It requests to scan a media file to the media server.\n
+ /// It requests to scan a media file to the media server.<br/>
/// If the specified file is not registered to the database yet,
- /// the media file information will be added to the database.\n
- /// If it is already registered to the database, the media information is refreshed.\n
+ /// the media file information will be added to the database.<br/>
+ /// If it is already registered to the database, the media information is refreshed.<br/>
/// If the specified file does not exist,
- /// the record of the media file will be deleted from the database.\n
- /// \n
- /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.\n
- /// If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
+ /// the record of the media file will be deleted from the database.<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.<br/>
+ /// <br/>
+ /// If http://tizen.org/feature/content.scanning.others feature is not supported and the specified file is other-type,
+ /// <see cref="NotSupportedException"/> will be thrown.
/// </remarks>
/// <privilege>http://tizen.org/privilege/content.write</privilege>
/// <privilege>http://tizen.org/privilege/mediastorage</privilege>
/// <privilege>http://tizen.org/privilege/externalstorage</privilege>
/// <exception cref="InvalidOperationException">The database is not connected.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</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="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
+ /// <since_tizen> 4 </since_tizen>
public void ScanFile(string path)
{
ValidateState();
/// Requests to scan a folder recursively.
/// </summary>
/// <remarks>
- /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.\n
+ /// 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>
/// <remarks>Folders that contains a file named ".scan_ignore" will not be scanned.</remarks>
/// <returns>A task that represents the asynchronous scan operation.</returns>
/// <exception cref="InvalidOperationException">The database is not connected.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
/// <exception cref="ArgumentNullException"><paramref name="folderPath"/> is null.</exception>
/// <exception cref="ArgumentException">
- /// <paramref name="folderPath"/> is a zero-length string, contains only white space.\n
- /// -or-\n
- /// <paramref name="folderPath"/> contains a hidden path that starts with '.'.\n
- /// -or-\n
+ /// <paramref name="folderPath"/> is a zero-length string, contains only white space.<br/>
+ /// -or-<br/>
+ /// <paramref name="folderPath"/> contains a hidden path that starts with '.'.<br/>
+ /// -or-<br/>
/// <paramref name="folderPath"/> contains a directory containing the ".scan_ignore" file.
/// </exception>
+ /// <since_tizen> 4 </since_tizen>
public Task ScanFolderAsync(string folderPath)
{
return ScanFolderAsync(folderPath, true);
/// Requests to scan a folder.
/// </summary>
/// <remarks>
- /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.\n
+ /// 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>
/// <remarks>Folders that contains a file named ".scan_ignore" will not be scanned.</remarks>
/// <returns>A task that represents the asynchronous scan operation.</returns>
/// <exception cref="InvalidOperationException">The database is not connected.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
/// <exception cref="ArgumentNullException"><paramref name="folderPath"/> is null.</exception>
/// <exception cref="ArgumentException">
- /// <paramref name="folderPath"/> is a zero-length string, contains only white space.\n
- /// -or-\n
- /// <paramref name="folderPath"/> contains a hidden path that starts with '.'.\n
- /// -or-\n
+ /// <paramref name="folderPath"/> is a zero-length string, contains only white space.<br/>
+ /// -or-<br/>
+ /// <paramref name="folderPath"/> contains a hidden path that starts with '.'.<br/>
+ /// -or-<br/>
/// <paramref name="folderPath"/> contains a directory containing the ".scan_ignore" file.
/// </exception>
+ /// <since_tizen> 4 </since_tizen>
public Task ScanFolderAsync(string folderPath, bool recursive)
{
return ScanFolderAsync(folderPath, recursive, CancellationToken.None);
/// Requests to scan a folder recursively.
/// </summary>
/// <remarks>
- /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.\n
+ /// 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>
/// <remarks>Folders that contains a file named ".scan_ignore" will not be scanned.</remarks>
/// <returns>A task that represents the asynchronous scan operation.</returns>
/// <exception cref="InvalidOperationException">The database is not connected.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
/// <exception cref="ArgumentNullException"><paramref name="folderPath"/> is null.</exception>
/// <exception cref="ArgumentException">
- /// <paramref name="folderPath"/> is a zero-length string, contains only white space.\n
- /// -or-\n
- /// <paramref name="folderPath"/> contains a hidden path that starts with '.'.\n
- /// -or-\n
+ /// <paramref name="folderPath"/> is a zero-length string, contains only white space.<br/>
+ /// -or-<br/>
+ /// <paramref name="folderPath"/> contains a hidden path that starts with '.'.<br/>
+ /// -or-<br/>
/// <paramref name="folderPath"/> contains a directory containing the ".scan_ignore" file.
/// </exception>
+ /// <since_tizen> 4 </since_tizen>
public Task ScanFolderAsync(string folderPath, CancellationToken cancellationToken)
{
return ScanFolderAsync(folderPath, true, cancellationToken);
}
/// <summary>
- /// Requests to scan a folder recursively.
+ /// Requests to scan a folder.
/// </summary>
/// <remarks>
- /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.\n
+ /// 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>
/// <remarks>Folders that contains a file named ".scan_ignore" will not be scanned.</remarks>
/// <returns>A task that represents the asynchronous scan operation.</returns>
/// <exception cref="InvalidOperationException">The database is not connected.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
/// <exception cref="ArgumentNullException"><paramref name="folderPath"/> is null.</exception>
/// <exception cref="ArgumentException">
- /// <paramref name="folderPath"/> is a zero-length string, contains only white space.\n
- /// -or-\n
- /// <paramref name="folderPath"/> contains a hidden path that starts with '.'.\n
- /// -or-\n
+ /// <paramref name="folderPath"/> is a zero-length string, contains only white space.<br/>
+ /// -or-<br/>
+ /// <paramref name="folderPath"/> contains a hidden path that starts with '.'.<br/>
+ /// -or-<br/>
/// <paramref name="folderPath"/> contains a directory containing the ".scan_ignore" file.
/// </exception>
+ /// <since_tizen> 4 </since_tizen>
public Task ScanFolderAsync(string folderPath, bool recursive, CancellationToken cancellationToken)
{
ValidateState();
private async Task ScanFolderAsyncCore(string folderPath, bool recursive, CancellationToken cancellationToken)
{
- var tcs = new TaskCompletionSource<bool>(TaskContinuationOptions.RunContinuationsAsynchronously);
+ var tcs = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
using (var cbKeeper = ObjectKeeper.Get(GetScanCompletedCallback(tcs, cancellationToken)))
using (RegisterCancellationAction(tcs, folderPath, cancellationToken))
/// Disposes of the resources (other than memory) used by the MediaDatabase.
/// </summary>
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
+ /// <since_tizen> 4 </since_tizen>
protected virtual void Dispose(bool disposing)
{
if (!_disposed)
/// <summary>
/// Releases all the resources.
/// </summary>
+ /// <since_tizen> 4 </since_tizen>
public void Dispose()
{
Dispose(true);
}
/// <summary>
- /// Gets the value indicating whether the database has been disposed of.
+ /// Gets the value indicating whether the database has been disposed.
/// </summary>
- /// <value>true if the database has been disposed of; otherwise, false.</value>
+ /// <value>true if the database has been disposed; otherwise, false.</value>
+ /// <since_tizen> 4 </since_tizen>
public bool IsDisposed => _disposed;
#endregion